Archil caches your data at two distinct layers:Documentation Index
Fetch the complete documentation index at: https://docs.archil.com/llms.txt
Use this file to discover all available pages before exploring further.
- The Archil storage system cache is a durable, multi-Availability-Zone caching layer that runs server-side, between your clients and your data source. It’s where your active data is durably stored (a successful
fsync()commits to it) and where it’s metered, and it serves data with sub-millisecond latency. See Architecture for how it fits in. - The client-side cache is an in-memory cache inside each Archil client — one per mount. It holds recently used data so that repeated access is served locally, without even a round-trip to the storage system.
What the client caches
The client maintains several in-memory caches, all populated on demand as your application reads and writes:- File data — the contents of files. This is the bulk of the cache.
- File and directory attributes — metadata such as size, timestamps, and permissions (the result of a
stat). - Directory listings — the entries returned by
readdir(i.e.,ls), so repeated traversals of the same directory don’t round-trip to the server. - Extended attributes — when xattrs are enabled.
Cache size and eviction
The client’s in-memory data cache is bounded by two settings onarchil mount:
--max-cache-mb— the hard ceiling on the client cache size. Default: 1/4 of available RAM or 2048 MiB, whichever is smaller.--target-cache-mb— the size the client aims to keep the cache near, leaving headroom for bursts of new reads. Default: 75% of the maximum.
- Unflushed (dirty) writes — data you’ve written that hasn’t yet been committed to the storage system is always preserved locally, so eviction can never lose your writes.
- Entries still in use — anything an application currently has open is kept until it’s released.
Because the client cache is bounded, reading or pre-fetching more data than
--max-cache-mb can hold will evict earlier entries before you use them. Size the cache for your working set when you plan to keep a large data set hot on a client.Freshness and consistency
Serving reads from the client cache is what lets a client avoid contacting the storage system on every operation — which also means a client can briefly serve slightly stale data after another client changes a file. The client revalidates cached entries with the storage system so that changes become visible within seconds for file data and attributes. Directory listings are cached for longer; you can tune their lifetime per directory witharchil set-cache-expiry.
For the full model — including how fsync and cache flushes provide strong read-after-write consistency between connected clients — see Consistency.
Warming the client cache
By default the client cache fills lazily as data is read, so the first read of any file on a client pays the fetch latency. When you know which files you’ll need — loading a model, starting a database, or running a batch job over a known set of inputs — you can warm them ahead of time so the first read is already local. There are two ways to warm the client cache:archil prefetch <MOUNTPOINT> <PATH>...— pre-fetch files or directories (recursively) into the cache of an already-mounted disk. The command queues the work and returns immediately; fetching continues in the background.archil mount --pre-fetch <PATHS>— warm a comma-separated set of paths automatically as soon as the disk is mounted.
Pre-fetched data shares the client cache with normal reads, so it counts against
--max-cache-mb and is subject to the same eviction described above.Refreshing the client cache
To force a client to drop cached entries and re-read from the storage system — for example, when another client has updated files on a--shared mount — use archil invalidate-cache. Pass the mount root to refresh everything, or a single file path to refresh just that file. In-flight (dirty) writes are always preserved.
Controls at a glance
| Goal | Control |
|---|---|
| Set the maximum client cache size | mount --max-cache-mb |
| Set the target client cache size | mount --target-cache-mb |
| Warm files into the client cache after mount | prefetch |
| Warm files into the client cache at mount time | mount --pre-fetch |
| Drop and re-read cached data | invalidate-cache |
| Tune directory-listing cache lifetime | set-cache-expiry |