【问题标题】:What could cause local APC to be slower than remote Memcached?什么可能导致本地 APC 比远程 Memcached 慢?
【发布时间】:2012-01-24 21:03:18
【问题描述】:

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

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

【问题讨论】:

  • 您可能希望包含您的 APC 配置和获取代码
  • 如果每次都未命中,那么它总是比缓存慢。

标签: php memcached apc


【解决方案1】:

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

相关链接:
APC vs Custom Mmap extension
http://2bits.com/articles/importance-tuning-apc-sites-high-number-drupal-modules.html

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2010-10-16
    • 1970-01-01
    • 2013-07-26
    • 2016-06-06
    • 2019-12-22
    • 2021-07-02
    • 2011-08-26
    相关资源
    最近更新 更多