Nginx – How to optimize system resource usage for many different gunicorn powered Django sites with low traffic

djangomemorynginxoptimizationsupervisord

My server is a Linode with 768MB of RAM. It is home to around 8 small, low traffic Django sites powered by Nginx, Supervisor, and Gunicorn. Currently, each site has its own Linux user account, with the site's files in the home directory of the user. Each user has a development and production supervisor process that runs Gunicorn with between 1 and 4 workers.

We are a small consulting firm, and for the near future we will just be adding more and more small, low traffic Django sites to the server. When I look at top, I've got a bunch of Gunicorn processes running, and RAM is almost completely used up. For a while we only had 512MB of RAM and it was almost completely used up, but when we added more RAM, the Gunicorn processes only took up more RAM.

Is there a good way to optimize this server for as many low traffic (like 1000 hits a month) Django sites as possible? I opted for an Nginx setup over Apache because I read it was better on system resources, but it seems like the current setup is not using resources very effectively.

Best Answer

Honestly as long as you don't experience poor performance don't worry.

Lately a lot of products are using in Linux memory management, which does not release the memory as far as the monitoring is concerned because the data is cached ready to be accessed much faster the next time it is needed. Linux manages the memory so that if a process needs more, then it will be allocated appropriately, clearing the cache where necessary.

SO basically if you don't have a lot of swap activity it's all good.