6

I recently bought Xen VPS (linode.com) with Debian 5.0 Lenny (i386), 512MB RAM. At the moment I have only three small websites (built with Drupal) with about 600 users per day in total running on this server.

As a web server I use nginx 0.7.67 (PHP 5.3.3 with php-fpm). An average memory consumption is about 100-105MB. Here is what Munin graph shows:

alt text

and this is what "top" command diplays (sorted by memory usage):

alt text

In my php5-fpm.conf:

pm = dynamic
pm.max_children = 50
pm.start_servers = 2
pm.min_spare_servers = 2
pm.max_spare_servers = 5
pm.max_requests = 500

Before migrating some bigger projects to this VPS I'd like to know if this is a normal memory consumtion for this kind of server configuration? How many users on the website (let's say, built with Zend Framework) this VPS can handle?

Thank you!

user38484
  • 313
  • 2
  • 5
  • 10

4 Answers4

7

For me that looks good. Your PHP + MySQL is taking only around 100 megabytes of RAM, leaving lots of room for the operating system to breathe.

For your "how many users this VPS can handle?" question: it depends. With proper caching and other best practices I think it should handle at least dozens of requests per second, if not more.

If the content is highly dynamic and not very well cacheable and the database structure happens to be complex and/or the database is big, then the performance will suffer.

Usually the memory will be the first limit you'll hit whenever your traffic grows, with highly dynamic content the CPU will be tortured, too.

Janne Pikkarainen
  • 31,454
  • 4
  • 56
  • 78
7

It isn't good, your php5-fpm process take around 35Mo. With this configuration you may have 50 process (max_children = 50), with each one of them allocating 35mo. thus, your machine which have only 512Mo will swap. I think that your limit is around 10 process of php-fpm (max_children = 10).

  • 3
    Right on the money. Look at your top output - each php5-fpm child process takes between 30 and 45 Mb. You have headroom of maybe 300 Mb. To be conservative and avoid swapping, consider setting your max children to 7. – mattandrews Nov 10 '11 at 00:00
2

Linode rocks! My only advice is to move MySQL to a separate 512MB linode. The benefits are many and unless $20/mo will break the bank, there is no downside.

My gut tells me you're running debian or ubuntu.. Check out the stack script library. There is a dedicated MySQL server optimized for linode. Then add the private IP (free) to your file/nginx/php-fpm server and add the private IP to your db server. All data will travel within the local network at your linode's DC. It's fast and does not count against your monthly bandwidth cap.

You can even put your 'larger project' site on the same nginx/php-fpm linode. As traffic increases you can add dedicated memcached VPSs, dedicated PHP-FPM VPSs and scale horizontally across as many $20 512MB linodes as you want/need.

Your db will scale vertically... so when it starts to get hungry, bump it up to the next size.

How much it can handle will depend on factors like caching, clean code and # of db calls per page load... Splitting up the front end from the db opens the door to "scale as large as you want", easily.

eyecool
  • 21
  • 1
0

I was concerned about this fact as well. I am running using the Amazon EC2 virtual server system with a micro instance that only has 613Mb of "memory". I can say from our testing that it can handle at least 50 children running concurrently without any noticeable problem. I cant explain the behaviour but can tell you that it still works.

Brian
  • 26
  • 1