-1

How do you do deployment PHP applications with enabled OpCache? My situation:

  • I have web server with PHP 7.4 and enabled OpCache.
  • Server is common virtual 4vCPU + 8GB RAM.
  • I use tool Deployer - finished with switch symlink.
  • Deployment is many times on day. Usually I deploy 5-10x times small changes.
  • Before deploy I have load 3-4.
  • After deploy I run opcache_reset (curl for http request) and load is >10. Response time is too high.

I understand how Opcache save caches to shared memory in PHP-FPM. But what is the correct solution for deployment without high-load and full availability?

grogsy
  • 99
  • 2
  • 1
    See: https://serverfault.com/q/959520. It probably is not necessary to use opcache_reset. Problems may be caused by processes that switch user. – Gerrit Nov 07 '22 at 13:40
  • I tried it. It is so better. But what if I get to limit `opcache.memory_consumption`? I think it will does hard reset opcache automaticaly. Is save increase configuration? – grogsy Nov 07 '22 at 17:19
  • 1
    I think opcache does a hard reset when you reach the max wasted percentage. However when you periodically recycle your PHP processes this should not become an issue. Running processes should be recycled anyway,when you change symlinks because they can have open handles to files that are no longer valid to be used. – Gerrit Nov 08 '22 at 09:08

1 Answers1

0

Thanks for the answer and link above.

Current solution is:

  • Do not call opcache_reset after deploy.
  • Set bigger value for option opcache.memory_consumption.
  • I do opcache_reset in night as cron job.

The reason for night cron job is high CPU usage while overflow cache and OpCache automaticaly call reset cache.

Vaibhav Panmand
  • 1,038
  • 7
  • 17
grogsy
  • 99
  • 2