|Home||Simply ABC of Web-Server Tuning||Downloads|
The ABC of Web-Server performance tuning recommendations.|
The below list is quite simple and trivial but during my many years as Database and Webserver Performance Consultant my experience was that often these simple rules are key for good performance.
1) Pick the right WebserverApache is popular and good for small sites with less than 10 million hits per day.
If you run a bigger site you should consider using a more efficient webserver.
ZEUS is very good. If you can effort ZEUS then its a good option.
Lighttpd is free and very efficient. Lighty is a good choice for a bigger site.
2) Reduce your connections - Part IBrowser connections will tie up value resources of your webserver. Try to answer your visitors as quickly as possible, and try to reduce unneeded connections. Browser can cache images. They will do so but they will constantly verify if the cached images are still the newest version. Set up your webserver to send HTTP-EXPIRE header for all files on your site which do not change. Sending matching EXPIRE headers will enable the browser of your visitor to cache images without the need to generate these unneeded http request. Proper EXPIRE header can reduce the amount of traffic and unneeded requests that your servers have to handle a lot.
3) Reduce your connections - Part IIEnable HTTP compression for all HTML content that your server sends. Mostly all webserver have more than enough CPU power to compress all the HTML content dynamically. HTML does compress very good - usually down to 25% or less. By enabling compression your users will load the pages faster - which makes your site feel faster. More important for your webserver is, that the browser will finish the download faster and thereby freeing up the webserver connection much quicker. This means that with the same amount of connections you can now handle twice or more visitors as before.
4) Reduce your connections - Part IIIIts difficult for a webbrowser to correctly cache a dynamic webpage. Many webdeveloper simply disallow caching of dynamic content - This is wrong!
A much better solution is to provide ETAGS for your dynamic content. ETAGS are part of the HTTP-protocol and are specially designed to enable browsers to check if a dynamic page is still valid or not. On the download page your will find a PHP example for enabling ETAGS. Enableing proper ETAGs will reduce the traffic of your site and make the site feel faster for the users and it will free up connection resources of your servers too.
5) Use the right PHP BackendMany people use MOD_PHP. Don't do this!
Mod_PHP does bundle a PHP engine to each webserver process. This will waste valueable PHP-engine resources. A solution that scales much better is to seperate the PHP engine from the webserver. A good option is to use a FASTCGI server for this. When you run PHP as FASTCGI you will be able to handle a much higher workload with to same number of PHP processes.
6) Pool your Database-connectionsEnable your FASTCGI PHP engine to pool database connections. Make sure that your web applications pools and resuses database connections too. One dynamic createa page should always only use one database connections at max. I've seen customers not doing this and wasting huge amount of money on database servers because of this.
7) Use a PHP CacheAlways use a PHP Cache. Very good caches are APC and Eaccelerator. If you run a small site and have not time to setup the environmont yourself then ZEND might be a good solution. But if you run a bigger site and are experienced then you can achive a better result by choosing the compenents yourself.