2

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

r_31415
  • 121
  • 1
  • 4

1 Answers1

6

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.
Farhan
  • 4,210
  • 9
  • 47
  • 76
  • Great answer. First of all, great page (linuxatemyram) As for load testing, yes, I have been reading about that but I was worried about the supposedly low memory available. By the way, some of those testing tool (loadimpact or blitz, for example) simulate a real user or do they simple try to retrieve a single probably cached page? By the way, I wanted to know, based on other people's experience, how much RAM is required to run a site like the one I described, not so much because I wanted to avoid doing load testing but to know if a micro instance is enough. – r_31415 Nov 09 '12 at 18:24
  • No one can be 100% surely tell you that how much RAM our site requires. there is NO Formula present there to know about it. one page can take 1 KB to load and even 100MB RAM as well in worst cases. So only load testing tools can tell you that much RAM Eac page of yours consumes... Simple, run page load test with 1 user, and see how much RAM is used, then make it 5 users, and this way you will get average that how much RAM your site required. – Farhan Nov 09 '12 at 19:40
  • Regarding micro instance, already told you that it will surely give you false results, its not about its RAM, but its CPU usage, which is throttled by amazon. – Farhan Nov 09 '12 at 19:40
  • Does it vary so widely? Wow. I would have thought that there are several broad categories and resources depend on those categories. As for load testing, I run it in a single page (e.g. a post in the forum) and that's is going to be a decent measure? – r_31415 Nov 09 '12 at 20:02