Webpack 5 upgrade - investigate OOM errors
From initial investigation, webpack 5 requires more memory than the currently configured heap limit.
It could possibly be related to using worker threads as opposed to processes, but needs investigation.
Edit: Findings
tl;dr; Webpack 5's minimum memory needs are higher. This can be mitigated with esbuild for minification.
- Both webpack 4 and webpack 5 cannot build on a docker container with 5gb of memory
❌ - Webpack 4 can build on a container with 7gb of memory
✅ - Webpack 5 (using esbuild for minification) can also build on a container with 7gb of memory
✅ - Currently, Webpack 5 (without esbuild) cannot build on a container with 7gb of memory.
❌
Suggested minimum needs:
- Webpack 4 - 7gb
- Webpack 5 - 8gb
CI Runners for gitlab-org are configured with a google machine type of n2d-standard-2, which have 2cpus and 8gb of RAM. This should be enough to support a migration to Webpack 5 with or without esbuild.
using psrecord
Current benchmarking approach using psrecord
needs
- asdf install python 3.9.0
- asdf global python 3.9.0
- pip install psrecord
- pip install matplotlib
- asdf reshim python
running a benchmark using webpack 4
git clone git@gitlab.com:gitlab-org/gitlab.git gitlab-webpack-4 && cd gitlab-webpack-4yarn installpsrecord "yarn <webpack|webpack-prod>" --plot result.png --log result.log --include-children
running a benchmark using webpack 5
git clone git@gitlab.com:gitlab-org/gitlab.git gitlab-webpack-5 && cd gitlab-webpack-5git checkout qa/webpack_recordsyarn installpsrecord "yarn <webpack|webpack-prod>" --plot result.png --log result.log --include-children
Edited by Sean Gregory