Page MenuHomePhabricator

Increase OAbot kubernetes quotas
Closed, ResolvedPublic

Description

I'm trying to automate runs of User:OAbot on the English Wikipedia, by reducing the variables I need to control manually. Ideally we'd manage to run it weekly, so that the users can avoid needless manual work and still have their contributions in good shape in short order.

One attempt was to run on all the potential target pages, which basically means parsing 4M articles (T272006). That takes about 8-9 days with 1 CPU, running almost always at maximum CPU usage. But ok, we can do every two weeks.

However, this is less nice: the latest run apparently failed, being killed for OOM:

$ kubectl get pods
NAME                            READY   STATUS      RESTARTS   AGE
oabot-5d788d549b-m5gp7          1/1     Running     0          53d
oabotrefresh-1610763420-h52wv   0/1     Completed   0          17d
oabotrefresh-1611368220-gdrlb   1/1     Running     0          44h
oabotrefresh-1611368220-thqn8   0/1     OOMKilled   0          8d

We could chase some performance gains but ultimately this is a rather resource-intensive task and I usually run it with multiple CPUs and up to 8 GB reserved RAM on the grid. (Although it only rarely used as much.) Can we double the quota (both CPU and RAM)?

The current quota:

$ kubectl describe resourcequotas
Name:                   tool-oabot
Namespace:              tool-oabot
Resource                Used    Hard
--------                ----    ----
configmaps              1       10
limits.cpu              2       2
limits.memory           4608Mi  8Gi
persistentvolumeclaims  0       3
pods                    2       4
replicationcontrollers  0       1
requests.cpu            1500m   2
requests.memory         4352Mi  6Gi
secrets                 1       10
services                1       1
services.nodeports      0       0

For some context on what we're doing:
https://en.wikipedia.org/wiki/Wikipedia:OABOT
https://blog.okfn.org/2017/10/26/how-wikimedia-helped-authors-make-over-3000-articles-green-open-access-via-dissemin/

Event Timeline

bd808 moved this task from Inbox to Approved on the Toolforge (Quota-requests) board.
bd808 added subscribers: Bstorm, bd808.

Approved in 2021-02-03 WMCS team meeting. @Bstorm will also provide some information on tricks for scheduling large pods in a comment here.

I just checked your pod definitions and see that you are setting requests equal to limits, which is great. The scheduler will block off the requests on the node, so if you know it is going to be a heavy RAM user, you should set request to what you actually expect it to use in an average run.

I think you need a limitrange increase more than namespace quota, which is not reflected in the document (updating that now) so that each container can have more than 4GB of RAM. I see your web service is using default resources, so you would likely still have 7.5 GB for the namespace to consume per job. The OOM killer is affected by the resource limits rather than the resource quotas. The quotas will block the launch of a pod that requests more than the total the namespace is allowed. On CPU, I could do the same thing of increasing your limitrange to 2 per container, and then if you launch requesting 1.75, you'd be within quota, or I could expand that to 3 so you could use a full 2 for the job containers.

So! All that said, my current recommendation would be to expand the limitrange for your namespace to 8Gi RAM and the resourcequota to something like 9Gi to account for the web service as well? Does that seem reasonable.

The equivalent command (now in the doc) is:

tools.oabot@tools-sgebastion-08:~$ kubectl describe limitranges
Name:       tool-oabot
Namespace:  tool-oabot
Type        Resource  Min    Max  Default Request  Default Limit  Max Limit/Request Ratio
----        --------  ---    ---  ---------------  -------------  -----------------------
Container   cpu       50m    1    150m             500m           -
Container   memory    100Mi  4Gi  256Mi            512Mi          -
Bstorm changed the task status from Open to Stalled.EditedFeb 3 2021, 5:43 PM
Bstorm triaged this task as Medium priority.

Setting to stalled since, while this is effectively approved, we need to be using the right method to get you what you need.

Does that seem reasonable.

Sure, sounds good, let's try. Thank you!

I tried surfing closer to the hard limits at the beginning, but I got annoying errors like (P13646):

Warning  FailedCreate  7m14s  job-controller  Error creating: pods "test-pqt5d" is forbidden: [maximum cpu usage per Container is 1, but limit is 2, maximum memory usage per Container is 4Gi, but limit is 7680Mi]

So that's indeed the limitranges.

Bstorm changed the task status from Stalled to Open.Feb 3 2021, 10:35 PM
Bstorm claimed this task.

Ok, so I've bumped the resource quota a bit to accomodate the new limitrange:

Name:                   tool-oabot
Namespace:              tool-oabot
Resource                Used    Hard
--------                ----    ----
configmaps              1       10
limits.cpu              2       3
limits.memory           4608Mi  9Gi
persistentvolumeclaims  0       3
pods                    2       4
replicationcontrollers  0       1
requests.cpu            1500m   2
requests.memory         4352Mi  9Gi
secrets                 1       10
services                1       1
services.nodeports      0       0

And I bumped up the limit range to a level that might work.

Name:       tool-oabot
Namespace:  tool-oabot
Type        Resource  Min    Max  Default Request  Default Limit  Max Limit/Request Ratio
----        --------  ---    ---  ---------------  -------------  -----------------------
Container   cpu       50m    2    150m             500m           -
Container   memory    100Mi  8Gi  256Mi            512Mi          -

You should now be able to launch a pod with a CPU request of 2 and a RAM of 8 GB.

kubectl create job --from=cronjob/oabotrefresh test succeeded after I doubled the CPU and RAM request, so I think it's all fine. I'll reopen if needed. Thanks!