Enable the PHP opcache and disable revalidation #149
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description:
I noticed that the PHP opcache is not installed or enabled. The opcache takes compiled PHP files and stores them in memory, improving performance and reducing disk IO at a small memory cost. Even in development it's a good practice to have the opcache enabled.
Since we are running in docker, there is also no point in checking files with stat calls on each request to see if they have changed. Instead, users should generally pull or rebuild the image.
Benefits of this PR and context:
I noticed this on my server because surprisingly php-fpm had the biggest IO reads out of all processes. This is because I have an uptime app checking Heimdall every 60 seconds, causing the entire Laravel app to be re-read and compiled.
How Has This Been Tested?
I changed my local to build off of this PR instead of pulling the upstream image. As well, I confirmed the opcache was enabled by dropping a phpinfo.php file in the app and verifying that the opcache extension was showing hits.
I have only tested on amd64, and not ARM.