Make WordPress Core

Opened 4 months ago

Closed 4 months ago

Last modified 3 weeks ago

#63719 closed enhancement (fixed)

Use site transients for caching RSS Feeds

Reported by: peterwilsoncc's profile peterwilsoncc Owned by: peterwilsoncc's profile peterwilsoncc
Milestone: 6.9 Priority: normal
Severity: normal Version:
Component: Feeds Keywords: has-patch
Focuses: multisite, performance Cc:

Description

WP_Feed_Cache_Transient currently uses standard transients for the storing of feed caches, ie get_transient() and set_transient().

The performance of feed caches on Multisite Installs of WordPress could be improved by switching this to using site transients, ie get_site_transient() and set_site_transient().

This will allow sub-sites of a Multisite install to share the cache of RSS feeds included on the site.

Change History (8)

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


4 months ago
#1

  • Keywords has-patch added

Modifies the RSS cache to use site transients so the feeds are cached globally on multisite installs.

No tests until the ticket fixing feed caching is merged.

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

#2 @peterwilsoncc
4 months ago

#63718 was marked as a duplicate.

#3 @peterwilsoncc
4 months ago

  • Type changed from defect (bug) to enhancement

#4 @peterwilsoncc
4 months ago

  • Milestone changed from Awaiting Review to 6.9

With @spacedmonkey's approval on the linked pull request, I'm moving this to the 6.9 milestone.

Changes in the PR:

  • *_transient() calls replaced with *_site_transient()
  • Class level @since tag noting the use of the global cache on MS.

#5 follow-up: @rollybueno
4 months ago

Switching to site transients for WP_Feed_Cache_Transient makes a lot of sense, especially on multisite where every subsite currently ends up fetching the same feeds separately, so sharing the cache network-wide should definitely cut down on duplicate requests and improve performance.

Q> Would it be possible to add explicit unit tests to confirm the transient keys are stored in wp_options for single site and in wp_sitemeta for multisite?

#6 in reply to: ↑ 5 @peterwilsoncc
4 months ago

Replying to rollybueno:

Q> Would it be possible to add explicit unit tests to confirm the transient keys are stored in wp_options for single site and in wp_sitemeta for multisite?

I think that would be helpful in tests/phpunit/tests/option/siteTransient.php but I would do so against the Test tool and unit test improvements ticket (#63167 for WP 6.9) rather than this one. That will allow for a simpler and more focused test suite than using the transients created by fetching feeds. I can assist a review if you want to give it a go.

#7 @peterwilsoncc
4 months ago

  • Owner set to peterwilsoncc
  • Resolution set to fixed
  • Status changed from new to closed

In 60524:

Feeds: Cache RSS feeds in global transients.

Moves the caching of RSS feeds requested via fetch_feed() from single site transients (get|set|delete_transient()) to global transients (get|set|delete_site_transient()).

On multisite installs of WordPress, this replaces per site caching with the global multisite cache to allow a single cache to be shared between all sites. This reduces the amount of data stored in the database and improves performance of feeds when multiple sites are ingesting the same URL.

Props rollybueno, spacedmonkey, peterwilsoncc.
Fixes #63719.

This ticket was mentioned in Slack in #core by westonruter. View the logs.


3 weeks ago

Note: See TracTickets for help on using tickets.