by aetherspawn · 4y ago · 0 comments
On one hand, without the cache builds can be very slow.
But on the other hand, you’ll see in a lot of projects random commits like “blow away corrupted cache”, which makes you wonder whether building the cache from scratch is an important step of reproducible builds. I personally rather let the builds run longer and be absolutely certain.
Maybe there’s a good middle ground for dev commits vs final merge commits, but unfortunately there’s no machinery in ie GitHub to specify a commit as final before merge.
If you climb the learning curve that far though - you'll be hooked.
When you are in control of the infrastructure where jobs and runners consume resources, other strategies might also help.
Package dependency installs taking some time? Move the runners into network segments with blazing fast connections, next to mirrors of package registries (if not already provided).
Possibility to use a CDN in front of the runners? Make sure the application code is capable of doing so.
C/C++ with ccache can consume a lot of disk space, and caching itself can slow down the pipelines. Calculate the cost of pipeline runs and employees waiting for builds to finish, and compare it to buying more compute resources with xyz cores, lots of memory and direct SSD disk access to speed up the builds.
That said, many different environments and workflows make decisions harder. Better observability for CI/CD is needed, having better insights into pipelines and see if and how efficiency improvements can have an impact. I have shared more thoughts in https://news.ycombinator.com/item?id=29520577
Having implemented a pipeline cache to reduce wall time with 15 minutes for each execution, i wouldn't want to go back to no cache.
But it's important to be resilient to a faulty cache. If that is hard to achieve, then it makes good sense to avoid caching.
> I assume it is ccache and am curious how you use it.
Nope. We just use the same machines for the same jobs (we have 3 agents, and we use teamcity which lets us pin our configurations to agents), and incremental builds. Really basic stuff. The machines are managed by terraform and packer and we rebuild the images once a month or so, so semi frequently pay the full compile hit. I am going to look into actual persistent caching for Mac very soon, it's likely we'll go with fastbuild!