RSS Feed
Thoughts in server / PHP-based website performance optimization
Posted by Esvon Support on 30 July 2009 01:10 PM
Hi again,

We'd like to share some thoughts regarding PHP-based website performance optimization with you and really hope you will find something useful to think about
and to make further research before making actual changes in your server environment.

1/ PHP 5.3

New PHP 5.3 offers a significant performance gain over previous PHP versions - try Google search on "PHP 5.3 performance" and you will get some real digits

2/ eAccelerator

eAccelerator installation allows to serve PHP content about 3 times faster (it may vary), don't forget to have Zend Optimizer installed after eAccelerator in php.ini ( see )

3/ Client side - caching

All static content (HTML pages, images, etc) can be cached in the browser by Expires header and Cache-Control header for 30-45 days (look at "mod_expires" Apache module).
Client-side cache can significantly improve the second visit, you'll get happy returning visitors and reduced bandwidth usage

4/ Use Nginx for font-end

Nginx usage for front-end and Apache for back-end is very beneficial for heavily loaded servers.
Nginx serves static content very efficiently, acts as reverse proxy for dynamic content (Apache/PHP) and allows to reduce memory consumption (RAM requirements).
You can start thinking about this model if your server load exceeds 10 http-requests per second

5/ MySQL

5a/ Query cache and buffer sizes

Make sure MySQL query cache is enabled and has proper size (you can start with 4MB or 64MB depending on the RAM available, use "query_cache_size" parameter in my.cnf)
Pay attention to "key_buffer" and "table_cache" parameters, they are important and shouldn't be too small.

5b/ InnoDB (selective)

This option is not for low end VPS, where InnoDB should be disabled to save memory.
In MySQL it is wise to change type of certain tables from MyISAM to InnoDB. MyISAM uses table-level blocking, InnoDB uses row-level blocking.
Conversion to InnoDB is useful for tables which experience many SQL updates (i.e. more than 20% write to 80% reads, e.g., session, hits, accesslog tables).
Don't forget to balance the amount of RAM between MyISAM and InnoDB because the buffers for each are configured separately.

5c/ Disable MySQL DNS Hostname Lookup

Add line "skip-name-resolve" in my.cnf, but you can only use IP numbers in the MySQL Grant table if you activate this option.


Consider TMPFS usage, virtual memory is much faster than a persistent storage device.

Sincere wishes
to outstanding website performance

The Esvon Team

Comments (0)
Help Desk Software by Kayako Fusion