Skip to:
Content

Opened 17 months ago

Closed 17 months ago

Last modified 3 weeks ago

#3163 closed enhancement (fixed)

Prime last active post IDs

Reported by: johnjamesjacoby Owned by:
Milestone: 2.6 Priority: high
Severity: normal Version: 2.0
Component: General - Performance Keywords: commit
Cc:

Description

I've identified a nifty (and relatively obvious) performance improvement.

When querying for forums, topics, or replies, the last-active post caches are never primed. This makes WordPress go out and query for each of them individually, maybe miss the cache, and do all of the work again for each individual cache miss.

Instead of all that, let's ask each already-cached post object what their last-active, last-topic, and last-reply IDs are, and prime them.

In my testing, this can result in embarrassingly huge performance improvements, sometimes cutting the number of database queries by 50% or more depending on the intersection of post types, widgets, etc...

Change History (5)

#1 @johnjamesjacoby
17 months ago

In 6698:

Common: prime last-active post caches.

This change introduces a performance tweak to bbp_has_topics(), bbp_has_forums(), and bbp_has_search(), pre-cache'ing the last-active post objects for what is known to be their imminent usage in the current template loops.

See #3163.

#2 @johnjamesjacoby
17 months ago

In 6700:

Common: also prime post author caches.

This change introduces another performance tweak to bbp_has_topics(), bbp_has_forums(), bbp_has_search(), and bbp_has_replies(), by pre-cache'ing the post author objects for what is known to be their imminent usage in the current template loops.

This change also renames the function & parameter introduced in r6698 to better fit existing naming conventions in WordPress.

See #3163.

#3 @johnjamesjacoby
17 months ago

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

Let's call this closed.

On a heavily trafficked forum with high cardinality and low intersection, I've seen forum index queries go from 120 to 46. We can deal with anything related to this in separate issues.

❤️🐝

#4 @johnjamesjacoby
17 months ago

In 6701:

Update docblock for bbp_update_post_family_caches(). See #3163.

#5 @johnjamesjacoby
3 weeks ago

Assigning all closed & unassigned tickets in the 2.6 milestone to myself.

Note: See TracTickets for help on using tickets.