0

Should I enable OpCache in production? Any benchmark for php 7.0? Is there any benchmark that tells how much a Laravel application on a PHP 7.0 server can benefit from enabling and tuning opcache? It would also be nice to share your experience.

4
  • 1
    You should definitely enable opcache. I remember that WordPress has something like 8x smaller response time with opcache. Difference may be less pronounced for Laravel, but will still be huge. Commented Jun 12, 2016 at 20:13
  • I mistakingly thought it was disabled! But it is not for web. I also enabled it for cli for laravel jobs and crones. Is that OK too? Commented Jun 15, 2016 at 11:51
  • CLI wont benefit from OpCache as it always throws it away at the end of the script anyway. Commented Jul 8, 2016 at 11:28
  • 1
    FYI, it's now possible to use opcache for CLI. The cache can be written to disk. stackoverflow.com/questions/25044817/… Commented Sep 28, 2018 at 16:16

1 Answer 1

2

I have opcache enabled in production and have had no problems. There is undoubtedly a performance improvement so I would recommend enabling it.

I'm not a Laravel developer, however there's a bunch of performance comparisons out there. For example, a quick Google search reveals https://kinsta.com/blog/the-definitive-php-7-final-version-hhvm-benchmark/ which has a Laravel (with and without opcache) benchmark as well as Laravel based products (OctoberCMS, PyroCMS, Flarum).

While there's no definitive benchmark, it's worth looking at https://www.techempower.com/benchmarks/#section=data-r12&hw=peak&test=fortune&l=13yebk for PHP framework benchmarks. opcache is not specifically tested, but HHVM is which should give you a rough idea of performance improvement.

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

1 Comment

The stuff on kinsta.com is not correct! I already check with my framework and Wordpress ! youtube.com/watch?v=cN-PqerQ9DI

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.