如何在nginx+fastcgi上设置memcache [英] How to set up memcache on nginx+fastcgi

查看:29
本文介绍了如何在nginx+fastcgi上设置memcache的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 ubuntu 服务器上,我有一个使用 nginx+fastcgi 作为网络服务器并使用 xcache 的 drupal 站点.我对配置很满意,但试图设置 memcache 希望提高站点的速度,但我不知道该怎么做.

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 memcache hoping to boost the site's speed, but I am not sure how to do so.

安装memcached后,我在/etc/php5/cgi/php.ini中添加了extension=memcache.so,我看到memcache进程正在运行.

After installing memcached, i added extension=memcache.so to /etc/php5/cgi/php.ini and I see that memcache process is running.

然而,几个小时后,我看到的不是更好的性能,而是更高的服务器负载(平均 5,而不是通常的 2).所以我很感谢你提示设置内存缓存.(我知道我可以使用 nginx 作为 apache 的反向代理,并在 apache 上定义 memcache,但我特别热衷于以任何方式避免 apache).

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).

推荐答案

这里的游戏已经很晚了,但如果你只在一台服务器上,memcached 只会让你慢下来.使用 APC 查看本地缓存(或者,在您的情况下,使用 xcache 的本地缓存).我相信 Drupal 会有这些插件.我的猜测是您将 xcache 用于操作码缓存,但没有使用其内存缓存功能.

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.

任何类型的缓存都不是灵丹妙药.就像 Cyber​​Dem0n 提到的那样,你的应用程序必须足够聪明才能使用它:缓存这个,不缓存那个,从缓存中提取它等等."

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 很棒仅当您处理多个服务器并需要共享缓存时.如果您有一台服务器,那么您可以将对象从内存中取出(甚至文件系统,在大多数情况下比网络更快),因此您正在浪费时间在网络调用的开销上.

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).

这篇关于如何在nginx+fastcgi上设置memcache的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆