Nginx – How much RAM do I need to run a forum using Nginx, Gunicorn, Django

amazon ec2gunicornmemorynginxswap

I started an ec2 instance (micro) to test the amount of memory I have available to run a website but I was expecting having a bit more. So my question would be: How much RAM do I need to run a site using Django, Nginx and Gunicorn. This is what I found:

Starting a Ubuntu 12.04 instance consumes:

             total       used       free     shared    buffers     cached
Mem:           590        235        354          0          7        182
-/+ buffers/cache:         45        544
Swap:            0          0          0

After running Gunicorn:

             total       used       free     shared    buffers     cached
Mem:           590        195        394          0          9         73
-/+ buffers/cache:        112        477
Swap:            0          0          0

So I have 394MB available although I forgot to create a swap volume. Is that enough to run a forum receiving 3000-4000 visits per month? I would also appreciate some comments on the proper way to configure swap.

Thanks a lot

Best Answer

The used memory is 45MB, not 235MB. to know this you need to go here to get the detail to check how you can know the Actual memory usage using this command and where the memory went.

http://www.linuxatemyram.com/

  1. Immediately create a swap partition, atleast of 2GB or more, as in any case of the server goes out of RAM, then SWAP will be used as memory usage, which will slow down server but atleast wont crash it.

  2. To know the actual amount of usage, based on the number of users you are having, you need to use come load testing tools, which will test your website with 1, 10,20,50,1000-4000 users, and based on what type of requests you give to each user. For example, based on that software, you can record a user loggin in to site , surfing some pages and loggin off, and the software will run the same scenario for number of users you provide. So for each number of users, you can check the amount of RAM used, which will give you an idea that how much RAM your site needs. Some of the load testing tools are :

http://loadimpact.com/

http://www.webresourcesdepot.com/15-free-functionality-and-load-testing-tools-for-web-applications/

http://www.webperformance.com/

https://stackoverflow.com/questions/507683/open-source-tool-for-stress-testing-load-testing-and-performance-testing

http://jcrawler.sourceforge.net/

  1. DONT RUN the tests on Micro instance, as its CPU is throttled not to be used to its actual usage, and you can get false results due to CPU throttling. Atleast use Amazon SMALL server when you are going to perform tests.