【问题标题】:Can't tell if APC is "working"... Hits/Misses + varnish无法判断 APC 是否“工作”...命中/未命中 + 清漆
【发布时间】:2013-10-25 03:58:50
【问题描述】:

好的,所以我安装了 nginx、php-fpm、apc 和 varnish,虽然它们在没有错误的情况下“正常工作”,但我不确定如何判断它们是否/正在缓存什么......

现在,我在 CentOS 6 上安装了 APC:

yum --enablerepo=remi,remi-php55 install php-pecl-apc

所以这可能就是为什么它根本不工作(如果不工作),或者至少看起来它不能与 APC 附带的 apc.php 一起工作(就像我一样安装它,我没有得到它,我必须从包中提取它然后上传它)但我看到的是:

1 次命中 0 次失误

System Cache Entries 没有显示 Script Filename,没有 Hits,Size 656,令人惊讶的是它最后一次访问和创建时间是:1970/01/01 00:00:00,然后最后修改时间是今天下午 2 点?

每个目录资源没有目录,35 个文件名,0 个命中,421264 个大小

现在,我还有一个 apc2.php,它只是:<?php print_r(apc_cache_info()); ?>

这表明:

Array
(
[nslots] => 4099
[ttl] => 7200
[nhits] => 1208
[nmisses] => 233
[ninserts] => 53
[nentries] => 35
[nexpunges] => 0
[stime] => 1382663331
[mem_size] => 421264
[file_upload_progress] => 1
[memory_type] => mmap
[cache_list] => Array

然后列出一堆WP/W3TC相关的项目

那里的差异有什么特别的原因吗?

最后一个问题,是否有(在 varnish 之外简单地插入标头)来判断 varnish 是否真的在缓存任何东西?

【问题讨论】:

    标签: nginx apc varnish php


    【解决方案1】:

    要判断 Varnish 是否正在缓存以及它是如何进行的,我喜欢执行以下操作:

    varnishstat -f cache_hit,cache_miss,cache_hitpass,n_gzip,n_gunzip,n_lru_nuked,n_expired
    

    这是我喜欢看的主要数据。会实时更新。

    输出将是这样的:

        0+19:43:40 Hitrate ratio:       10       19       19
    Hitrate avg:     0.8497   0.8673   0.8673
    
           35304         0.00         0.50 cache_hit - Cache hits
            1026         0.00         0.01 cache_hitpass - Cache hits for pass
            4721         0.00         0.07 cache_miss - Cache misses
            2215          .            .   n_expired - N expired objects
              86         0.00         0.00 n_gzip - Gzip operations
            3549         0.00         0.05 n_gunzip - Gunzip operations
    

    您的 APC 问题似乎很奇怪。我只能告诉你确保你已经启用它。

    http://php.net/manual/pt_BR/apc.configuration.php http://www.php.net/manual/pt_BR/apc.configuration.php#ini.apc.enabled

    另外,尝试在 Stackoverflow 上填写您的个​​人资料,设置用户名等。 如果大多数人认为提出更改的用户不会接受或参与问题,他们不会费心回答问题。

    最好的问候。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-09-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-11-26
      • 1970-01-01
      • 2014-02-23
      • 1970-01-01
      相关资源
      最近更新 更多