是什么导致本地APC比远程Memcached慢? [英] What could cause local APC to be slower than remote Memcached?

查看:64
本文介绍了是什么导致本地APC比远程Memcached慢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在努力调整缓存,并在进行基准测试时发现一些令人困惑的事情.

I am working on trying to tune my caches and in doing benchmarking I found something that is confusing the hell out of me.

从我的远程Memcached框(本地网络)中提取密钥需要0.0008秒,而从我的本地APC缓存中提取密钥却需要0.0114秒.是的,它快了整整14倍.

Pulling a key from my remote Memcached box (local network) is taking 0.0008 seconds whereas pulling a key from my local APC cache is taking 0.0114 seconds. Yes, it is a full 14x faster.

对于本地缓存而言,这似乎太慢了……我应该在调整哪些设置以使其更有效?

That seems awfully slow for a local cache... what settings should I be looking at tuning to make it more effective?

根据要求,这是我来自php.ini的APC配置

As requested, here is my APC config from php.ini

[APC]
;specifies the size for each shared memory segment will need adjustment for your environment.
apc.shm_size=8
;max amount of memory a script can occupy
apc.max_file_size=1M
apc.ttl=0
apc.gc_ttl=3600
; means we are always atomically editing the files
apc.file_update_protection=0
apc.enabled=1
apc.enable_cli=0
apc.cache_by_default=1
apc.include_once_override=0
apc.localcache=0
apc.localcache.size=512
apc.num_files_hint=1000
apc.report_autofilter=0
apc.rfc1867=0
apc.slam_defense=0
apc.stat=1
apc.stat_ctime=0
apc.ttl=7200
apc.user_entries_hint=4096
apc.user_ttl=7200
apc.write_lock=1

通过简单的apc_fetch('my_key');

The fetch is being done by a simple apc_fetch('my_key');

推荐答案

利用您的记忆!尝试将apc.shm_size增大到128mb-这是一个容易的调整,可以显着提高性能.另外,请考虑更改apc.user_entries_hint以满足您的应用要求-请参阅apc与自定义mmap扩展.

Take advantage of your memory! Try raising the apc.shm_size to 128mb - its an easy tweak that can improve performance substantially. Also, consider changing apc.user_entries_hint to fit your app's requirements - see apc vs custom mmap extension.

最新链接:
APC与自定义Mmap扩展
http://2bits.com/articles/Important-tuning-apc-sites-high-number-drupal-modules.html

Revelant links:
APC vs Custom Mmap extension
http://2bits.com/articles/importance-tuning-apc-sites-high-number-drupal-modules.html

这篇关于是什么导致本地APC比远程Memcached慢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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