PHP APC模块,正常运行时间非常短

时间:2013-08-30 19:50:52

标签: php apache fastcgi apc opcode

我启用了APC模块并检查了apc.php实用程序。似乎正常运行时间很短。我刷了很多次,最多看了1分钟。看起来缓存不起作用。我怎么解决这个问题?或者你建议使用另一个opcache? (我更喜欢APC,因为CakePHP支持它)

我检查过并找到了question,但在这种情况下使用了litespeed。我不使用litespeed。此question没有接受的答案。一些类似的question

我的系统:
PHP 5.4.18
Centos 6.3
APC 3.1.13 PHP Server API:CGI / FastCGI
服务器:Plesk 11.5

phpinfo是这样的:

APC Support enabled
Version 3.1.13
APC Debugging   Disabled
MMAP Support    Enabled
MMAP File Mask  no value
Locking type    pthread read/write Locks
Serialization Support   php
Revision    $Revision: 327136 $
Build Date  Aug 8 2013 12:42:01

Directive   
apc.cache_by_default    On  
apc.canonicalize            On
apc.coredump_unmap          Off 
apc.enable_cli              Off 
apc.enabled                 On  
apc.file_md5                Off 
apc.file_update_protection  2
apc.filters                 no value 
apc.gc_ttl                  3600     
apc.include_once_override   Off  
apc.lazy_classes            Off  
apc.lazy_functions          Off  
apc.max_file_size           1M   
apc.mmap_file_mask          no value     
apc.num_files_hint          1000     
apc.preload_path            no value       
apc.report_autofilter       Off  
apc.rfc1867                 Off  
apc.rfc1867_freq            0    
apc.rfc1867_name            APC_UPLOAD_PROGRESS  
apc.rfc1867_prefix          upload_  
apc.rfc1867_ttl             3600     
apc.serializer              default  
apc.shm_segments            1    
apc.shm_size                32M  
apc.shm_strings_buffer      4M   
apc.slam_defense            On   
apc.stat                    On  
apc.stat_ctime              Off  
apc.ttl                     0    
apc.use_request_time        On   
apc.user_entries_hint       4096     
apc.user_ttl                0    
apc.write_lock              On  

1 个答案:

答案 0 :(得分:-1)

原因是mod_fcgid模块。当您使用fcgid时,它会频繁生成新的PHP进程。因此,相同的PHP过程不会持续太长时间。它会在一段时间后消失。

所以缓存是按进程进行的。如果你有5个PHP进程,你有5个不同的缓存。每个进程都使用自己的缓存。因此,使用modd_fgid + APC或任何其他操作码/ opcache不是最佳选择。但它仍然有助于提高性能。

相关问题