【问题标题】:PHP APC module, very low uptimePHP APC 模块,正常运行时间非常短
【发布时间】:2013-09-03 15:10:09
【问题描述】:

我启用了 APC 模块并检查了 apc.php 实用程序。正常运行时间似乎非常低。我刷新了很多次,我看到最多 1 分钟。似乎缓存不起作用。我该如何解决这个问题?还是您建议使用另一个 opcache ? (我更喜欢 APC,因为 CakePHP 支持它)

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

我的系统:
PHP 5.4.18
Centos 6.3
APC 3.1.13 PHP 服务器 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  

【问题讨论】:

    标签: php apache fastcgi apc opcode


    【解决方案1】:

    原因是mod_fcgid 模块。当您使用 fcgid 时,它会频繁生成新的 PHP 进程。所以同样的 PHP 进程不会活太久。它会在一段时间后死亡。

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-10-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多