What could cause local APC to be slower than remote Memcached?

若如初见. 提交于 2020-01-04 05:35:10

问题


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

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?

Edit: 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

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


回答1:


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.

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



来源:https://stackoverflow.com/questions/8583253/what-could-cause-local-apc-to-be-slower-than-remote-memcached

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!