Posted by flocondetoile on May 7, 2013 at 11:49am
Hello,
I use Nginx and his native caching system (Perusio's configuration) to quickly serve web pages to anonymous visitors.
I wonder if it makes sense to use memcached, along with the nginx cache system ? Or rather, instead of the Nginx cache ?
The only advantage I can see is to store the cached pages in RAM rather than on the HDD.
Have you ever used memcached with / along nginx caching system ? And for what use cases ?
thanks
Comments
different layers of caching
Nginx's [micro]caching is more along the lines of an alternative to a varnish cache layer atop Apache. Memcached, on the other hand, is a cache layer for the database and would serve to lighten the load on MySQL (or whatever db engine you might have).
Generally, more well-implemented caching layers are a good thing, as they will help you scale. It's not always a panacea -- if something is quirky or misbehaving it can be tricky to troubleshoot. But follow best practices and I think you'll find that implementing both Nginx caching and Memcached on your system will be a win/win scenario.
I will be experimenting this week with something very similar: Drupal-with-nginx on AWS backed by ElastiCache and RDS, aka cloud MySQL.
speed,
--
matt j. sorenson, g.d.o., d.o.
Like Matt
said. You can have as many layers of caching as you want. You can use on the Drupal side:
DB cache.
Memcache cache.
Redis cache.
I would try using redis and eventually falling back to memcache if it's nto stable enough.
Depending on the specifics of
Depending on the specifics of your site and server configuration, I'd also recommend looking at APC, which will likely provide a significant boost in response times. Add to that memcache and nginx microcaching and you'll be doing well.
I better understand the value
I better understand the value of using memcached (or redis) at the same time as the Nginx cache. In my case I use the nginx cache for a longer duration than the microcaching (1-2 days), because most visits are anonymous. I use selective purge (modules cache expiration and purge) pages when content is updated or added.
But when visitors bypass the nginx cache and then hit Drupal cache, so instead of calling the database cache they hit the cache stored by memcached in RAM.
For authenticated users, the improvement must be significant, since the blocks, views, panels cached (except page caching themselves etc.). are read from memory and not from the database. Am I right ?
Thanks