Search code examples
nginxluaapi-gatewaykongopenresty

How does Kong work over NGINX and OpenResty


What i have understood is that NGINX is written in C and has a lua plugin which allows lua code to be embedded in it. OpenResty is a framework which expands on this and allows greater Lua support over NGINX. Kong is specific OpenResty application. So when we post new services, consumers etc is everything converted to a lua template which is compiled by LuaJIT. And if so, does it mean that each time i add a service, my nginx.conf file rebuilds? Or is it something like that on each request the kong config DB(or yaml) is queried to get dependednt endpoint(this would be very slow)? or something completely else?


Solution

  • The whole point of having a scripting language like Lua embedded into nginx is that you can change its behavior on the fly without having to reload the whole configuration. I don't know how exactly kong handles things, but you could just load new Lua code at runtime, though in most cases it would be enough to change some data that the Lua code then handles in a predefined way.