Add small in-actor LRU cache for hot assets

AssetStoreServer runs on a single dedicated smarm actor thread, so a
plain HashMap+VecDeque LRU in front of the SQLite lookup needs no
locking. Capacity configurable via CCC_CACHE_CAPACITY (default 256).

Bench (bench/RPS): +42-47% RPS under a cache-sized/hot-set workload,
but a small net loss under adversarial uniform-random access with a
cache smaller than the catalog. Real traffic is hot-set skewed, so
net win in practice; capacity should be tuned to the expected hot set.
This commit is contained in:
2026-08-08 22:59:57 +02:00
parent cdedab3302
commit 24175dde36
5 changed files with 233 additions and 4 deletions
+2
View File
@@ -27,6 +27,8 @@ docker compose exec ccc /usr/local/bin/ccc add demo /staging/app.js 1.0.0
(Alternatively `docker cp` a file straight into the container if you'd
rather not use the staging mount.)
_See [bench/RPS](bench/RPS) for an RPS bench of the store's LRU cache vs. raw SQLite._
## License
AGPL-3.0-only - see [LICENSE](LICENSE). If you run a modified version