Make WordPress Core

Opened 5 weeks ago

Last modified 9 days ago

#64854 new enhancement

Site Health: opcache full: need a Recommended Improvement notice.

Reported by: olliejones's profile OllieJones Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: trunk
Component: Site Health Keywords: has-patch
Focuses: performance, php-compatibility Cc:

Description (last modified by SergeyBiryukov)

Please see #63697.

I've been doing some perf analysis and noticed this: every site I look at has the OPCache running at 100%. It seems WordPress has outgrown the OPcache, even on simple sites. Blowing it out and churning it is not good for site performance (obviously).

I respectfully suggest the Site Health test suite add a "Recommended improvement" item when it detects a full opcache or full interned strings buffer.

Here's a draft of code to do that. https://github.com/OllieJones/sqlite-object-cache/blob/35b64c333032322d188a7467d2d2c3758a1aebea/includes/lib/class-sqlite-object-cache-opcache.php

Attached is what my draft looks like in the Site Health panel.

Attachments (3)

opcache-health-check.png (29.9 KB) - added by OllieJones 5 weeks ago.
Screenshot of sample Recommended Improvement
opcache-health-check-passed.png (8.4 KB) - added by OllieJones 5 weeks ago.
Here's what my prototype looks like when the opcode size checks pass.
opcache-health-check-i-only.png (98.3 KB) - added by OllieJones 5 weeks ago.
Here's the prototype when only the interned strings buffer is saturated. These configuration settings are BOTH performance-critical and impossibly geeked-out.

Download all attachments as: .zip

Change History (10)

@OllieJones
5 weeks ago

Screenshot of sample Recommended Improvement

#1 @johnjamesjacoby
5 weeks ago

I think this is a good idea and worth doing, but needs careful thresholds so Site Health does not become a drama llama. It's like the second half of #63697, but I'd like signal-quality over alarm-volume.

I like it because:

  • WordPress now exposes opcache info in Site Health so surfacing “enabled but saturated” is the natural next step
  • PHP exposes the bits needed to make this determination via opcache_get_status() (including cache state and interned-strings usage) and the opcache config docs explicitly describe how opcache.memory_consumption, opcache.interned_strings_buffer, and opcache.max_accelerated_files work
  • If the cache or interned strings pool is pegged, the site is leaving performance on the table and may churn more than it should; the PHP docs’ recommended defaults are pretty thin and WordPress can easily be wider than those

“100% full” may be too blunt by itself? A full'ish opcache is not automatically unhealthy:

  • cache_full / restart pressure
  • interned strings free memory near zero
  • key exhaustion via max_accelerated_files
  • perhaps wasted-memory pressure, if relevant

Besides conservative thresholds, I would like to see separate handling for:

  • opcode memory full
  • interned strings full
  • script/key table exhaustion

My opinion on the actual UX; something like:

  • “Opcode cache is enabled, but its memory appears saturated.”
  • “Interned strings buffer is exhausted or nearly exhausted.”
  • “Ask your host or server admin about increasing opcache.memory_consumption, opcache.interned_strings_buffer, or opcache.max_accelerated_files.”

#2 @johnjamesjacoby
5 weeks ago

Or... if we want to double down on recommended values, we should also add them to the Requirements page.

#3 @westonruter
5 weeks ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to Future Release

#4 follow-up: @ozgursar
5 weeks ago

Would adding a recommendation about the revalidate_freq make sense here?

Usually this is set to a very low value by default and increasing it helps with performance gains.

For example 0 checks on every request but increasing it to 10 checks for file changes every 10 seconds.

#5 in reply to: ↑ 4 @siliconforks
5 weeks ago

Replying to ozgursar:

Would adding a recommendation about the revalidate_freq make sense here?

Usually this is set to a very low value by default and increasing it helps with performance gains.

For example 0 checks on every request but increasing it to 10 checks for file changes every 10 seconds.

I would hesitate to recommend that users increase that setting because that can cause issues when updating files. (Either getting stale code, or worse, a mixture of old and new code causing strange bugs.) That is really something for advanced users only who are comfortable debugging and troubleshooting things.

See also #60397.

@OllieJones
5 weeks ago

Here's what my prototype looks like when the opcode size checks pass.

@OllieJones
5 weeks ago

Here's the prototype when only the interned strings buffer is saturated. These configuration settings are BOTH performance-critical and impossibly geeked-out.

#6 @SergeyBiryukov
5 weeks ago

  • Description modified (diff)

This ticket was mentioned in PR #11546 on WordPress/wordpress-develop by @sukhendu2002.


9 days ago
#7

  • Keywords has-patch added; needs-patch removed

Trac ticket: https://core.trac.wordpress.org/ticket/64854

## Use of AI Tools

Note: See TracTickets for help on using tickets.