我正在努力调整我的缓存并在进行基准测试时发现了一些让我感到困惑的事情。
从我的远程Memcached框(本地网络)中拔出一个密钥需要0.0008秒,而从我的本地APC缓存中拔出一个密钥需要0.0114秒。是的,它快了整整14倍。
对于本地缓存而言,这似乎非常慢......我应该在调整哪些设置以使其更有效?
编辑:根据要求,这是我在php.ini上的APC配置
[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');
完成的答案 0 :(得分:1)
充分利用你的记忆!尝试将apc.shm_size
提升到128mb - 这是一个简单的调整,可以大大提高性能。另外,请考虑更改apc.user_entries_hint
以符合您应用的要求 - 请参阅apc vs custom mmap extension。
Revelant links:
APC vs Custom Mmap extension
http://2bits.com/articles/importance-tuning-apc-sites-high-number-drupal-modules.html