Does anyone work in a large monorepo? I'd like to ...
# random
u
Does anyone work in a large monorepo? I'd like to ask about the dev experience please
c
What do you want to know?
u
1. What's the ballpark size of the team? 2. Do you particularly care about limiting history, or is squashing commits & then occasionally filtering by project folder fine? 3. How is git performance over all? Isn't it meaningfully degraded when switching branches etc? 4. Do you care about amount of opened PRs? Or do you filter them somehow and only really see a slice? 5. Are there unrelated projects in the repo? Say you update a readme, is everything everywhere rebuilt? thx a lot!
c
The monorepo has ~500 Gradle projects. For some that may be considered large, for some it may be considered medium, I'm not sure.
What's the ballpark size of the team?
10–15 people, changing over time.
Do you particularly care about limiting history, or is squashing commits & then occasionally filtering by project folder fine?
No.
How is git performance over all? Isn't it meaningfully degraded when switching branches etc?
Nothing measurable. Git was originally conceived for the Linux kernel codebase, it's built for very very large repositories.
Do you care about amount of opened PRs?
Yes, because it accumulates quickly. But that's just discipline.
Are there unrelated projects in the repo? Say you update a readme, is everything everywhere rebuilt?
Unrelated projects not really, but there are custom tools that are built just for this project. Updating a README doesn't rebuild anything though, Gradle is very good at incremental compilation.
That's the size of monorepo I recommend btw. If you have configuration cache and configuration avoidance, the build times aren't that bad.
If you're interested in much larger repos, I recommend reading https://developer.squareup.com/blog/herding-elephants/ and the following posts
u
about the config avoidance config cache etc, I meant CICD, did you mean locally?
c
I did mean locally. I don't use configuration cache in CI, but I do heavily use the remote build cache.
u
so you do run everything on readme change but get no-oped on ci?
c
I'm not sure what you mean. Gradle knows the README doesn't impact the compilation of code.
u
yea but such commit will trigger CICD pipelines, won't it? -- so in this monorepo, there's just a gradle build, nothing else?
c
yea but such commit will trigger CICD pipelines, won't it?
Right, but you will only lose the Gradle configuration time (a few minutes max). Gradle knows nothing else changed, so it won't do much more.
so in this monorepo, there's just a gradle build, nothing else?
Everything is driven by Gradle. There is a Node build, a few docker containers, but they're all started by Gradle which knows when it's pointless to do them
u
I see, well tbh that's rare case for monorepo, that everything is gradle, I'd expect the node people to use npm or whatever they normally use etc
c
It's still Node in the end, but there is a Gradle task to trigger it. That's actually a much better workflow, because Gradle can ensure everyone has the same Node version etc (which NPM still isn't able to do)
u
I know but how did you manage to convince js people? Sounds to improbable im my setup
c
There's still a
package.json
and everything, they can use it directly if they want, but then it's their responsibility for having the correct Node version.