# Opcache makes no difference at all

**URL:** <https://forum.virtualmin.com/t/opcache-makes-no-difference-at-all/111077>\
**Category:** Help! (Home for newbies)\
**Created:** [June 15, 2021, 5:50pm UTC](https://forum.virtualmin.com/t/opcache-makes-no-difference-at-all/111077 "2021-06-15T17:50:01Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ttorok](https://cdn.forum.virtualmin.com/letter_avatar_proxy/v4/letter/t/ce73a5/32.png) [@ttorok](https://forum.virtualmin.com/u/ttorok)\
**Post date:** [June 15, 2021, 5:50pm UTC](https://forum.virtualmin.com/t/opcache-makes-no-difference-at-all/111077/1 "2021-06-15T17:50:02Z")

</div>

Ubuntu 20.04  
Virtualmin version 6.16

I made some tests to compare the execution time of php scripts with and without opcache. I ran a php script that calculates the the prime numbers 1-500,000. In both cases regardless opcache was enabled or not, the execution time ranged 0.9-1.05 seconds.

I monitored the status of opcache with this script:  
[GitHub - amnuts/opcache-gui: A clean, effective and responsive interface for Zend OPcache](https://github.com/amnuts/opcache-gui) - version 3.2.1

When opcache was enabled the status clealy showed as ‘cached’:  
/home/xxx/public\_html/prime2.php hits: 4, memory: 2.92KB, last used: Tue Jun 15 17:32:08 2021

When opcache was disabled,l added to the blacklist  
and showed up in the ‘ignored file locations’:  
/home/xxx/public\_html/prime.php

Every time when enabled / disabled opcache, made a system reboot as well.  
So it apparaently makes no difference if opcash is on or off…

Did anybody experience the same?

---

<div class="post-metadata">

**Author:** ![Joe](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/joe/32/9_2.png) [@Joe](https://forum.virtualmin.com/u/Joe)\
**Post date:** [June 15, 2021, 6:30pm UTC](https://forum.virtualmin.com/t/opcache-makes-no-difference-at-all/111077/2 "2021-06-15T18:30:39Z")

</div>

I think I would be more surprised if there _was_ a difference. A tiny app running under php-fpm or mod\_fcgi is unlikely to benefit notably from the opcache.

---

<div class="post-metadata">

**Author:** ![ttorok](https://cdn.forum.virtualmin.com/letter_avatar_proxy/v4/letter/t/ce73a5/32.png) [@ttorok](https://forum.virtualmin.com/u/ttorok)\
**Post date:** [June 15, 2021, 11:14pm UTC](https://forum.virtualmin.com/t/opcache-makes-no-difference-at-all/111077/3 "2021-06-15T23:14:24Z")

</div>

Yes that point makes sense. A single instance of one script makes no difference.  
I installed ApacheJmeter. I was running 300 threads at once.  
The result was even more surprising:  
With opcache the average execution time was found to be 18.3 sec  
Without opcache the average execution time was only 17.6 sec.

Is there any logical explanation for this?

---

<div class="post-metadata">

**Author:** ![Joe](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/joe/32/9_2.png) [@Joe](https://forum.virtualmin.com/u/Joe)\
**Post date:** [June 15, 2021, 11:28pm UTC](https://forum.virtualmin.com/t/opcache-makes-no-difference-at-all/111077/4 "2021-06-15T23:28:21Z")

</div>

It’s the same explanation I already gave. You didn’t change the thing that I mentioned would make a difference (tiny app). But, I think you’re expecting a much bigger difference than you’ll actually see, even in the ideal circumstance for using opcache. Everything is _already_ cached at several points in the system. FPM or fcgid are already going to run very fast, relatively speaking. PHP 7 also dramatically improved performance in the general case, including parsing and compiling (making the improvement from op caching less pronounced).

---

<div class="post-metadata">

**Author:** ![ttorok](https://cdn.forum.virtualmin.com/letter_avatar_proxy/v4/letter/t/ce73a5/32.png) [@ttorok](https://forum.virtualmin.com/u/ttorok)\
**Post date:** [June 15, 2021, 11:36pm UTC](https://forum.virtualmin.com/t/opcache-makes-no-difference-at-all/111077/5 "2021-06-15T23:36:59Z")

</div>

You mean even if a file is on Opcache ‘blacklist’ , it can still be cashed somewhere else in the OS?

---

<div class="post-metadata">

**Author:** ![Joe](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/joe/32/9_2.png) [@Joe](https://forum.virtualmin.com/u/Joe)\
**Post date:** [June 16, 2021, 12:09am UTC](https://forum.virtualmin.com/t/opcache-makes-no-difference-at-all/111077/6 "2021-06-16T00:09:45Z")

</div>

It’s caches all the way down, friend.

---

<div class="post-metadata">

**Author:** ![ttorok](https://cdn.forum.virtualmin.com/letter_avatar_proxy/v4/letter/t/ce73a5/32.png) [@ttorok](https://forum.virtualmin.com/u/ttorok)\
**Post date:** [June 16, 2021, 1:03am UTC](https://forum.virtualmin.com/t/opcache-makes-no-difference-at-all/111077/7 "2021-06-16T01:03:17Z")

</div>

I see.  
Thanks

---

<div class="post-metadata">

**Author:** ![system](https://cdn.forum.virtualmin.com/uploads/default/original/2X/c/cd96d761e326db4b2bef94886a639109bd7a8e76.svg) [@system](https://forum.virtualmin.com/u/system)\
**Post date:** [August 15, 2021, 1:03am UTC](https://forum.virtualmin.com/t/opcache-makes-no-difference-at-all/111077/8 "2021-08-15T01:03:32Z")

</div>

Closed on August 15, 2021, 1:03am UTC

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
