[wp-trac] [WordPress Trac] #40351: Term post re-counts scale poorly, are common and difficult to avoid

WordPress Trac noreply at wordpress.org
Fri Mar 13 00:31:54 UTC 2020


#40351: Term post re-counts scale poorly, are common and difficult to avoid
------------------------------------------+------------------------------
 Reporter:  mattoperry                    |       Owner:  (none)
     Type:  enhancement                   |      Status:  new
 Priority:  normal                        |   Milestone:  Awaiting Review
Component:  Taxonomy                      |     Version:  4.8
 Severity:  normal                        |  Resolution:
 Keywords:  needs-patch needs-unit-tests  |     Focuses:  performance
------------------------------------------+------------------------------

Comment (by peterwilsoncc):

 [attachment:"cpu-usage.png"] shows the room for improvement on large
 sites.

 Work (a large news organisation) enabled light-weight term counting on
 March 7 due to CPU alerts firing daily during the
 `wp_scheduled_auto_draft_delete` and `wp_scheduled_delete` cron jobs. CPU
 use immediately dropped 30%+ during those tasks.

 Note: for various reasons such as the number of users, we generate ''a
 lot'' of auto-drafts so these results aren't typical on a standard
 WordPress site, this is very specific to a high usage site.

 At the very least, I think we can introduce some pre-flight hooks to the
 term counting functions to allow customisation of the database query. I'd
 suggest preflight filters for `wp_update_term_count_now()`,
 `_update_post_term_count()` and `_update_generic_term_count()`.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/40351#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list