Because running the website (albeit with fewer Unicorns) + performing a build at the same time is costly in memory?
I tried this out on my server (3 VCPU, 4GB):
Online:
2.21 before upgrade → 1.7 as it frees up memory → 3.5 peak during build (GBs)
Swap also went up ~200MB to peak ~800MB
Command line (not apples to apples as just after the above)
1.7 before upgrade → drops to ~250MB! → climbs and climbs to peak 3.25 during assets compilation, but generally much lower.
Swap usage was very low during almost the entire process.
Caveat: all figures observed in htop so may be inaccurate, probably best to graph it.
I was surprised how “peaky” offline rebuilds were. Assets precompile definitely uses a lot of memory - perhaps more the more VCPUs you have as it might do some of that in parallel?
I was also suprised how little difference the peak was in my case, though swap usage was significantly lower and generally, memory use was much lower for an offline rebuild, remaining in the 100’s of MB during 95% of the process, whereas an online upgrade was minimum 1.7GB.