CI/CD · Ship safely, repeatedly
How do you speed up a slow pipeline?
Short answer
Measure queue time and the critical path, then cache dependencies, parallelize independent work, run only affected tests, remove redundant steps, and use faster runners. Never trade correctness for speed.
A pipeline has two clocks: how long the work takes and how long it waits for a runner. Optimizing a fast job that queues for ten minutes is wasted effort, so start with per-job timing and queue metrics.
- Identify the longest dependency chain, not the sum of all jobs
- Cache dependencies and build outputs with correct keys
- Parallelize independent jobs and shard tests using historical timing
- Use test selection or affected-project analysis to skip unaffected work
- Remove duplicate installs, redundant checkouts and unnecessary artifacts
- Right-size runners and keep a warm pool for high-traffic repositories
- Move non-blocking checks, such as long scans, off the merge critical path
start=$(date +%s)
npm ci
install_seconds=$(( $(date +%s) - start ))
echo install took $install_seconds secondsFollow-ups you should expect
Interviewers use these to check whether the first answer was understanding or memorisation.
- 1What is the critical path in a pipeline?
- 2How do you decide between caching and parallelizing?
- 3How do you speed up a clean build with no cache?
- 4When is it acceptable to skip tests?
Say it in the interview
I start by measuring queue time and the critical path, because the slowest job is not always the bottleneck. Then I cache aggressively with correct keys, parallelize independent work, shard tests by timing and use affected-project analysis. I also remove redundant steps and right-size runners. I test the clean-cache path as well, because a pipeline that only performs well with a warm cache still slows down pull requests and recovery.
Use this as a model, not a script. Saying it in your own words is what makes it survive follow-up pressure.
Related questions
Reading is step one
Now say it out loud.
Understanding an answer and delivering it under pressure are different skills. Rehearse this topic in a live CI/CD mock interview and get scored feedback on depth, clarity and confidence.