An Optimal Server Configuration
Posted by Jon Lee in Efficiency, Web Development, tags: Apache, eAccelerator, Efficiency, FastCGI, MySQL, PHP, speed-up-your-blog
For one of my fourth year Statistics courses, I did my final group project on the analysis of server-side web page generation time for two different Content Management Systems. We looked at 6 different factors that would affect the generation time to see what the optimal levels should be. For each factor, we considered 2 levels (a 2^6 full factorial experiment). The factors are as follows:
- CMS (Drupal vs Joomla)
- Apache version (1.x vs 2.x)
- PHP version (PHP4 vs PHP5)
- MySQL Caching (on vs off)
- FastCGI (on vs off)
- eAccelerator (on vs off)
The experiment was run using a PERL script whipped up by my group partner and skipping past the math/statistics mumbo jumbo, we came to the following result:
Results
The first four factors listed above had a negligible effect on page generation time. The only significant effects were:
- Using FastCGI saves about 60 milliseconds.
- Using eAccelerator saves about 70 milliseconds.
- Using both together saves an additional 11 milliseconds.
Without using FastCGI/eAccelerator, the average page load time was about ~170 milliseconds. Using both, the page load time was only ~20 milliseconds. That is an 88% decrease in page generation time!
You can save 150 milliseconds… big whoop right? Well a single server that can serve a page over 8 times as fast as a regular server can pretty much do the same job as 8 separate servers combined. This leads to tremendous cost savings even if the end user doesn’t notice much of a difference.
How to Check if you have eAccelerator/FastCGI Enabled
If you’re with a web hosting company, they will most likely have at least one of these enabled (to reduce costs of course). To check, you can do a simple phpinfo command:
- Create a blank php file (i.e. testpage.php)
- Put the following line of code in the file:
- Upload and navigate to that page on your browser.
- Voila! Your server’s PHP configuration! Just do a search for eAccelerator and FastCGI to see if it’s enabled.
<?php phpinfo(); ?>
Conclusion
If you’re hosting sites on your own private server, the optimal configuration, regardless of CMS, Apache or PHP versions is to have FastCGI and eAccelerator installed! Of course, this is not the only way to optimize your server — just two ways I looked at for this project (notice the title of this post is “An” optimal configuration, not “The” optimal configuration).
I’d like to hear how everyone optimizes their own servers so leave a comment!
Popularity: 4% [?]
Entries (RSS)
Thanks for this tip!
Every little bit helps…
You should add that phpinfo should be deleted when your done, or password protected…
If you want to learn about servers then host on a Linux Virtial Machine…. by far the cheapest way to get root access….
Thanks for your tip, this is very interesting.
Regards
forgot to ask, how did the joomla vs drupal experiment go???
The tests were very informal but we found that Joomla was faster than Drupal by 6 milliseconds
The times are based on wget on similar pages on both CMS.
Interesting stuff to play with, my impression is that Drupal is a much heavier application, so that would make sense…. bu I have never spent much time looking at Drupal, and only had a brief play with Joola.
I was playing with Xoops a while back, that looks pretty cool… I think I will use that at some point….
I dont know much about technology, but this was a cool post nonetheless. There is no better way to learn than by reading posts like this!
It’s really good tip.
i’ll try to do on my server if .. i’ll be able to do.
Thanks for the tip. Will try to experiment tomorow.