Kong memory usage doesn't come down

Hello @cedar715,

This is more or less expected behavior in regard to how LuaJIT VM is used by Kong. As long as the memory does not grow unconfined it is not considered as a memory leak.

The reason behind it is that Kong heavily caches various objects inside the Lua VM for speeding up the access, which does not get freed when the load is gone. Plus the LuaJIT VM itself does not always gives back freed memory to the O/S for various reasons (fragmentation, avoid frequent system calls, etc).

If you are running low on RAM, scaling down the number of Nginx workers Kong uses with nginx_worker_processes will help.

BTW: the VSZ shown does not reflect the amount of physical memory Kong uses. RSS is more closer to that you may be looking for.

3 Likes