Compiler Cache, Remote CAS & Distributed Builds
Scale from a single workstation to shared team caching and sandboxed multi-node compilation without modifying your CMake, Ninja, or Cargo projects.
1. Direct-Mode Compiler & Link Caching
FastCi supports both explicit invocation (fastci wrap -- gcc ... or fastci cc gcc ...) and implicit launcher mode (fastci gcc ... when set as CMAKE_*_COMPILER_LAUNCHER or RUSTC_WRAPPER).
- Supported compilers: GCC, Clang, MSVC
cl.exe,clang-cl, Fil-C,rustc,zig,swiftc,nasm,yasm,as,ml64. - Supported linkers:
ld,lld,gold,link.exe,ar,llvm-ar,lib.exe. - Direct-Mode Manifest: On the first compile, FastCi parses compiler depfiles (
-MD//showIncludes) and records every header path and hash. On subsequent builds, FastCi verifies headers in-process via Statcache v4 / NTFS USN and restores the cached.o/.objwithout ever spawning the compiler or preprocessor. - Preprocessor Cache: Set
FASTCI_PP_CACHE=1on Windows/MSVC to cache preprocessed output when direct mode misses.
export CMAKE_C_COMPILER_LAUNCHER=fastci
export CMAKE_CXX_COMPILER_LAUNCHER=fastci
export CMAKE_C_LINKER_LAUNCHER=fastci
export CMAKE_CXX_LINKER_LAUNCHER=fastci
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release
cmake --build build --parallel
fastci stats
export RUSTC_WRAPPER=fastci
export FASTCI_VERIFY_INPUTS=sample
cargo build --release
fastci stats
/Z7, Never /Zi/Zi writes debug symbols into a shared vc140.pdb via mspdbsrv.exe, preventing safe concurrent caching. Replace /Zi with /Z7 (or /DEBUG:FASTLINK) in CMake release/CI presets to get full Windows cache hits.
2. Shared Remote CAS Server (remote-serve)
FastCi includes a lightweight, persistent-connection HTTP/1.1 Remote CAS server with bearer-token authentication and size-bounded LRU storage:
fastci remote-serve \
--listen 0.0.0.0:8080 \
--dir /var/lib/fastci-cas \
--token "$FASTCI_REMOTE_TOKEN" \
--max-size-gb 50
# Main branch (read + write)
export FASTCI_REMOTE_CACHE=https://cas.internal:8080
export FASTCI_REMOTE_TOKEN="$SECRET_CAS_TOKEN"
# Untrusted Pull Requests (strict read-only!)
export FASTCI_REMOTE_READ_ONLY=1
Never allow fork Pull Requests to write to the shared Remote CAS. Set FASTCI_REMOTE_READ_ONLY=1 (or omit FASTCI_REMOTE_TOKEN on write-protected servers) on pull_request events so attackers cannot poison artifacts used by main-branch builds.
3. Distributed Compilation (dist-serve & dist-worker)
For large C/C++ clean builds where even a warm cache is cold (e.g., editing a core header), FastCi's distributed mode dispatches preprocessed translation units across a pool of workers over HTTP/1.1 with FCIA v1 archive framing and BLAKE3 integrity verification.
fastci dist-serve \
--listen 0.0.0.0:9090 \
--token "$FASTCI_DIST_TOKEN"
fastci dist-worker \
--scheduler http://coordinator.internal:9090 \
--token "$FASTCI_DIST_TOKEN" \
--toolchain /usr/bin/clang \
--slots 8 \
--sandbox bwrap
export FASTCI_DIST_URL=http://coordinator.internal:9090
export FASTCI_DIST_TOKEN="$FASTCI_DIST_TOKEN"
export FASTCI_DIST_LOCAL_FALLBACK=1
cmake --build build --parallel 32
- Sandboxing: On Linux, workers isolate each compile task using Bubblewrap (
bwrap) with unshared network/PID/IPC namespaces, read-only toolchain mounts, and strictRLIMIT_CPU/RLIMIT_AS/RLIMIT_FSIZElimits. - Graceful Fallback: With
FASTCI_DIST_LOCAL_FALLBACK=1(default), any network error or unsupported flag falls back transparently to local compilation so builds never flake.
4. Cache Inspection & Garbage Collection
# Inspect hit/miss counters and cache footprint
fastci stats
fastci cache stats --json
# Prune oldest artifacts down to 2 GiB
fastci cache gc --max-size-mb 2048
# Reset everything cleanly
fastci cache clean