~ knotless Search/
↑↓ move↵ open⇧↵ all results

zat.dev/zds

atproto pds · mirror of https://tangled.org/zat.dev/zds

0
0
131 lines · 6.3 KB Raw History
zig := env_var_or_default('ZIG', 'zig')
scale := env_var_or_default('ZDS_BENCH_SCALE', '1000')

# run all local store benchmarks
all:
    {{zig}} build bench -Doptimize=ReleaseFast -- --records {{scale}} --blobs 128

# run local HTTP route benchmarks against the release server
http:
    ../tools/http_bench.sh

# pass arbitrary zds-bench args through
run *ARGS:
    {{zig}} build bench -Doptimize=ReleaseFast -- {{ARGS}}

# benchmark repo write path
write:
    {{zig}} build bench -Doptimize=ReleaseFast -- --scenario write --records {{scale}}

# benchmark indexed read paths
read:
    {{zig}} build bench -Doptimize=ReleaseFast -- --scenario read --records {{scale}}

# benchmark blob disk IO and metadata paths
blob:
    {{zig}} build bench -Doptimize=ReleaseFast -- --scenario blob --blobs 512 --blob-size 65536

# benchmark reclaiming untethered blob metadata and disk files
blob-gc blobs="512" blob_size="65536":
    {{zig}} build bench -Doptimize=ReleaseFast -- --scenario blob-gc --blobs {{blobs}} --blob-size {{blob_size}}

# benchmark full repo CAR materialization
repo:
    {{zig}} build bench -Doptimize=ReleaseFast -- --scenario repo --records {{scale}}

# benchmark Tranquil metastore-shaped store operations
metastore callers="1" ops_per_caller="100":
    {{zig}} build bench -Doptimize=ReleaseFast -- --scenario metastore --callers {{callers}} --ops-per-caller {{ops_per_caller}}

# benchmark CID-only record lookup, matching Tranquil's get_record_cid bench
get-cid callers="10" ops_per_caller="1000":
    {{zig}} build bench -Doptimize=ReleaseFast -- --scenario get-cid --callers {{callers}} --ops-per-caller {{ops_per_caller}}

# benchmark record index lookup plus repo_blocks byte fetch
get-block callers="10" ops_per_caller="1000":
    {{zig}} build bench -Doptimize=ReleaseFast -- --scenario get-block --callers {{callers}} --ops-per-caller {{ops_per_caller}}

# benchmark DAG-CBOR decode of a seeded record block without SQLite
decode-record callers="10" ops_per_caller="1000":
    {{zig}} build bench -Doptimize=ReleaseFast -- --scenario decode-record --callers {{callers}} --ops-per-caller {{ops_per_caller}}

# benchmark DAG-CBOR decode plus JSON response rendering without SQLite
render-record callers="10" ops_per_caller="1000":
    {{zig}} build bench -Doptimize=ReleaseFast -- --scenario render-record --callers {{callers}} --ops-per-caller {{ops_per_caller}}

# benchmark full com.atproto.repo.getRecord storage materialization
get-record callers="10" ops_per_caller="1000":
    {{zig}} build bench -Doptimize=ReleaseFast -- --scenario get-record --callers {{callers}} --ops-per-caller {{ops_per_caller}}

# benchmark full listRecords storage materialization
list-records callers="10" ops_per_caller="1000":
    {{zig}} build bench -Doptimize=ReleaseFast -- --scenario list-records --callers {{callers}} --ops-per-caller {{ops_per_caller}}

# benchmark listRecords and repo CAR materialization across synthetic repo sizes
repo-size max_records="5000":
    {{zig}} build bench -Doptimize=ReleaseFast -- --scenario repo-size --records {{max_records}}

# benchmark sync.getRepo storage pressure: full export, since export, and concurrent full exports
get-repo records="5000" callers="4" ops_per_caller="5":
    {{zig}} build bench -Doptimize=ReleaseFast -- --scenario get-repo --records {{records}} --callers {{callers}} --ops-per-caller {{ops_per_caller}}

# benchmark getRecord latency while writes commit; ZDS_DB_READERS=0 for the single-lock baseline
read-write callers="8" ops_per_caller="2000":
    {{zig}} build bench -Doptimize=ReleaseFast -- --scenario read-write --callers {{callers}} --ops-per-caller {{ops_per_caller}}

# benchmark resident-facing reads while firehose subscribers poll event history
firehose records="1000" subscribers="32" polls_per_subscriber="100":
    {{zig}} build bench -Doptimize=ReleaseFast -- --scenario firehose --records {{records}} --callers {{subscribers}} --ops-per-caller {{polls_per_subscriber}}

# verify subscribeRepos disconnect churn releases connection-scoped resources
websocket-churn rounds="100" concurrency="32":
    ../tools/websocket_churn.sh {{rounds}} {{concurrency}}

# benchmark the production publisher shape: blob IO, repo writes, and sync reads together
publish-sync records="100" callers="3" ops_per_caller="3" blob_size="3145728":
    {{zig}} build bench -Doptimize=ReleaseFast -- --scenario publish-sync --records {{records}} --callers {{callers}} --ops-per-caller {{ops_per_caller}} --blob-size {{blob_size}}

# run the upload/write/read mix on disposable Fly machines
fly-upload:
    ./fly/run.sh

# reproduce repo-export pressure on a disposable single-resident Fly machine
export-pressure:
    bash ../tools/repro-export-pressure.sh

# isolate export half-close CPU spin using one socket on a disposable Fly machine
export-half-close:
    ZDS_REPRO_MODE=half-close bash ../tools/repro-export-pressure.sh

# deliberately slow large-repo lane for Paul/Jerry-shaped synthetic repositories
repo-large records="100000":
    {{zig}} build bench -Doptimize=ReleaseFast -- --scenario repo-size --records {{records}}

# benchmark experimental permissioned-space storage paths
space records="1000":
    {{zig}} build bench -Doptimize=ReleaseFast -- --scenario space --records {{records}}

# run the official Bluesky PDS read probe from a local atproto checkout
official-pds:
    ./run-official-pds.sh

# profile applyWrites stage timing under write concurrency
write-profile callers="10" ops_per_caller="500":
    {{zig}} build bench -Doptimize=ReleaseFast -- --scenario write-profile --callers {{callers}} --ops-per-caller {{ops_per_caller}}

# measure fresh schema creation and restarts through HTTP readiness (production build mode)
startup runs="5" history="10000":
    {{zig}} build -Doptimize=ReleaseSafe
    cd .. && uv run tools/startup_bench.py --runs {{runs}} --history {{history}}

# benchmark OAuth space-level reads and collection-restricted writes
space-scopes:
    {{zig}} run -O ReleaseFast --dep scopes -Mroot=../bench/space_scopes.zig -Mscopes=../src/internal/scopes.zig

# exercise and time a disposable account migration using live PLC verification
migration source target target_db="":
    #!/usr/bin/env bash
    set -euo pipefail
    args=(--source "{{source}}" --target "{{target}}")
    if [[ -n "{{target_db}}" ]]; then args+=(--target-db "{{target_db}}"); fi
    uv run ../tools/check-live-migration.py "${args[@]}"