Microcaching with Nginx

Zach Brown has a nice post up on how to set up microcaching with Nginx combined with Batcache to handle big spikes of traffic (or just to maximize efficiency and enable running a site on low resources). Zach explains that while Batcache is a great solution and performs very well, it still requires loading PHP and 1.12% of the WordPress core application on every page load if used alone. In order to conserve resources even more, Nginx can be used to serve full page caches. In order to avoid the issue of when to purge the Nginx cache, Zach simply limits the cache time to a maximum of five seconds, so a new cache is built very frequently, while at the same time, only twelve requests per minute can reach WordPress and Batcache, significantly reducing server load.

Zach notes that a common solution to this problem is to simply use Varnish. However, he plans to use SPDY at some point, which requires loading the entire site with SSL. Varnish will not do SSL termination, but Nginx will.

Be sure to read Zach's post for all the details, including the code required to set this up.

Similar Posts