2

I have enabled opcode caching in php, and it delivers savings in pageloads to the extent of 25%.

I use the excellent OpCache.php GUI tool, and my output is as below.

Keys output is as below. enter image description here

Hits output is as below. enter image description here

I am trying to understand some of the basic features in there.
1. What are cached keys and free keys ?
2. How do I reduce my misses ? I read somewhere that opcache_hit_rate should be above 99%. Is there a way to go about this fine tuning. I am currently at 91%
3. How is the visualization to be used ?

I am a beginner to this and would appreciate any help. Many thanks.

1
  • Generate a million more requests and don't update your scripts -> the hit rate will be ~99% (it's basic math isn't it?) Commented Aug 2, 2015 at 23:20

1 Answer 1

6
  1. For technical reasons, the PHP opcode cache stores values in a fixed set of "bins", referred to here as "cache keys". The ratio of cache keys to free keys is a rough indicator of how full the cache is.

  2. Your miss rate is high right now because you haven't used your application very much -- by my guess, I'd say there have been around eleven requests to your application since your web server started up. This is normal; the first few requests will always result in misses, because the files involved haven't been loaded into the cache yet.

  3. Generally speaking: ignore it. Unless your application is performing poorly or misbehaving in a way that you believe is related to the cache, you don't need to look at this.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for the clear answer. How did you come to the 11 requests conclusion ? It is in the correct ballpark range. Want to understand how that was estimated. Also, is the output of the tool over a period of time ? Say 24 hours or is it from the beginning of time that opcache was enabled. Thanks
The opcache stats are mostly cumulative since server startup. Your screenshot shows 7160 hits on 653 cached scripts; 7160 ÷ 653 ≈ 11.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.