How to set up memcache on nginx+fastcgi
On an ubuntu server, I have a drupal site which uses nginx+fastcgi as webserver and uses xcache. I am quite happy with the configuration but trying to set up m开发者_如何学Pythonemcache hoping to boost the site's speed, but I am not sure how to do so.
After installing memcached, i added extension=memcache.so to /etc/php5/cgi/php.ini and I see that memcache process is running.
However, after a few hours, instead of better performance I just see higher server load (average 5 instead of usual 2). So I appreciate your hint to set up memcache. (I know that I could use nginx as reverse proxy to apache, and define memcache on apache but I am particularly keen to avoid apache by any means).
Memcache is just key-value storage. It's useless, if your application doesn't know, how to use it.
By adding extension=memcache.so to php.ini, you are only enable memcache api in php.
After that, you must teach drupal, how to use memcache, to store some data in it. I don't realy know, how to configure drupal to use memcache, but i think, it's very possible, and may be vary easy. Just look to some configuration files of drupal.
Pretty late to the game here, but if you're only on one server, memcached is just going to slow you down. Look into caching locally with APC (or, in your case, xcache's local caching). I'm sure Drupal will have plugins for these. My guess is you're using xcache for an opcode cache, but not using its memory cache abilities.
Any type of caching is not a silver bullet. Like CyberDem0n mentioned, your application has to be smart enough to use it: "cache this, don't cache that, pull this from cache, etc etc."
Memcached is great only if you are dealing with multiple servers and need a shared cache. If you have one server, you are wasting time with the overhead of a network call when you can just get the object out of memory (or even filesystem, which is faster than network in most cases).
精彩评论