Jenkins

Build Slowdown from Bloated Workspace Directories

info
Resource ContentionUpdated Jun 20, 2024

Jenkins workspace directories accumulate large amounts of stale data from previous builds (node_modules, build artifacts, cache files), increasing disk I/O and slowing down subsequent builds.

How to detect:

Monitor workspace directory sizes and build checkout times. Alert when workspace size exceeds 10GB or checkout duration increases significantly. Track disk I/O wait times during build initialization.

Recommended action:

Add cleanWs() to pipeline post-actions to clean workspace after every build. For matrix builds, implement per-configuration cleanup. Use Jenkins workspace cleanup plugin. Configure Git sparse checkout when possible to reduce checkout size.