mirror of
https://gitea.com/gitea/act_runner
synced 2026-09-21 19:37:07 +02:00
perf(cache): skip redundant store writes and scans on cache requests (#1222)
Every cache hit rewrote the entry's access time, costing a bolt write and fsync per restore. Completed entries accessed within the last minute are no longer rewritten, and the in-use and retention windows grow by that minute so nothing is evicted earlier. Same-second rewrites are skipped, reservations are inserted in one transaction, and prefix lookups use the repository index instead of scanning every entry. The store is still opened per request. Keeping it open, as this commit first did, is faster under concurrency but stops a second process sharing the cache directory from starting its cache server. The README caching section is condensed and corrected. | Benchmark, v2 | main | store kept open | this PR | | --- | ---: | ---: | ---: | | Exact hit, 1 client | 16.42 | 0.15 | 0.24 | | Exact hit, 8 clients | 13.70 | 0.08 | 1.28 | | Exact hit, 32 clients | 16.01 | 0.07 | 4.26 | | Prefix hit, 8 clients | 18.34 | 0.12 | 1.28 | | Miss, 8 clients | 3.21 | 0.11 | 1.28 | | Save and restore 1 MiB, 8 clients | 74.4 | 22.9 | 34.9 | | Geomean, all 22 benchmarks | 14.03 | 0.31 | 2.11 | Mean ms per request, medians of 4 rounds of 300 requests over 1,000 entries on an Apple M3 Max. --------- Co-authored-by: silverwind <2021+silverwind@noreply.gitea.com> Co-authored-by: silverwind <me@silverwind.io> Reviewed-on: https://gitea.com/gitea/runner/pulls/1222 Reviewed-by: silverwind <2021+silverwind@noreply.gitea.com>
This commit is contained in:
co-authored by
silverwind
silverwind
parent
69d5c22300
commit
e0ce6776c7
@@ -177,9 +177,9 @@ cache:
|
||||
# A moved tag (e.g. a re-tagged "v6") or an updated branch stays at the cached commit
|
||||
# until its cache entry expires or is manually removed.
|
||||
#offline_mode: false
|
||||
# Serve the actions cache service v2 API. The actions that use it refuse any host they do not
|
||||
# take for GitHub, so reaching it means editing that check out of their own bundle, put back
|
||||
# after the copy into the job. That edit is made either way, this only governs the API
|
||||
# Serve the actions cache service v2 API. The actions that use it fall back to v1 on any host
|
||||
# they do not take for GitHub, so reaching it means editing that check out of their own bundle,
|
||||
# put back after the copy into the job. That edit is made either way, this only governs the API
|
||||
# advertised. A bundle that does not match is left alone. With v2, uploads need a reachable cache.
|
||||
#v2: true
|
||||
# How the cache server discards entries, ignored when external_server is set since that
|
||||
|
||||
Reference in New Issue
Block a user