Readyset Docs

Benchmarking with cache-compare

Compare source-database and Readyset query latency with a temporary managed cache.

rdst query cache-compare runs a query against its source database and a temporary local Readyset sandbox, then reports side-by-side latency statistics. RDST prepares the sandbox, validates that both sides return equivalent results, and removes the temporary cache when the test finishes.

Common usage

# Default: up to 100 measured executions across the selected queries
rdst query cache-compare a1b2c3d4e5f6 --target prod-orders

# Scale up the sample size
rdst query cache-compare a1b2c3d4e5f6 --target prod-orders --count 1000

# Time-bounded run
rdst query cache-compare a1b2c3d4e5f6 --target prod-orders --duration 60

# Sustained concurrent load on each side
rdst query cache-compare a1b2c3d4e5f6 --target prod-orders \
  --concurrency 10 --duration 120

# Fixed start interval on each side
rdst query cache-compare a1b2c3d4e5f6 --target prod-orders \
  --interval 100 --duration 60

# Share the count budget across several queries
rdst query cache-compare a1b2c3d4 f6e5d4c3 9a8b7c6d \
  --target prod-orders --count 500

Pass the source database target to cache-compare. RDST automatically prepares its one local Readyset sandbox; no Readyset deployment or generated cache target is required.

Execution modes

ModeFlagsBehavior
Fixed count--count NRun at most N measured executions on each side
Duration--duration SECSStop starting work after the per-side time budget
Concurrency--concurrency NMaintain up to N concurrent executions on each side
Fixed interval--interval MSStart sequential executions at the selected interval

--interval and --concurrency are mutually exclusive. --count remains a hard execution cap when combined with --duration.

For multiple queries, RDST shares the requested count and duration budgets across them and tests each query sequentially. Each query gets its own temporary cache and result row. The aggregate invocation never multiplies the requested production-load budget by the number of queries.

cache-compare runs real queries against the source database. Check that the selected count, concurrency, and duration are safe for that environment.

What RDST manages

For each query, RDST:

  1. Acquires the managed sandbox for the selected source target.
  2. Checks Readyset compatibility.
  3. Creates and warms an owner-scoped temporary cache.
  4. Validates source and Readyset results.
  5. Runs the bounded comparison.
  6. Drops the temporary cache before releasing the sandbox.

The clean sandbox may remain warm for reuse for up to 24 hours. It is not an application-facing Readyset deployment.

Flags reference

FlagPurpose
queriesOne or more registry hashes, names, or inline SQL statements
-t, --target NAMESource database target
--count NMaximum measured executions per side, shared across queries; 1-1000
--duration SECSPer-side time budget, shared across queries; 1-300
--interval MSFixed start interval per side; 0-60000
-c, --concurrency NConcurrent executions per side; 1-64
--quietMinimal output
--skip-warningSkip the source-query execution warning

Interpreting the result

SignalMeaning
Readyset has lower mean and tail latencyThe query benefits from Readyset under the selected workload
Similar latencyThe source may already be fast, or the sample may be too small
Source is fasterReadyset does not improve this query under the selected workload
Results differRDST stops before benchmarking and reports the validation failure
Cleanup is partialRDST preserves valid measurements, marks the sandbox dirty, and replaces it before reuse

See also