[wp-trac] [WordPress Trac] #33276: redundant wp_using_ext_object_cache check in get/set_transient
WordPress Trac
noreply at wordpress.org
Wed Aug 5 13:11:45 UTC 2015
#33276: redundant wp_using_ext_object_cache check in get/set_transient
--------------------------+-----------------------------
Reporter: shmulikk | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Cache API | Version: 4.2.3
Severity: normal | Keywords:
Focuses: performance |
--------------------------+-----------------------------
Hello,
That's my first WP bug report.
I'm using external memcached plugin.
I'm testing WP for stability and abusing the system while shutting down
different components.
I've found a stability issue when using external object caching plugin,
not specifically in the external plugin(s) but in WP core.
If you look at the following methods you see there's a check for whether
an external object caching plugin exist and if there is - it short circuit
to directly use it.
get_transient line 602:
https://developer.wordpress.org/reference/functions/get_transient/
set_transient line 667:
https://developer.wordpress.org/reference/functions/set_transient/
This check is redundant because if you look at the execution route of when
such external plugin doesn't exist - it first try to utilize
wp_cache_set/get as part of the get/set_option or wp_load_alloptions
functions anyway.
Now on top of that being redundant it also causes stability and
performance issues in case where the external plugin fails to work with
the persistent cache for some reason (i.e. memcached is down). If we
remove this short circuit / redundant check - we gain a fallback mechanism
to the options table. So at least we get the original WP behavior instead
of to a broken state.
Performance tests I've made on the application without these checks
resulted with same performance and stability of the WP core even when
external persistent cache is unhealthy. I couldn't see any regression in
application functionality to either core or 3rd party plugins we're using.
Best,
Shmuel.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/33276>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list