Page MenuHomePhabricator

Add rate limiting to the jobqueue vidoscalers to prevent overloads
Closed, ResolvedPublic

Description

We recently had an incident where a large number (65) of 4k videos where uploaded to commons, using the process to upload large files which resulted in very high load on the jobqueue processes. Most hosts were overloaded with ffmpeg processes.

Can we investigate adding some generic rate limiting to the video scaling infrastructure so that if it is overloaded it either queues or denies new uploads

Event Timeline

jbond triaged this task as Medium priority.
Legoktm renamed this task from Add rate limiting to the jobqueue vidoscalers to Add rate limiting to the jobqueue vidoscalers to prevent overloads.Apr 1 2021, 8:53 PM
Legoktm updated the task description. (Show Details)
akosiaris lowered the priority of this task from Medium to Low.Apr 2 2021, 11:10 AM
akosiaris subscribed.

For what is worth, we already have rate limiting on the edge that this essentially piggy backs on for protection, plus the fact that 3rd parties can't really upload that fast large videos to commons. The incident mentioned was actually triggered because it happened from inside the perimeter by the large file upload process which we control and can react to quickly (as we did in this case). For that reason I am gonna set this as low priority.

The interesting question this one is what do we rate limit on? We probably don't want to rate limit the jobqueue unconditionally anyway, which was the (sole) client for this. Furthermore, some arbitrary request based limit wouldn't stop this, the issue was with the load that specific requests created. So, maybe perhaps based on content/destination of the request?

Joe subscribed.

Given videoscaling happens asynchronously on the jobqueue, this would amount to just reducing the concurrency of the video transcode jobs, which was also suggested by me as a solution for T306860.

In fact, we might just do this for both.

Change 901602 had a related patch set uploaded (by Giuseppe Lavagetto; author: Giuseppe Lavagetto):

[operations/deployment-charts@master] changeprop-jobqueue: reduce concurrency of video transcoding

https://gerrit.wikimedia.org/r/901602

Change 901602 merged by jenkins-bot:

[operations/deployment-charts@master] changeprop-jobqueue: reduce concurrency of video transcoding

https://gerrit.wikimedia.org/r/901602

Joe moved this task from Doing to Done on the SRE-Sprint-Week-Sustainability-March2023 board.