GrabNagendra GangwarProblem & solution
Taming the monorepo beast: Our journey to a leaner, faster GitLab repo
Summary
Grab’s decade-old Go monorepo grew to 12.7 million commits, 73GB of Git-tree metadata, 176GB of blobs, 12 million references, and 444,000 files, causing replication lag, slow developer workflows, and GitLab operational bottlenecks. A staging proof of concept compared full and single-commit histories under production-like load: replication delay fell from 160–240 seconds to 1–2.5 seconds, nearly a 100x improvement. Because custom migration tooling processed about 100 commits per hour, the team retained commits reachable from more than 2,000 critical tags, one month of recent history, and simplified merge commits, while archiving older history. The resulting prune reduced commits by 99.9%, improved replication performance by 99%, preserved code and tags without data loss, and left teams with minor migration adjustments.
Context
A large, decade-old Go monorepo caused Gitaly replication delays of up to four minutes, forcing read traffic onto the primary node and limiting capacity to one-third of the cluster. Developers also faced slow clones and Git operations, CI cloning overhead, storage and backup burdens, GitLab UI timeouts, and limited CI scalability.
Approach / What changed
The team validated history trimming in staging, then created a lean repository retaining commits reachable from more than 2,000 critical tags, complete history for the most recent month, and simplified merge commits. Older history was archived, and the migration was tested through staging dry-runs before production cutover.
Takeaways
A staging comparison found 160–240 seconds of replication delay for the full-history repository versus 1–2.5 seconds for a single-commit repository.
The migration retained tagged releases and one month of recent history because some dependencies were more than two years old and the tooling processed only about 100 commits per hour.
The prune achieved 99.9% fewer commits and a reported 99% improvement in replication performance, with all actual code and tags preserved and no data loss.
Source and freshness
- Source
- engineering.grab.com
- Published
- Added to Yomu
- Last updated
Summaries are generated from the original by a language model. Check the original before relying on it.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
The best engineering reads, once a week
One useful email. Unsubscribe anytime.