APC不caching许多文件

我有一个Drupal网站,在Linode的VPS上运行PHP 5.2.10和APC 3.1.6。

它永远不会caching大约25个文件,并且几乎不使用任何可用内存。 Drupal有数百个PHP文件。 我有另一台服务器,APC似乎很好,确实caching了数百个文件。 该网站唯一的区别是它运行Ubuntu 10.04和PHP 5.3.2。 configuration设置是相同的。

什么可能是错的? 我将从下面的apc.php粘贴configuration。 这是后Drupal的多个部分。

APC Version 3.1.6 PHP Version 5.2.10-2ubuntu6.5 APC Host xxx.example.com Server Software Apache/2.2.12 (Ubuntu) Shared Memory 1 Segment(s) with 32.0 MBytes (mmap memory, pthread mutex locking) Start Time 2010/12/02 11:32:17 Uptime 3 minutes File Upload Support 1 File Cache Information Cached Files 21 ( 1.4 MBytes) Hits 169 Misses 21 Request Rate (hits, misses) 1.00 cache requests/second Hit Rate 0.89 cache requests/second Miss Rate 0.11 cache requests/second Insert Rate 0.17 cache requests/second Cache full count 0 User Cache Information Cached Variables 0 ( 0.0 Bytes) Hits 0 Misses 0 Request Rate (hits, misses) 0.00 cache requests/second Hit Rate 0.00 cache requests/second Miss Rate 0.00 cache requests/second Insert Rate 0.00 cache requests/second Cache full count 0 Runtime Settings apc.cache_by_default 1 apc.canonicalize 1 apc.coredump_unmap 0 apc.enable_cli 0 apc.enabled 1 apc.file_md5 0 apc.file_update_protection 2 apc.filters apc.gc_ttl 3600 apc.include_once_override 0 apc.lazy_classes 0 apc.lazy_functions 0 apc.max_file_size 1M apc.mmap_file_mask apc.num_files_hint 1000 apc.preload_path apc.report_autofilter 0 apc.rfc1867 0 apc.rfc1867_freq 0 apc.rfc1867_name APC_UPLOAD_PROGRESS apc.rfc1867_prefix upload_ apc.rfc1867_ttl 3600 apc.shm_segments 1 apc.shm_size 32M apc.slam_defense 1 apc.stat 1 apc.stat_ctime 0 apc.ttl 0 apc.use_request_time 1 apc.user_entries_hint 4096 apc.user_ttl 0 apc.write_lock 1 

增加configuration文件中的这两个值:apc.shm_segments 1 apc.shm_size 32M

你需要重启php / apache才能看到效果。

这可能是apc的一个bug。 或者它可能在networking服务器上,但这发生在使用Drupal的其他人。

http://groups.drupal.org/node/113594#comment-368674

给APC更多的内存从1Gb开始,并检查它是如何使用的。 APC必须拥有比实际使用更多的内存。

APC将不会caching大于1M的文件,您可以安全地将此选项增加到20M apc.max_file_size 1M

切勿使用0 apc.ttl = 7200 apc.user_ttl = 7200的TTL

你可以检查我的回答这个问题(倒数第二) https://stackoverflow.com/questions/3723316/warning-require-once-function-require-once-unable-to-allocate-memory-for-p