Make WordPress Core

Opened 10 years ago

Last modified 6 weeks ago

#32452 assigned defect (bug)

Cache optimizations

Reported by: relevad's profile Relevad Owned by: pbearne's profile pbearne
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.1
Component: Cache API Keywords: has-patch
Focuses: performance Cc:

Description

Hi,

I've recently been making some custom modifications to wordpress core that reduce the resource load on our object-caching system.
I cannot see any drawbacks to these modifications, but I have to defer to the wp-core development team on this one and therefore assume I've missed something.
I want to know if there is anything I overlooked while making these modifications.
If there are no drawbacks, then perhaps the changes could be rolled into wp-core officially (and then I won't have svn showing files as modified all the time)

Explanation: (broken down into sections)
1) I noticed a huge amount of 'extra' queries to the object-cache.
Many of them originating from calls to wp_load_alloptions()
I believe with my modifications wp_load_alloptions() only needs to be called in one place instead of many, and that is within the definition of the object-cache itself.

2) I've also reduced redundant queries by changing the assumption that a key doesn't exist to a key does exist. Check the cache for the key first instead of checking the 'negative' cache for the key first.

3) Some minor fixes in options.php




All file changes (from svn diff) available at this link:
http://pastebin.com/5vPGCCt7

Attachments (1)

5vPGCCt7.diff (11.7 KB) - added by dd32 10 years ago.
pastebin link in diff uploaded form (paths corrected)

Download all attachments as: .zip

Change History (6)

@dd32
10 years ago

pastebin link in diff uploaded form (paths corrected)

#1 @Relevad
10 years ago

Just noticed I left some debug code in the wp-includes/cache.php

the error_log() calls are obviously not required.

#2 @wonderboymusic
9 years ago

  • Keywords alloptions added
  • Type changed from feature request to defect (bug)

#3 @desrosj
2 months ago

  • Focuses performance added
  • Keywords alloptions removed
  • Milestone set to Awaiting Review

The attached patch will definitely need to be refreshed. Also, there has been a focus on performance lately, so this may not be an issue anymore.

Tagging with the performance focus so the performance team can have a look.

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


6 weeks ago
#4

  • Keywords has-patch added

Integrate wp_load_alloptions() into the cache initialization process to preload options. Handle 'alloptions' as a special case in wp_cache_add to ensure efficient caching and retrieval. This change minimizes redundant database queries for option retrieval, improving performance.

#5 @pbearne
6 weeks ago

  • Owner set to pbearne
  • Status changed from new to assigned

I have started to refresh this code.

This assumes that caching working

It loads the alloption into separate cache keys as part of the cache start

I am not he code yet works

does the cache always load in WP?

Note: See TracTickets for help on using tickets.