-
-
Notifications
You must be signed in to change notification settings - Fork 471
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Speed up builds on CI with more caching #3200
Comments
Here's a wacky idea: If we could determine which crates' benchmarks are unaffected by the changes in a PR, could prevent benchmarks for those crates running at all. I've been using this hack on #2457 to get faster feedback: oxc/tasks/benchmark/codspeed/upload.mjs Lines 40 to 55 in 3151f6c
It only runs the benchmarks for NAPI, but uploads a cached copy of results for all the other benchmarks to CodSpeed, so that CodSpeed's dashboard doesn't show "missing benchmark" and they all show as 0% change, except the one that I'm interested in. This would also stop every second PR from showing a nonsense "oxc_semantic regressed 3%" / "oxc_semantic improved 5%" message. |
I already tried. You need something like https://github.com/holmgr/cargo-sweep to tidy up things, but I got into dead ends. I read all the issues around this topic and even tried building my own tools, but there's some problem with cargo not keeping some meta if I remember correctly. The best option is actually https://github.com/mozilla/sccache with an aws s3 backend, but I'm too cheap for that :-) |
Ah. It's more complex than I thought.
How about using sccache with Github Actions backend? And what do you think about my "wacky idea" above? |
If the goal is to speed up the benchmark build, 2 things:
edit: oh it's building the whole crate ... we can split all the crates up because cargo caches at the crate level :-)
|
https://github.com/mozilla/sccache/blob/main/docs/GHA.md Already tried a year go #268 |
I don't not a fan of constructing our infra against a third party tool ... |
Damn!
Would you mind explaining that a bit more? This is what I was trying to say originally, but I'm not great on infrastructure stuff, so probably don't know the right words/concepts. |
Split I can try this tomorrow when I wake up. edit: I think it's best to use |
Ah I see. I didn't try that exactly, but I did try putting all But maybe problem is I didn't get them to use different cache keys, so they all destroyed each others' caches? |
The other thing we could try is having 1 job build That wouldn't reduce the start-to-end time to run benchmarks, but it wouldn't tie up 10 workers all building the same thing - which was the original problem raised in #2981. |
Oh yes, this is simpler, let's do this. |
It would be an easy first step. But, personally I really like fast feedback on benchmarks, so if the solution of multiple crates / features gets the benchmarks to the finish line faster, I would favour that approach. I think quite possibly when I tried it before I screwed it up by having them all clobber each others' caches. You are much better at this stuff than me, and can most likely get more juice out of it than I could. I think it's worth a try at least. |
Just to go back to 2 things you said earlier:
I've just read a bunch of the issues linked to from Swatinem/rust-cache#37 Can't say I understand most of it, but it seems like maybe "some problem with cargo not keeping some meta" was that cargo judges if a file is changed or not by its rust-lang/cargo#6529 (comment) (this "retimer" tool was never made public, but it doesn't sound complicated to build something similar) It may well be that I'm being hopelessly naive, and there's a whole rabbit hole of further complications. But given that CI speed is a priority for Oxc, maybe it's worthwhile giving it another shot?
I didn't see it like that. I saw it as hacking an external tool to make it do what we want. i.e. make the infra fit us, rather than us fit the infra (and we are already hacking CodSpeed's API, to do sharded benchmarks). |
And just to drop the link as a sort of "bookmark", I found this comment interesting on the subject: |
IMO I'd suggest sccache + S3 again. I use it in moon just fine. |
@milesj Does S3 not run up the bills quite a bit? |
@overlookmotel That's why are living in a refugee camp. Too poor. |
We don't need more caches, we just need to fix our code #3213 closing as non-actionable. |
@Boshen Concerning sccache: How much data storage do we need? sccache supports Cloudflare R2 which is cheaper than S3 - $1.50 a month for 100 GB storage, and data transfer is free. Surely even us refugees can afford $1.50 a month?! Yes, we can improve our code, but at that price, why not do both? |
Tell you what... I'll split it with you. 75 cents a month each. 😆 |
Adding cache and speeding up the build will hide away the fact that our code is too slow to compile. If you have 75 cents, can you spare me a little bit more for https://buildjet.com/for-github-actions 😛 |
FWIW, moon's S3 CI costs are only like $8 a month. I have the bucket auto-delete old files. |
Follow on from #2981.
The largest component of the time it takes to run benchmarks on CI is building the benchmarks.
Obviously the benchmarks for whichever crates a PR touches do need to be rebuilt, but all the rest could be cached.
The docs for Swatinem/rust-cache say:
That would indeed make sense for a single crate, but in a workspace project where the majority of PRs will only touch a single crate, I don't think this is a good strategy.
Not sure how to solve it, but I imagine if we can improve the caching strategy, it could improve CI times significantly.
The text was updated successfully, but these errors were encountered: