Project

General

Profile

Actions

Bug #8930

closed

Throttle Jetpack batch routines

Added by Boone Gorges over 6 years ago. Updated about 6 years ago.

Status:
Resolved
Priority name:
Normal
Assignee:
Category name:
WordPress (misc)
Target version:
Start date:
2017-11-22
Due date:
% Done:

0%

Estimated time:
Deployment actions:

Description

Previously: #6731.

I've been doing some logging after recent performance problems, and have found a couple different kinds of runaway requests involving Jetpack.

1. Jetpack takes a really long time to generate a sitemap, especially when the site has lots of images. This happens a lot on historyprogram, for instance.
2. Jetpack indexes site posts to wordpress.com on certain setups, which does not play nicely with plugins that generate huge amounts of posts. The cases I've seen are related to the use of wp-rss-multi-importer on gcenglish.


Related issues

Related to CUNY Academic Commons - Bug #6731: Out-of-control queries on production serverResolvedBoone Gorges2016-11-14

Actions
Related to CUNY Academic Commons - Bug #6737: wp-rss-multi-importer cron job requires huge number of DB queriesResolvedBoone Gorges2016-11-15

Actions
Related to CUNY Academic Commons - Bug #10051: Tweets and email notifications are not being generated from posts on OpenAtCUNY siteResolvedRaymond Hoh2018-07-24

Actions
Actions #1

Updated by Boone Gorges over 6 years ago

To mitigate the first item, I've decreased Jetpack's sitemap batch sizes. The following lines are now in cac-env-config.php (untracked):

// Limit size of Jetpack sitemap generation routine.                             
define( 'JP_SITEMAP_UPDATE_SIZE', 10 );
define( 'JP_SITEMAP_BATCH_SIZE', 100 );
define( 'JP_SITEMAP_INTERVAL', 24 * 60 * 60 );
Actions #2

Updated by Boone Gorges over 6 years ago

  • Related to Bug #6731: Out-of-control queries on production server added
Actions #3

Updated by Boone Gorges over 6 years ago

  • Related to Bug #6737: wp-rss-multi-importer cron job requires huge number of DB queries added
Actions #4

Updated by Boone Gorges over 6 years ago

Interaction with wordpress-seo is causing a large number of queries on gcenglish. I've opened an upstream ticket to track the issue https://github.com/Yoast/wordpress-seo/issues/8323

Actions #5

Updated by Boone Gorges over 6 years ago

Jetpack is supposed to be skipping the syncing of rssmi_feed_item post type, but is not for some reason. I've set up a debugging tool to figure this out.

Actions #6

Updated by Boone Gorges over 6 years ago

  • Target version changed from 1.12.3 to 1.13

The debugging tool suggests that Jetpack is not, in fact, indexing the items. Moving to a future release for further debugging.

Actions #7

Updated by Boone Gorges about 6 years ago

  • Assignee set to Boone Gorges

Maybe not totally related, but Jetpack is causing problems with the introduction of a new cron system. See #8987.

It's possible that Jetpack is the resource hog for cron jobs that's at the root of recent performance problems. As an experiment, I've temporarily disabled Jetpack's cron-based syncing system: https://wordpress.org/support/topic/jetpack-sync-killing-the-db-2/ I'll check back in a day to see if there's a difference.

Actions #8

Updated by Boone Gorges about 6 years ago

So, about a day later, and there have been no outages on the Commons. This is not conclusive - sometimes we go several days without - but it suggests we may be onto something.

Ray, I'm adding you to this ticket because I'm going to leave my disabling code in place, and I'm going away. See wp-content/mu-plugins/bbg-toolbox.php, at the very top. To be honest, I'm not 100% sure what it means when we disable sync-via-cron. The wording makes me think that Jetpack continues to sync, but only at the time that new content is created. (For example, the sync-modules-posts.php file hooks to transition_post_status.) So, maybe this is something we can leave turned off indefinitely. But if there are reports from Commons users that wordpress.com integration is broken in some way, it might be necessary to reenable cron-sync. In either case, let's monitor over the next week or two.

Actions #9

Updated by Boone Gorges about 6 years ago

  • Status changed from New to Resolved
  • Target version changed from 1.13 to 1.12.13

A brief update that, based on my observations, outages have been much less frequent since this change was implemented. I can recall maybe half a dozen instances in the last month, rather than the several-per-week that was typical of the last few months. At the same time, I haven't heard reports that Jetpack/wordpress.com connections have been adversely affected. As such, I'm going to go ahead and add my off-toggle to the codebase: https://github.com/cuny-academic-commons/cac/commit/702a173e00d35a539d46b031deea3307d1641af1 This has been deployed immediately as a hotfix. This should make moot the question of "throttling", since we're now throttling it down to zero.

Actions #10

Updated by Matt Gold about 6 years ago

sweet. Thank you, Boone.

Actions #11

Updated by Raymond Hoh almost 6 years ago

  • Related to Bug #10051: Tweets and email notifications are not being generated from posts on OpenAtCUNY site added
Actions

Also available in: Atom PDF