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.
38 lines
1003 B
Markdown
38 lines
1003 B
Markdown
# C3 - Cached Content Conduit
|
|
|
|
My super simple CDN built for distributing my own (text) content.
|
|
|
|
## Running in Docker
|
|
|
|
```
|
|
docker compose up -d
|
|
```
|
|
|
|
The runtime image is `distroless` (no shell, no package manager, ~24MB),
|
|
so managing packages happens via `docker exec` running the `ccc` binary
|
|
directly rather than an interactive shell:
|
|
|
|
```
|
|
docker compose exec ccc /usr/local/bin/ccc create demo
|
|
```
|
|
|
|
To add a file, it needs to exist inside the container first. Drop it in
|
|
the `./staging` dir, which is bind-mounted to `/staging`:
|
|
|
|
```
|
|
cp app.js staging/
|
|
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
|
|
of this as a network service, you must make the modified source
|
|
available to its users.
|
|
|