-
Notifications
You must be signed in to change notification settings - Fork 59
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
Skip timestamp append by default #138
Comments
Can you show a comparison with and without this setting?
The setting controls how the ccache directory is up and dowloaded from github, not ccache itself. This has nothing todo with cache hits and misses in ccache. All your questions are answered and discussed in the relevant issues and PRs, see As stated in #126 (comment) changing the default will break most existing workflows. This new setting is only useful for workflows that use their own logic for creating the cache key. |
No, sorry. To busy to play around with it. But scenario is: multiple builds, up to 1GB for each build, multiple branches/PRs active at the same time.
yeap, I'm talking about GitHub cache. Once over limit it will be removed resulting in lost potential.
Thank you for linking them. I missed them somehow.
Probably it won't brake anything. Anyway, that's why I suggested adding it and releasing under new major version. |
No need to get rude. I am always open for suggestions. I am not willing to change something based on gut feelings. I gave you the answer, it clearly stated that overwriting with the same key has a race condition:
The official documentation contains:
Nevertheless I merged the option to disable time-stamping for users that want more control and know what they are doing. |
Sorry, wasn't trying to be rude, just direct.
IMO using timestamp seems to be a 'gut feeling' of someone. I'd love to be proven wrong.
I appreciate that!
Yes, it's being overwritten instead. Final note: Please include timestamp info in main |
Happy to hear about your experience. @vadz you indicated problems in #126 (comment), maybe you can share your experience, too. I understand the documentation that every entry is immutable, further on the documentation describes that in case of an exact match, the creation of a new entry doesn't execute. But we want to create a new entry on every run, see Cache Hits and Misses. Adding documentation and writing about this repeatedly coming up concern is still on my list. I did not find the time for it yet. |
That's very interesting, but it works a bit differently than described. Cache get saved even after cache hit.
|
Maybe something has changed since January, but saving the cache under the same name definitely failed for me back then. I'll try to retest it again but won't be able to do it immediately. FWIW I do agree that if not using timestamps works it should be the default. |
It's been a month since I'm running 'no timestamp' in a couple of repos. @hendrikmuhs please consider reopening this issue and making the change. |
I just tested turning off appending of timestamps and immediately got: Failed to save: Unable to reserve cache with key ..., another job may be creating this cache. More details: Cache already exists This was the first job after turning it off so there was no old existing cache without timestamp. However, looking at repo/actions/caches I can see a (new) cache without timestamp. It seems it was save after all. Is there some other way we can fix this - that the cache space is used up too quickly? Maybe keep using timestamps but remove old caches (same key, older timestamp) automatically? Is that doable? Added: A final thought- could the error message be wrong? @lukasz-mitka Could you check the output of the "Post Load ccache" step? Maybe you have the error message all the time, but it still works? |
Thanks for letting us know! Seems the issue is still present.
I would be very surprised if githubs cache does not handle that internally. Usually a cache works LRU-based, older cache entries should get evicted automatically when the cache space is full and a new entry is pushed. I think we should not try to optimize on that level. However ccache has a lot of options besides the upper size, e.g. it is possible to evict entries on age, change compression, etc. |
The reason I think we could do better than the default automatic eviction, is that as developers we know more about the selected workflow. It's not always true that the oldest cache should be evicted first. In a typical PR workflow, you would like to keep the cache for the PR as long as possible while multiple old caches for the master / main branch has no value. The point is that we are using up the space so fast that PR caches that we want to preserve is evicted. I wonder if a new "replace-cache: true" setting could work? By replace, I mean after the new cache is saved with the new timestamp, older caches are deleted. I assume you can't delete the last cache for the same reason it failed to save when not appending timestamps. |
Caches are separated by branch, however the resource budget is per repository. I hoped to find the eviction logic in However we don't know and I don't like implementing something based on vague assumptions. It would be nice if someone who faces the problem can instrument it's CI, e.g. by listing the caches as described here. This would allow us to reverse-engineer the logic by seeing which caches github choose when evicting entries. It still sounds wrong to me to try fix cache eviction from the client. When we have proof that something works wrong w.r.t. cache evictions we can also contact github to fix it server side. FWIW ccache itself has some interesting options as well, e.g. the cache could be pruned by age after every run to keep the individual ccaches smaller. |
Just for the record: We still struggle with this, that "wrong" caches are evicted, when there is a lot of activity in our mono repo. I think what happens is that long living PR loose their cache, because a lot of other (short lived) PRs are merged to master. We just spent our entire included minutes quota on two days. It normally takes over 20 ... Assuming a lot of people use the PR workflow, fixing this should be useful for other people - not just us. To repeat myself: Is there some way we could avoid saving all these unnecessary caches for the main / master branch? Added: To be honest: I don't understand what is going on. The action loads a cache, so it's not evicted, but ccache reports 100% miss. Any clues? |
@hansfn do you limit the cache size? This might help to prevent eviction. In addition I wonder if the The eviction itself isn't controlled by the action, so I don't see how this can be fixed in this repository.
Is it possible that the compiler suite/binary changed due to an update of the base image? |
Thanks a lot for replying, @hendrikmuhs. Yes, we limit cache size as much as we can. (Typically 2-300 MB.)
No, we compile using our own Docker image. |
Turns out for busy repos the default timestamp costs quite a lot since cache gets dropped a lot, thus increasing build times.
Please consider setting
append-timestamp
tofalse
by default.I would expect a major release with it to save people any issues.
Also what was the purpose of the timestamp? Does it give any benefit I'm missing?
The text was updated successfully, but these errors were encountered: