Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Build Caching

SynDB uses multiple layers of caching to keep compile times short across local development, CI pipelines, and production deploys.

Cargo profile settings

Configured in .cargo/config.toml, these profile settings keep local cargo artifacts smaller and avoid leaking nightly-only compiler flags into nested workspaces:

SettingEffect
debug = "line-tables-only"Keeps local debug symbols useful for stack traces while reducing debug-info size
split-debuginfo = "unpacked"Stores debug information outside the main binary on platforms that support it
profile.dev.package."*".debug = falseAvoids generating debug information for third-party dependencies during local dev builds

CI caching (GitHub Actions)

In CI, syndb-ci ci runs the pure Rust gate directly on the host (no Docker for the ci subcommand). The generated Nix-runtime workflow opts into an Actions cache for /tmp/.cargo/registry, /tmp/.cargo/git, and the workspace target/ directory. The key includes Cargo.lock, flake.lock, the Rust toolchain, flake source, Cargo configuration, runner architecture, and the generated job scope.

For integration tests (local-stack-test, e2e-test, and the federation or distributed ClickHouse lanes), syndb-ci uses Bollard to start only the services required by that command. Test binaries run on the host with environment variables pointing at isolated localhost:<port> endpoints or Docker-network service names. No Cargo cache volumes are needed inside service containers because the host target/ is used directly.

Nix OCI cache

Local stack images (syndb stack prepare) for the API and ETL are built with Nix and cached using syndb ci nix-oci-cache. This command uses Nix store paths as content-addressed fingerprints to skip unnecessary rebuilds:

  1. nix build .#oci-syndb-api produces a store path (a hash of all inputs)
  2. The script compares the current store path against a stamp file (/tmp/.oci-syndb-api.storepath)
  3. If unchanged, the build is skipped entirely
  4. If changed, the new tarball is copied to /tmp/ and loaded into Docker

This means syndb stack prepare is near-instant when source hasn’t changed.

Nix Crane dependency caching

For Nix-based OCI image builds and the remaining Nix validation checks, the project uses Crane with a split dependency build:

# nix/rust.nix
mkCargoArtifacts = system:
    craneLib.buildDepsOnly (mkCommonArgs system);

buildDepsOnly compiles all workspace dependencies into a cached Nix derivation. Subsequent builds of workspace crates reuse these artifacts, so only the project’s own code is recompiled. Since Nix derivations are content-addressed, the dependency cache is automatically invalidated when Cargo.lock changes.

UI Source-Hash Cache

The UI image path used by syndb stack prepare uses a source-hash stamp to skip rebuilds when Rust UI source files, static assets, or the packaged QueryFabric and Topoxide sources haven’t changed:

  1. SHA-256 of all files in crates/services/ui-dioxus/src/, crates/services/ui-dioxus/public/, queryfabric/crates/queryfabric/src/, queryfabric/crates/queryfabric-catalog/src/, queryfabric/crates/queryfabric-dioxus/src/, queryfabric/crates/queryfabric-dialect-syql/src/, and vendor/topoxide/, plus the relevant workspace and crate Cargo.toml files and Cargo.lock
  2. Compared against /tmp/.syndb-ui.srchash
  3. If the hash matches and syndb-ui:dev exists in Docker, the build is skipped

The SyQL editor and ETL graph explorer are Rust/Dioxus components; no separate JavaScript assets participate in this cache.

Summary

LayerScopeMechanismInvalidation
Cargo flagsLocal devReduced debug infoN/A (always active)
GitHub Actions cacheNix-runtime Cargo CIactions/cache@v4.3.0Cargo/Nix/toolchain/config hashes
Nix OCI cachesyndb stack prepare (API, ETL)Nix store-path stampsContent-addressed (any input change)
Crane depsNix validation, OCI imagesbuildDepsOnly derivationCargo.lock changes
UI source hashsyndb stack prepare (UI)SHA-256 file stampSource file changes