chadtmiller.com/monolith
An atproto PDS
0
0
On a pull the store benchmark runs small; whole when asked
.knotless/workflows/store-bench-small.ymlnew+32−0
| @@ -0,0 +1,32 @@ | ||
# The store benchmark (bench/store/README.md) at sizes that show only that | ||
# it builds and that every part runs (BENCH_SMALL), a minute or two once | ||
# built: on a pull that changes the benchmark or the store it measures | ||
# (crates/pds-store). Its numbers say nothing; those of | ||
# bench/store/RESULTS.md are store-bench.yml's, when the owner asks. It | ||
# fails only if the benchmark cannot build or run. | ||
# | ||
# Node, the pages' packages and both builds are kept between runs. | ||
image: rust:1.98 | ||
runners: [runner.knotless.dev] | ||
on: | ||
pull: | ||
base: [refs/heads/main] | ||
paths: [bench/store/**, .knotless/workflows/store-bench.yml, .knotless/workflows/store-bench-small.yml, crates/pds-store/**] | ||
env: | ||
BENCH_SMALL: "1" | ||
cache: [target, bench/store/target, /usr/local/cargo/registry, /usr/local/rustup, /opt/node, web/node_modules] | ||
steps: | ||
- uses: chadtmiller.com/steps/node@1 | ||
with: {version: 24.22.1} | ||
- uses: chadtmiller.com/steps/npm-ci@1 | ||
with: {dir: web} | ||
# The pages, which pds-server embeds. | ||
- name: web | ||
run: cd web && PATH=/opt/node/bin:$PATH npm run build | ||
- name: build | ||
run: cargo build --release -p pds | ||
# RocksDB's bindings are generated as it builds, which needs libclang. | ||
- name: libclang | ||
run: apt-get update -q && apt-get install -y -q libclang-dev | ||
- name: store-bench | ||
run: PATH=/opt/node/bin:$PATH bench/store/run.sh | ||
.knotless/workflows/store-bench.yml+9−15
| @@ -2,23 +2,20 @@ | ||
# it: the server's logs and tables beside SQLite, RocksDB and fjall under | ||
# the same commits (writes, a log and a firehose replayed, reads, sizes), | ||
# and the server's start and memory by the number of accounts in its | ||
# service log. Its log is the tables, for bench/store/RESULTS.md. On a | ||
# pull that changes the benchmark or the store it measures | ||
# (crates/pds-store); and on main when the owner asks, which is how a pull | ||
# that changes the server's own frames (its log.rs, compact.rs and | ||
# store.rs) is measured once it has merged. Not on every pull that touches | ||
# those: the benchmark loads the runner's disk for a quarter of an hour, | ||
# and the gates' runs beside it are held to times. It fails only if the | ||
# benchmark cannot build or run, never for a number. | ||
# service log. Its log is the tables, for bench/store/RESULTS.md. Only when | ||
# the owner asks, on main or on a branch (`knotless run rerun <repo> --ref | ||
# refs/heads/<branch> --workflow store-bench`): it loads the runner's disk | ||
# for a quarter of an hour, and the gates' runs beside it are held to | ||
# times, so it is asked for when nothing else runs. A pull that changes the | ||
# benchmark or the store it measures runs it small instead | ||
# (store-bench-small.yml). It fails only if the benchmark cannot build or | ||
# run, never for a number. | ||
# | ||
# Node, the pages' packages and both builds are kept between runs. | ||
image: rust:1.98 | ||
runners: [runner.knotless.dev] | ||
on: | ||
pull: | ||
base: [refs/heads/main] | ||
paths: [bench/store/**, .knotless/workflows/store-bench.yml, crates/pds-store/**] | ||
asked: {refs: [refs/heads/main]} | ||
asked: {refs: [refs/heads/*]} | ||
cache: [target, bench/store/target, /usr/local/cargo/registry, /usr/local/rustup, /opt/node, web/node_modules] | ||
steps: | ||
- uses: chadtmiller.com/steps/node@1 | ||
| @@ -33,8 +30,5 @@ steps: | ||
# RocksDB's bindings are generated as it builds, which needs libclang. | ||
- name: libclang | ||
run: apt-get update -q && apt-get install -y -q libclang-dev | ||
# About a quarter of an hour alone; beside another workflow's runs it has | ||
# taken over half an hour. | ||
- name: store-bench | ||
run: PATH=/opt/node/bin:$PATH bench/store/run.sh | ||
timeout: 3600 | ||
bench/store/README.md+9−4
| @@ -37,10 +37,15 @@ files of 20,000 or more, which the benchmark raises itself where it may: | ||
under a lower one the row of a RocksDB for each of 2000 accounts is left | ||
out, and says so. | ||
| ||
On the runner, the `store-bench` workflow runs the same script: on a pull | ||
that changes `bench/store/`, and on `main` when the owner asks | ||
(`knotless run rerun knotless://chadtmiller.com/spec-pds --ref | ||
refs/heads/main --workflow store-bench`). Its log is the tables. | ||
On the runner, the `store-bench` workflow runs the same script when the | ||
owner asks, on `main` or a branch (`knotless run rerun | ||
knotless://chadtmiller.com/spec-pds --ref refs/heads/main --workflow | ||
store-bench`): its log is the tables. Asked for when nothing else runs | ||
there, as it loads the runner's disk and the gates' runs beside it are held | ||
to times. A pull that changes `bench/store/` or `crates/pds-store` runs | ||
`store-bench-small` instead: the same script with `BENCH_SMALL` set, every | ||
part at a size that shows only that it builds and runs, whose numbers say | ||
nothing. | ||
| ||
Run it alone on the machine: every part times syncs, reads or starts. | ||
| ||
bench/store/run.sh+33−21
| @@ -3,7 +3,9 @@ | ||
# put in RESULTS.md. The server is ../../target/release/pds, built already | ||
# (`just build`), or PDS_BIN: without one, the last part is left out; CARGO | ||
# names the cargo that builds the rest (`cargo` by default); arguments are | ||
# service.mjs's, its counts of accounts. | ||
# service.mjs's, its counts of accounts. With BENCH_SMALL set every part | ||
# runs at a size that shows only that it builds and runs, in a minute or | ||
# two: its numbers say nothing. | ||
set -eu | ||
cd "$(dirname "$0")" | ||
cargo=${CARGO:-cargo} | ||
| @@ -24,43 +26,53 @@ fi | ||
echo "- $($cargo --version); node $(node --version)" | ||
echo "- the repository at $(git rev-parse --short HEAD 2>/dev/null || echo 'a commit git cannot name here')" | ||
echo | ||
echo "## Writes" | ||
echo | ||
$bench write 1500 16 | ||
# Each part's size: the sizes RESULTS.md's numbers are of, or small ones, | ||
# and then one count of writers a part. | ||
if [ -n "${BENCH_SMALL:-}" ]; then | ||
writes="100:16" spreads="100:16:40" unsynced="2000:16:40" | ||
logs="8 16" events=5000 accounts=200 records=100 sized=20 | ||
[ $# -gt 0 ] || set -- 1000 | ||
else | ||
writes="1500:16 1500:4" | ||
spreads="1500:4:40 1500:16:40 2048:64:2000 4096:256:2000" | ||
unsynced="40000:16:40 40000:256:2000" | ||
logs="64 512" events=200000 accounts=2000 records=500 sized=200 | ||
fi | ||
# A part run once for each of its sizes, `:` between a size's numbers. | ||
each() { | ||
part=$1 | ||
shift | ||
for size in "$@"; do | ||
echo | ||
$bench "$part" $(echo "$size" | tr : ' ') | ||
done | ||
} | ||
| ||
echo | ||
$bench write 1500 4 | ||
echo "## Writes" | ||
each write $writes | ||
echo | ||
echo "## Writes of realistic commits, by the number of writers" | ||
echo | ||
$bench spread 1500 4 40 | ||
echo | ||
$bench spread 1500 16 40 | ||
echo | ||
$bench spread 2048 64 2000 | ||
echo | ||
$bench spread 4096 256 2000 | ||
each spread $spreads | ||
echo | ||
echo "## Writes with no sync: not durable" | ||
echo | ||
$bench unsynced 40000 16 40 | ||
echo | ||
$bench unsynced 40000 256 2000 | ||
each unsynced $unsynced | ||
echo | ||
echo "## A log replayed" | ||
echo | ||
$bench scan 64 512 | ||
$bench scan $logs | ||
echo | ||
echo "## The firehose replayed" | ||
echo | ||
$bench firehose 200000 2000 | ||
$bench firehose $events $accounts | ||
echo | ||
echo "## Reads" | ||
echo | ||
$bench reads 2000 500 | ||
$bench reads $accounts $records | ||
echo | ||
echo "## Size and compression" | ||
echo | ||
$bench size 200 500 | ||
$bench size $sized $records | ||
echo | ||
echo "## The service log by the number of accounts" | ||
echo | ||
docs/guide/comparing.md+4−2
| @@ -253,8 +253,10 @@ held open, smaller blocks, another check), to say what each is worth. | ||
[bench/store/README.md](../../bench/store/README.md) says what each part | ||
measures and what is fair to each store, and | ||
[bench/store/RESULTS.md](../../bench/store/RESULTS.md) holds the last | ||
results, by machine. The `store-bench` workflow runs it on the runner, on a | ||
pull that changes it or `crates/pds-store`, and when the owner asks. | ||
results, by machine. The `store-bench` workflow runs it on the runner when | ||
the owner asks, on `main` or a branch; a pull that changes it or | ||
`crates/pds-store` runs it small (`store-bench-small`, `BENCH_SMALL`), to | ||
show only that it builds and runs. | ||
| ||
RocksDB is built from source the first time, some minutes, and its | ||
bindings need libclang (`apt-get install libclang-dev`; Xcode's tools have | ||