Best OPcache settings: A Good Starting Point (2023)

When configuring your server settings for best performance, you have to look at every option available. Typically, OPcache should already be enabled along with its default settings.

When I do any optimizations, I like to do some searching around the web to see what others are doing. I’ll find a few different results and compare.. then I start my own configuration testing. And by the way, I’m using OPcache for WordPress sites.

OPcache really doesn’t need any extreme configuration differences like you might deal with when optimizing something like InnoDB. It’s really only a few settings that need adjusted. Here’s a good starting point I came up with. You can even go higher based on your server capabilities.

[opcache]
; My custom Opcache settings

opcache.memory_consumption=192
opcache.interned_strings_buffer=16
opcache.max_accelerated_files=15000
opcache.validate_timestamps=0
opcache.revalidate_freq=0

Remember to keep an eye on changelogs. Over time default settings will be changed and sometimes removed completely. You can view default settings here along with changes that occur, https://www.php.net/manual/en/opcache.configuration.php.

I found this link to be a good reference that you may want to bookmark, https://gist.github.com/rohankhudedev/1a9c0a3c7fb375f295f9fc11aeb116fe.

Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments