2

我正在使用 Magento 1.6 和 APC 3.1.9。

我有 99% 的失误,只有 0.4% 的命中率。

Magento local.xml 有这个条目

<config> <global> <cache> <backend>apc</backend> <prefix>MAGE_</prefix> </cache> ...... .....

根据 Magento 论坛,我已经调整了 apc.ini 中的大部分参数。

当我跑步时,

php -r 'phpinfo();' | grep 'apc'

输出是

additional .ini files parsed => /etc/php.d/apc.ini,
apc
apc.cache_by_default => On => On
apc.canonicalize => On => On
apc.coredump_unmap => Off => Off
apc.enable_cli => On => On
apc.enabled => On => On
apc.file_md5 => Off => Off
apc.file_update_protection => 2 => 2
apc.filters => no value => no value
apc.gc_ttl => 3600 => 3600
apc.include_once_override => Off => Off
apc.lazy_classes => Off => Off
apc.lazy_functions => Off => Off
apc.max_file_size => 20M => 20M
apc.mmap_file_mask => no value => no value
apc.num_files_hint => 10000 => 10000
apc.preload_path => no value => no value
apc.report_autofilter => Off => Off
apc.rfc1867 => Off => Off
apc.rfc1867_freq => 0 => 0
apc.rfc1867_name => APC_UPLOAD_PROGRESS => APC_UPLOAD_PROGRESS
apc.rfc1867_prefix => upload_ => upload_
apc.rfc1867_ttl => 3600 => 3600
apc.serializer => default => default
apc.shm_segments => 1 => 1
apc.shm_size => 1024M => 1024M
apc.slam_defense => On => On
apc.stat => On => On
apc.stat_ctime => Off => Off
apc.ttl => 0 => 0
apc.use_request_time => On => On
apc.user_entries_hint => 10000 => 10000
apc.user_ttl => 0 => 0
apc.write_lock => On => On

不确定如何调试此问题并解决 99% 缓存未命中问题。我错过了什么?

请帮忙。

4

1 回答 1

0

确保您rm -rf /var/www/var/cache/*在更改 local.xml 后执行了操作。

尝试优化您的 apc 缓存 http://blog.nexcess.net/2011/03/25/optimizing-apc-cache-settings-for-magento/

并确保您检查

APC 配置的附加建议:

  1. 关闭 apc.optimization(实验性且不稳定,可能会缓存用户会话信息,不应该缓存的无用项目,例如管理页面和登录站点页面)
  2. 关闭 apc.include_once_override
  3. 关闭 apc.slam_defense(可能导致对象被显示给用户的 PHP 警告替换)
  4. 设置 apc.user_ttl = 0(允许您的 php 脚本为查询和对象设置适当的超时)
  5. 为文件支持的 mmap 设置 apc.mmap_file_mask = /tmp/apc-yourusernamehere.XXXXXX;通过添加您的唯一字符串使文件掩码唯一;必须保留 XXXXXX(正好 6 个 X)以允许 APC 添加随机字符串或设置为 /dev/zero 用于匿名 mmap,如果您可以节省内存

来源http ://blog.magikcommerce.com/configuring-apc-cache-for-faster-magento/

于 2012-08-25T18:22:38.667 回答