Closed devjgm closed 1 year ago
The idea was that in the local mode the cache client should have as less overhead as possible. To gather that kind of stats additional synchronization is needed to keep the data consistent when doing parallel builds (and clang-tidy checks), besides what is necessary to touch
the hash file.
In the client/server mode the server gathers some such statistics and provides them through a REST API and a visual dashboard.
Hi, I've added the printout of some stats, but for now it works only with the server.
Thanks.
Our builds run in a completely headless environment. They run in docker containers on servers and we only see the text logs. In such a case, I'm thinking the ctcache server would not be a big advantage for us and so I'm using local mode. Does this thinking sound right to you?
Also, no urgency on this FR. You can close this issue, or file it away to maybe do someday or not. It's up to you.
If the system running in the container has systemd, then it is pretty straightforward to (autostart and) run the server as a systemd user service under the same account. With the server, you get more features, the cached hashes are kept in memory, and saved in a zipped file, so depending on your storage HW the server may even be faster. It also takes care of the hash cleanup so you don't have to do that manually and it tracks some statistics. Also there is a dockerfile so you can run the server itself as a docker service. With something like docker-compose it should be easy to integrate into your environment.
I had the same use case, thus running only in local mode (just like ccache).
I made a quick not yet well tested addition here: https://github.com/matus-chochlik/ctcache/compare/main...Zitrax:ctcache:local_stats
Hi, it looks promising. If testing confirms that these changes don't break anything, please open a PR. Thank you.
Thanks, I can come back with a PR once I have tested it a bit more.
ccache has a
--show-stats
flag that's useful to see the value its providing. https://ccache.dev/manual/4.2.htmlTypical usage is like:
It may be nice if
clang-tidy-cache
had similar functionality when run in local mode.What should the output be? Cache hits, cache misses, etc. In case it helps, the output from ccache looks like the following:
Of course, the output doesn't need to exactly match this, but it's something to consider and draw inspiration from.