什么可能导致本地 APC 比远程 Memcached 慢?

发布于 2024-12-22 02:48:38 字数 881 浏览 1 评论 0原文

我正在努力调整我的缓存,在进行基准测试时,我发现了一些让我感到困惑的东西。

从远程 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'); 完成的

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');

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

家住魔仙堡 2024-12-29 02:48:38

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

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

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文