Page MenuHomePhabricator

Investigate speed of spinning up legacy environments vs Catalyst environments
Closed, ResolvedPublic

Description

Currently provisioning a Catalyst demo environment takes ~5 minutes, while the legacy backend only takes ~1 min. We should take some measurements ourselves and see where the slow-down is.

  • confirm the times of legacy demo provision vs Catalyst provisioned demo
  • investigate the time to clone in Catalyst and why it might be slower than the ref clones that the legacy-patchdemo backend does
  • either make changes to improve time, or if it will be a much larger task, make a follow-on task

Event Timeline

thcipriani edited projects, added Catalyst (Kiwen); removed Catalyst.

I have looked into this matter and this is the data gathered:

PresetPatchdemo backendCatalyst backendRatio
Core21s2m 48s~8x
Minimal25 s3m 2s~7.28x
Wikimedia1m 53s6m 19s~3.35x

These presets were used to get a sense of the lower and upper limits when it comes to time taken with relation to extensions/skins/repos included (Minimal with 2 and Wikimedia with 79 respectively). The process was repeated a few times and consistently the results were around these same times. What was really interesting was that even when no extensions and skins were added (Core only option), there seems there is a baseline amount of time taken to spin up these wikis. Given this discovery, I looked into the Catalyst logs to see what steps in the process took the most time and compared their differences when different presets were selected .

PresetPre-logsCloning reposComposernpminstalling wiki
Core43 s22 s7s84 s12 s
Minimal26 s25 s8 s85 s19s
Wikimedia38 s108 s136 s86 s87 s

A few notable things - in the Wikimedia preset, "Running composer..." showed up 8 times vs once in both Minimal and Core selection.

From the above, npm seems to be consistently costly time wise and it seems for the other variables, the more included repositories the more time a step takes (note the core pre-log time is an anomaly). If we can somehow manage to shave down any of the times listed, we can get a lot closer to the non Catalyst backend times.

I trimmed down the logs in order to assess the above. Here are the edited files.

Note: For the data on Wikimedia preset, I lost the original logs so created another one and referenced those instead. I still believe the time recorded can give us a good idea of how long each step takes and can inform us where to try and optimize.

Additionally, I would like to note that for Catalyst, each extra extension/skin/module takes an extra 1-2 seconds on average and up to 6 seconds in the worst case scenario (Wikibase). There is also a fixed 20-25 seconds for cloning core.

I will be digging deeper into the logs for legacy patchdemo to get exact times for each step if possible and if not, will do my best to manually time and make more comparisons.

Data point: average creation times (in seconds) as of yesterday per backend, per preset

WikimediaMinimal
PatchDemo87.609756129.19148936
Catalyst291.2608696140.6410256

Details

This is the average for 500+ wikis. Creation time from the PatchDemo database.

select created, backend, json_value(repos, '$.preset'), timeToCreate from wikis where timeToCreate != 'NULL' order by created desc;

Then pulled that to a spreadsheet

Thanks for that, @thcipriani! With the changes done to speed up env checkouts using worktrees, we are seeing the following:

PresetCatalyst before worktreesCatalyst w/ worktrees
Core2m 48s2m 24s
Minimal3m 2s2m 44s
Wikimedia6m 19s4m 32s

Huge thanks to @jnuche for this, already quite the improvement!

We do have other opportunities to streamline even further. From talking to @jeena, that could be:

  1. Cacheing npm install / having it be part of the image itself - this takes up a lot of time currently and doesn't need to.
  2. Cache compose (?) / Doing something to make the composer a little faster especially with more repos (more repos increase the time taken in this step)

The above efforts and potentially more measures could help us get these times down even further.

EBomani updated the task description. (Show Details)

Follow up tasks created :
T386414: Configure cache sharing between containers.
T386413: Add npm and composer installs into Patch Demo's base image.