dongxue163536 2013-12-25 22:45
浏览 30

php-apc中未命中和命中之间的巨大差异

I just can't figure it out, where my configuration goes wrong, since I get so many misses and so few hits. And eventually that causes memory leaks.

See yourself. Notice that I'm using APCu rather than APC.

enter image description here

http://i.stack.imgur.com/3DPxo.png

Do you have any ideas of what I might be doing wrong, or what goes wrong?

Yes, I am aware of the following question and answer: APC Hits/Misses and configuration. Yet, after many tries of tweaking configuration, I can't still understand why so many misses.

I have a simple meta search app, where all the results from searches, are cached with APC. The following code, is a demonstration of how I process such data.

$dynamic_variable = "query_{$query}_page$this->page"; // This is just one case of many.

// Get Data from Cache
$cache_variable = "api1_{$dynamic_variable}_cached";
$result         = $this->cache->get($cache_variable);

if ( ! $result) {
    $result = .....
    $this->cache->save($cache_variable, $result, $this->cache_timeout);
}

return $result;

And just to mention it, the app is currently using CodeIgniter 2.1.4, and migrating to https://github.com/ellislab/codeigniter/tree/release/3.0.

  • 写回答

1条回答 默认 最新

  • dsgwoh7038 2013-12-25 23:21
    关注

    In the screenshot, the server is reporting that it has only been up for 8 minutes - that's hardly enough time to get a stable picture.

    Try checking the numbers after it has been handling a realistic volume of traffic.

    update

    Since posting the answer above the image was updated from this to this - yes, in the updated image the hit rate is abnormally low. The answer lies somewhere in your code or how people are using the site - not in APC.

    A slam defence of 1 doesn't make much sense.

    I suspect if you test this with a known set of the requests you'll find it will yeild a predictable hit rate. What are you storing? If you're using sessions, it's likely a fault in your code (e.g. calling session_start() after headers sent).

    评论

报告相同问题?

悬赏问题

  • ¥15 luckysheet
  • ¥15 ZABBIX6.0L连接数据库报错,如何解决?(操作系统-centos)
  • ¥15 找一位技术过硬的游戏pj程序员
  • ¥15 matlab生成电测深三层曲线模型代码
  • ¥50 随机森林与房贷信用风险模型
  • ¥50 buildozer打包kivy app失败
  • ¥30 在vs2022里运行python代码
  • ¥15 不同尺寸货物如何寻找合适的包装箱型谱
  • ¥15 求解 yolo算法问题
  • ¥15 虚拟机打包apk出现错误