为什么Memcached不能使用vBulletin?

我有Memcachedconfiguration和设置与vBulletin 4.1.5在Gentoo Linux 32位Linode VPS上工作。 Memcached启动, includes/config.phpconfiguration为使用memcache,并且该站点确实可以正常加载和运行; 不过,Memcached似乎并没有caching,或者至lesscaching得很好。 所有的服务,Apache,MySQL和Memcached运行在同一台服务器上:

 # for service in apache2 memcached mysql; do service $service status; done * status: started * status: started * status: started 

请参阅下面的psmem显示低内存使用情况的输出:

  $ psmem | grep memcached 928.0 KB + 27.0 KB = 955.0 KB memcached 

下面是DataStoreconfiguration的includes/config.php部分:

 $ grep DATASTORE config.php -A16 // ****** DATASTORE CACHE CONFIGURATION ***** // Here you can configure different methods for caching datastore items. // vB_Datastore_Filecache - for using a cache file //$config['Datastore']['class'] = 'vB_Datastore_Filecache'; // vB_Datastore_Memcached - for using a Memcache server // It is also necessary to specify the hostname or IP address and the port the server is listening on $config['Datastore']['class'] = 'vB_Datastore_Memcached'; $i = 0; // First Server $i++; $config['Misc']['memcacheserver'][$i] = '127.0.0.1'; $config['Misc']['memcacheport'][$i] = 11211; $config['Misc']['memcachepersistent'][$i] = true; $config['Misc']['memcacheweight'][$i] = 1; $config['Misc']['memcachetimeout'][$i] = 1; $config['Misc']['memcacheretry_interval'][$i] = 15; 

/etc/php/apache2-php5.3/ext-active/memcache.inimemcache.iniconfiguration,它是/etc/php/apache2-php5.3/ext/memcache.inisymlink

 /etc/php/apache2-php5.3/ext-active $ cat memcache.ini extension=memcache.so memcache.allow_failover=false memcache.max_failover_attempts=20 memcache.chunk_size=32768 memcache.default_port=11211 memcache.hash_strategy=consistent memcache.hash_function=crc32 memcache.redundancy=1 memcache.session_redundancy=2 memcache.protocol=ascii 

最后,编写一个Perl脚本的输出(不是我),允许将数据传递给Cacti用于绘图目的,但也可以手动使用:

 $ perl memcached.pl localhost total_items:898515 get_hits:20219203 uptime:3376080 cmd_get:23939667 time:1312170243 bytes:97280 curr_connections:35 connection_structures:55 bytes_written:102512934173 limit_maxbytes:67108864 cmd_set:1986754 curr_items:35 rusage_user:120.625662 get_misses:3720464 rusage_system:624.975989 bytes_read:3518914943 total_connections:28161 

这最后的输出使它看起来像是caching,但是如前所述,它甚至不使用1 MB的存储。

我错过了什么? 还有什么我应该检查? 如果Memcached或相关的PHP扩展configuration没有任何问题,那么它必须是一个vBulletin问题,在这个问题中,它不会以它应该的方式主动使用caching。

想法? 有问题吗? 我一直试图让这个工作好几个月。

同时运行并比较Perl脚本和echo "stats" | nc -w 1 localhost 11211 echo "stats" | nc -w 1 localhost 11211 ,build议:

 $ perl memcached.pl localhost | cut -d" " -f1 ; awk -F"STAT " '/total_items/{print $2}' <(echo "stats" | nc -w 1 localhost 11211) total_items:923792 total_items 923792 

find解决办法 – memcached正在监听0.0.0.0; 在更改为127.0.0.1并重新启动后,内存使用情况立即显着增加,并继续攀升:

 $ ps u -C memcached USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND 103 27999 0.0 2.3 62196 18288 ? Ssl 16:30 0:00 /usr/bin/memcached -d -p 11211 -U 11211 -l 127.0.0.1 -m 64 -c 1024 

考虑到一个简单的memcached进程使用超过1MB的内存,我会说psmem正在告诉psmem 。 而且,考虑到脚本的顶部明确指出,这是看内存使用情况,而不是内存使用情况,我想说,你认为正在进行的不是。 另一方面,目前caching中有35个项目,你不是在那里撕毁的东西。

至于为什么vBulletin不使用它,我不知道; 到目前为止,我已经成功地避免了这种情况,我非常乐意保持这种状态。 有更好的方法来validation它是否工作到目前为止你所使用的( tcpdump -i lo port 11211strace -etrace=network立即想起来),但是你可能不得不利用他们的大力支持如果它实际上没有做你想要的。