Make WordPress Core

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#35323 closed defect (bug) (fixed)

Reschedule the Background Update cron for improved performance.

Reported by: dd32's profile dd32 Owned by: dd32's profile dd32
Milestone: 4.4.1 Priority: normal
Severity: normal Version: 3.7
Component: Upgrade/Install Keywords:
Focuses: Cc:


When we first added Background Updates to WordPress in 3.7, we added a twice daily update check at approximately 7am "local time" (according to the blogs settings).

What we didn't realise at the time, was that many sites have their timezone settings set to UTC even though the site isn't "based" in the UTC timezone (See #28988).
What this has effectively caused is that gets a large surge of API requests around 7am and 7pm UTC daily which lasts approximately 2 hours, during which the API requests are over twice the rate outside of that time.

The 7am/7pm time slot is really not anything special anymore, the vast majority of WordPress background updates now happen within an hour of our release time through good planning.

We should attempt to reduce the sudden surge of API requests to by re-scheduling the 7am/7pm daily job to a random minute during the day instead, it'll help with future API growth and ensure that a more consistent API response time is provided.
We could either only re-schedule it if it falls within that time slot, or as it's not guaranteed to run at that time anyway, reset every schedule to a random minute instead.

This needs a patch, but I'd suggest it be backported all the way down to 3.7 and implemented as a once-off upgrade routine.

FYI @nacin

Attachments (1)

35323.diff (4.5 KB) - added by dd32 8 years ago.

Download all attachments as: .zip

Change History (6)

8 years ago

#1 @dd32
8 years ago

In 36180:

Background Updates: Remove the 7am/7pm background update check. This check was made redundant by [28129] as background updates are now run after a version check takes place.

See #27772, #35323.

#2 @dd32
8 years ago

After looking closer, it was realised that we no longer need this extra schedule.

It's only purpose in life was to run the 7am/7pm background updates, and those are now kicked off by the core version check in WordPress 3.9+, that schedule was already at a random second of the day.

#3 @dd32
8 years ago

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

In 36184:

Background Updates: Remove the 7am/7pm background update check.

This changeset is a more basic version of [36180], clearing the extra now redundant schedule.
As the functionality for this was introduced in 3.9, [28129] has been backported to 3.7/3.8, allowing the API TTL to be respected by those versions.

See #27772.
Fixes #35323.

#4 @dd32
8 years ago

  • Keywords needs-patch removed
  • Milestone changed from 4.5 to 4.4.1

I apologise for the late 4.4.1 commit, the performance aspects make it worthwhile though.

I've tested the minimal patch on all versions, with the 3.7/3.8 changes getting extra attention.

The > time() + HOUR_IN_SECONDS is to allow the Background Update retry schedules (which are scheduled for time() + HOUR_IN_SECONDS) to left intact.

Last edited 8 years ago by dd32 (previous) (diff)

#5 @DrewAPicture
8 years ago

In 36825:

Docs: Improve documentation for upgrade_450(), introduced in [36180].

See #27772, #35323. See #35986.

Note: See TracTickets for help on using tickets.