masaori335 opened a new pull request, #13328:
URL: https://github.com/apache/trafficserver/pull/13328
# Motivation
Cold-start cache initialization rebuilds each stripe's in-memory directory
from disk on every
restart — multi-minute on large caches.
# Approach
Host the directory (`raw_dir`) in POSIX shared memory so the next process
start attaches the
existing segment in milliseconds instead of rebuilding it. Recovery is
binary and fail-safe:
anything untrustworthy (crash, reboot, ABI/schema mismatch, failed
validation, bad disk) falls
back to the existing disk-rebuild path, and reads still validate `Doc` magic
+ key so a stale
entry is a miss, never served corruption.
# New configs & traffic_ctl commands
Opt-in behind `proxy.config.cache.shm.enabled` (default `0`, a functional
no-op). Also adds
`proxy.config.cache.shm.{name_prefix,use_hugepages,purge_stale_on_start}`
and a
`traffic_ctl cache shm status|clear` command.
# Details
Design, recovery model, configuration, and platform notes are in
`doc/developer-guide/cache-architecture/shm-fast-restart.en.rst` (added in
this PR) and the
`proxy.config.cache.shm.*` entries in `records.yaml`.
# Testing
- Unit: `test_CacheShm` (ABI hash, storage signature, control round-trip,
name length, prefix
normalization, process liveness).
- AuTest: 7 `cache_shm_*` suites — fast restart, unclean shutdown,
schema/storage mismatch,
bad-disk drop + orphan reclaim, concurrent-attach refusal,
purge-on-disable.
# Caveats
- No automated test yet exercises the `_shm_directory_is_valid()` rejection
branches or the
bad-disk / flush-failure `invalidate_stripe_directory()` paths (planned
follow-up).
- macOS concurrent-attach is best-effort: the `flock` guard is authoritative
on Linux but a
no-op on macOS POSIX shm, where it falls back to an owner-pid liveness
check.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]