[ccache] Handle concurrency?

Akim Demaille akim at lrde.epita.fr
Thu Aug 6 09:48:24 UTC 2015

Hi all,

I have another feature I'd like to see in ccache.  But maybe I should first present my project.

It's C++ based, with heavy uses of templates.  On top of it, there's a layer that uses some kind of a runtime type system that detects what template instances we need, and if there are not yet available, we generate some C++ code, compile it, and dlopen it.  Ccache is used to avoid useless compilations when a precise template instantiation was already performed in a previous run.

It works very well.  However, especially when running the test suite, concurrently, we sometimes compile the same bits multiple times.  Since some components are really really heavy to compile (two minutes for the biggest one, consuming more than a gig of RAM), it's really bad to have the machines do it multiple times concurrently.

It seems to me that ccache is in perfect position to avoid this, isn't it?  It could detect existing builds and wait for them to complete, rather than duplicating them.

I agree my setup is really specific, but _maybe_ it could be useful to others.  I have another scenario where it would help: when a branch is pushed, our build farm runs the whole test suite of all the pushed revisions, concurrently.  They share a common ccache to save cycles.  Unfortunately, when several slaves compile the same thing, they load the machine uselessly.

Thanks for ccache!


More information about the ccache mailing list