Page MenuHomePhabricator

Investigate the potential win running multiple npm installs at the same time
Closed, ResolvedPublicSpike

Description

In T303270 parallel npm install was investigated (and disabled for Quibble). I want to check running install in parallel actually helps. In other tests I've been running it seems that the disk speed has been one of the problems (T436173).

I want to test a couple of things:

  • How fast is it to run multiple npm ci installs before we start the tests? Can we run them all at the same time, or two by two?
  • Could we run the npm install when the tests runs? So during the current test, we prepare/install what's needed for the next test

I've did some tests on an non agent flavor and they wasn't positive: running install at the same time as the tests slowed down the test by 50% and batching the npm installs at startup made them so slow that there wouldn't be a win. However that wasn't exactly the agent machines setup, so let me rerun the same test on an agent that match the current setup.

Event Timeline

Restricted Application changed the subtype of this task from "Task" to "Spike". · View Herald TranscriptAug 28 2026, 2:14 PM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Could we run the npm install when the tests runs? So during the current test, we prepare/install what's needed for the next test

This is the path I tested in this spike. I created a test Jenkins agent (integration-agent-docker-9999) with the same setup as we have in CI to be able to make sure I get reliable metrics out of it. I tried running the change alone on the server and with two other jobs running (quibble-with-gated-extensions-selenium-php83) at the same time on the same machine. The other two jobs runned in a loop on the server trying to simulate full load. I wanted to see if the change would impact the performance of the tests. I also picked four runs from Jenkins as a reference (52638, 52640, 52648, 52651).

Results

jobs on agentvariantrunswallbrowser stagesavednpm install sumtest sum
real CIbaseline (Jenkins)4n/a444 (426-563)-160 (159-202)284 (266-360)
1 job runningbaseline5466 (457-479)427 (419-437)-155 (151-162)272 (268-276)
1 job runningprepare/install5336 (334-359)298 (295-311)128 s, 30 %214 (210-223)260 (256-267)
3 jobs runningbaseline21628 (596-668)583 (552-607)-203 (193-215)378 (344-401)
3 jobs runningprepare/install5459 (442-503)415 (396-441)167 s, 29 %371 (315-398)357 (342-368)

Summary

  • prepare/install cuts the browser stage by 128 s (30 %) with the job alone and by 167 s (29 %) with three jobs on the agent. The build itself by 130 s and 169 s.
  • The tests are not slower with a background install, in total or per project, in either scenario.
  • The background install takes longer (214 s against 155 s alone, 371 s against 203 s under load) because it runs with nice 19 next to 7 wdio instances per job. It still finishes before its tests are due except for a few short suites, which is the 40 to 60 s the stage keeps above the test sum.
  • I also did a test running 1 wdio test at a time (by mistake) not setting CI=true (wdio at one instance, tests 1.7x slower than production) and that gave the same saving in seconds: 128 s alone, 170 s under load.

Change #1335750 had a related patch set uploaded (by Phedenskog; author: Phedenskog):

[integration/quibble@master] Run the next npm install during the browser tests

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

Change #1337439 had a related patch set uploaded (by Phedenskog; author: Phedenskog):

[integration/config@master] jjb: Overlap npm install with the gated browser tests

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

Change #1335750 merged by jenkins-bot:

[integration/quibble@master] Run the next npm install during the browser tests

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

Change #1337439 merged by jenkins-bot:

[integration/config@master] jjb: Overlap npm install with the gated browser tests

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

Mentioned in SAL (#wikimedia-releng) [2026-09-09T09:42:15Z] <phedenskog> jjb: update quibble-with-gated-extensions-selenium-php83 to run npm install ahead of the browser tests T436376

I deployed this today. I can see that its faster but its hard to see yet how large the in is, probably smaller than I measured on the test agent. Let me check tomorrow when we have more data.

Peter moved this task from Finishing Touches to Done on the Test Platform (Arusha 30) board.

The job got about 135 seconds faster for median, almost a 25% change, and the p75 dropped by 150 seconds.

Is everything faster? No the actual npm install is slower (almost 50%), we run that with nice 19 now, so it got low prio, but that do not matter since that slowness is hidden behind the tests running.