Skip to main content
Notice removed Historical significance by CommunityBot
Post Unlocked by CommunityBot
edited tags
Link
HopelessN00b
  • 54.1k
  • 36
  • 140
  • 212
Post Locked by HopelessN00b
Notice added Historical significance by HopelessN00b
Source Link

Caching PHP pages, Varnish, nginx, other?

I have a web application running on a low end box (1gb RAM), serving a mixture of static and dynamic (php) pages. These PHP pages are querying a MYSQL database which does not change often at all - once a week?.

I am looking to do a fair amount of caching to keep everything nice and speedy. I have pages that although are php, the information rarely changes (Getting a list of items that might change once every few monthly?). A couple of pages may be listing up to 400 records.

I have Varnish, nginx, PHP-FPM, APC, MYSQL installed. I 'think' I have everything set up correctly. Pages are being served, and I have hits showing up in Varnish... Brill! However, because of the nature of the website, I am not sure it is as optimised as it could be.

A recent search has suggested a number of things that may help with my php pages:

  • nginx FastCGI caching
  • memcached
  • MYSQL Query Caching

An example: A fresh PHP page, where it is listing quite a few (200+) records: 2 seconds After a refresh, 1.5(ish) seconds. edit: Am I being unrealistic to expect this page to be cached somewhere along the line and be supplied much quicker after it has been visited?

What would be my best option? One or all of the above?