Zend Opcache for PHP 5.6 increases timing?

cmpe

Active member
Hey all,

I put xenforo into debug mode so that I can see the timing, memory, and db queries shown on the footer. Then I enabled and disabled opcache to see if there are any differences.

I differences I see are:
  • ~50% increase in timing
  • ~50% decrease in memory

Without opcache:
Timing:
0.0997 seconds
Memory:
9.601 MB
DB Queries:
12

With opcache:
Timing:
0.1539 seconds
Memory:
4.872 MB
DB Queries:
12

These numbers are average. If I load the page again and again, the numbers remain about the same so I believe these differences are a direct impact of opcache being turned on and off.

Based on what I'm reading, the opcache should be storing the compiled bytecode into memory so I actually expected memory usage to increase and timing to decrease.

Now I'm wondering if these differences should be expected and considered to be "normal" or if opcache needs to be tweaked.

Thanks!
 
I can't attest to the difference of the processing time, but I can tell you in my personal experience opcache, opcache has lowered my pageload time substantially.

As to ram, I expect lower ram usage with opcache on.
Converting php to bytecode takes memory, and then that bytecode needs to be stored for the duration of the operation, which the initial memory used for byte code conversion isn't released immediately either, so it's stored in duplicate.

If you have opcache configured correctly, every process will end up using the same opcache, so the difference will become magnitudes larger, the more concurrent processing going on.
 
I can't attest to the difference of the processing time, but I can tell you in my personal experience opcache, opcache has lowered my pageload time substantially.
Did you use some type of script to collect this as a metric or was it just noticeable? At this point, I'm just trying to better understand the advantage of using opcache and seeing if there is a way for me to quantify the benefits. I'm not even convinced using debug mode is a good way to do it so wanted to get some better ideas.

@cmpe Have you enabled "Fetch public templates as files" under XenForo's performance tab?

That feature needs an opcode cache and does make a difference.
Ooh, I didn't know about this option so I had to check. It was actually enabled. Turning that on or off doesn't seem to impact the timing/memory numbers much.
 
Did you use some type of script to collect this as a metric or was it just noticeable? At this point, I'm just trying to better understand the advantage of using opcache and seeing if there is a way for me to quantify the benefits. I'm not even convinced using debug mode is a good way to do it so wanted to get some better ideas.

I had chrome open with developer console, and pressed f5 several times.

Admittingly, I didn't actually do this for xenforo. I have a wordpress/xenforo site, and I tested wordpress with and without.

I've also tried apache bench against wordpress.

ab -c 100 -n 100000

Opcache on, wordpress could handle 5x as much traffic

I use a single consolidated opcache for wp and xenforo, so I can't really separate the data.

Opcache becomes increasingly more important with more traffic
With one page view, it'll do very little

I have a feeling most of the time you spend generating a page is actually from database calls
 
Back
Top Bottom