Drupal & VPS

cpract - February 10, 2008 - 17:45

I am currently having some problem with my Drupal installation on my VPS account (Debian 4, Intel ntel(R) Xeon(R) CPU E5310 @ 1.60GHz, 512MB RAM). When running Apache Benchmark I quickly with values -n 100 and -c 10 (#ab -n 100 -c 10 -v 2 http://domain.com) I get these figures:

[code]
Server Software: Apache/2.2.8
Server Hostname: domain
Server Port: 80

Document Path: /
Document Length: 12855 bytes

Concurrency Level: 10
Time taken for tests: 49.105257 seconds
Complete requests: 100
Failed requests: 0
Write errors: 0
Total transferred: 1343300 bytes
HTML transferred: 1285500 bytes
Requests per second: 2.04 [#/sec] (mean)
Time per request: 4910.526 [ms] (mean)
Time per request: 491.053 [ms] (mean, across all concurrent requests)
Transfer rate: 26.70 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.1 0 1
Processing: 471 4808 11216.5 995 48409
Waiting: 448 4780 11210.4 967 48385
Total: 471 4808 11216.5 995 48410

Percentage of the requests served within a certain time (ms)
50% 995
66% 1478
75% 2636
80% 3162
90% 9371
95% 42338
98% 44951
99% 48410
100% 48410 (longest request)
[/code]

Not too impressive numbers. If I increase the number of requests to -n 200 and the concurrent requests to c- 50, the site is going down due to lack of RAM. I have currently only a development site at this particular VPS account, but from this it is seems that I cannot not use the VPS account to the production site even though I do not expect a hugh loading at start? The strange thing is that on one of my webhosting accounts, I have hade a Drupal installations with actually higher loading than that... My original thought was to start off with a basic VPS account to begin with before I go dedicated/buy my own server, but it seems like that it is not an option? Or is it enough to increase the RAM to say 1GB?

What are the recommended hardware requirements for Drupal & MySQL to be able to handled a modest load?

Think tuning not hardware

styro - February 10, 2008 - 20:19

The performance of any given Drupal site depends not so much on the hardware as the site itself, the expected load, and the tuning of the server. 512MB of ram is usually adequate for a site on a tuned server that doesn't get large amounts of traffic, as long as it hasn't been bogged down with too many extra modules.

Is that a realistic load? Averaging 2 requests per second for a month is 5 million requests. Sure that doesn't take into account the "peaky"ness of web traffic but are you expecting even 5-10% of that per month?

What happens with 3 or 5 concurrent requests? Do you still approach 2 requests per second?

I would try plotting the results as you work your way up to 10 concurrent requests. That will give you an idea of where it starts to fall down. Is there a scalability "wall" that you hit at a certain number of concurrent requests?

What is probably (I'm only guessing) happening is that you have too many Apache processes available. As you get more an more concurrent requests, Apache creates more processes. As each process will use a certain amount of memory you will end up starving MySQL of memory and the database performance will suffer. If you limit the number of process Apache creates, you can actually improve performance depending on the situation.

Before you splash out on more ram, you should see how far you get with tuning your server and Drupal site. Then once you've done that and you still need more memory, you will be making better use of that new memory anyway.

Some other obvious things:

Have you enabled caching for anonymous users in Drupal?

Have you installed the devel module to see if you have any inefficient queries getting called a lot? Can you work around those?

Is your front page extremely dynamic?

Are you using private downloads?

Have you installed lots of Drupal modules you don't really need?

Have you tested increasing MySQLs memory limits?

Have you tuned your MySQL query cache?

Have you tested a PHP opcode cache? eg eAccellerator or APC etc.

For a comprehensive set of articles about Drupal/Apache/MySQL/PHP tuning see Khalids site: http://2bits.com/contents/articles

A well tuned site will make better use of any extra hardware resources you add later than an untuned one would.

--
Anton
New to Drupal? | Troubleshooting FAQ
Example knowledge base built with Drupal

The Opcode cache

rernst - February 11, 2008 - 00:33

is the single best upgrade you can do. APC is simple to install and increases performance dramatically.

I also recommend tuning the apache processes: the stock apache installs on most distros allow too many threads/child processes to be optimal. Start with a very low minimum, and try to tune the maximum so it won't kill your server.

 
 

Drupal is a registered trademark of Dries Buytaert.