1. Home
  2. Dobsie
  3. Using Dobsie
  4. OPcache Profiling

OPcache Profiling

What OPcache is

OPcache is PHP’s built-in bytecode cache. When PHP processes a .php file, it compiles the source code into bytecode (a set of instructions the PHP engine can execute directly). Without OPcache, this compilation happens on every single page request — even though the PHP files haven’t changed. With OPcache enabled, the compiled bytecode is stored in memory and reused on subsequent requests.

The difference is significant. On a typical WordPress site, OPcache can reduce page load times by 30-70% because PHP skips the compilation step entirely for cached files.

What Dobsie checks

The Server Health tab in the profiler (Tools > Dobsie > Server Health) checks your OPcache configuration and reports on three things:

OPcache status

Whether OPcache is enabled and running. You’ll see one of:

  • Enabled — OPcache is active and caching bytecode. This is what you want.
  • Disabled — OPcache is not running. Your site is recompiling PHP on every request.
  • Not installed — The OPcache extension isn’t available on your server.

If OPcache is disabled or missing, this is flagged as a recommendation in the Overview tab. It’s one of the single biggest performance improvements you can make.

Memory usage

OPcache has a memory pool for storing compiled bytecode. Dobsie shows:

  • Used memory — how much of the OPcache memory pool is currently in use
  • Free memory — how much is still available
  • Wasted memory — memory that’s been invalidated but not yet reclaimed (this happens when files change and old bytecode is replaced)

If used memory is close to 100% and free memory is near zero, your OPcache pool is full. New scripts can’t be cached, which means some of your PHP files are still being compiled on every request. You’d want to increase opcache.memory_consumption in your PHP configuration.

Hit rate

The hit rate tells you what percentage of PHP file requests are being served from cache vs being compiled fresh:

  • 98-100% — excellent, almost everything is cached
  • 90-97% — good, but some files are being recompiled
  • Below 90% — poor, check your OPcache memory and settings

A low hit rate usually means one of two things: OPcache ran out of memory (see above), or opcache.max_accelerated_files is set too low for the number of PHP files on your site.

Common OPcache issues

OPcache is disabled

This is the most common issue on shared hosting. Some hosts disable OPcache by default, or don’t include it. If Dobsie reports OPcache as disabled:

  1. Check with your host — many shared hosts can enable it on request
  2. If you manage your own server, add opcache.enable=1 to your php.ini
  3. If you’re on managed WordPress hosting (WP Engine, Kinsta, Cloudways, etc.), OPcache is almost always enabled. If Dobsie says otherwise, contact their support.

OPcache memory is full

WordPress with 30+ plugins can easily have 2,000+ PHP files. The default OPcache memory of 128MB is usually enough, but large sites might need more.

Signs of a full OPcache:

  • Hit rate dropping below 95%
  • Free memory: 0 MB in Dobsie’s Server Health
  • Wasted memory keeps growing

Fix: Increase opcache.memory_consumption in php.ini. 256MB is a comfortable setting for most WordPress sites with many plugins.

Files not being cached after changes

If you’ve updated a plugin or edited a PHP file but the changes aren’t showing up, OPcache might be serving the old cached version. This is controlled by opcache.revalidate_freq — how often OPcache checks if a file has changed.

On production sites, this is usually set to 60 seconds or more for performance. During development, set it to 0 so changes take effect immediately.

Most managed WordPress hosts handle cache invalidation automatically when you update plugins or themes.

Recommended OPcache settings

These settings work well for most WordPress sites. If you have access to your php.ini or php.d/ configuration:

  • opcache.enable=1 — turn it on
  • opcache.memory_consumption=256 — 256MB memory pool
  • opcache.max_accelerated_files=10000 — cache up to 10,000 files
  • opcache.revalidate_freq=60 — check for file changes every 60 seconds
  • opcache.validate_timestamps=1 — actually check for changes (set to 0 only if you clear cache manually after deploys)

If you can’t edit php.ini (common on shared hosting), your host may have a control panel option for OPcache settings, or you can ask their support team.

OPcache and other caching

OPcache is different from other types of WordPress caching:

  • OPcache — caches compiled PHP bytecode in memory. Handled by PHP itself.
  • Object cache (Redis, Memcached) — caches database query results in memory. Reduces database load.
  • Page cache (WP Super Cache, W3 Total Cache) — caches the full HTML output of pages. Serves cached HTML to visitors without running PHP at all.

These three layers complement each other. OPcache makes PHP faster when it does run. Object cache reduces database queries. Page cache avoids running PHP entirely for cached pages. For the best performance, you want all three.

Dobsie checks for all of these in the Server Health tab so you can see which layers you have in place.

How can we help?