Skip to content

Commit 19e6882

Browse files
committed
bench: add fineweb FTS end-to-end benchmark
New rust/lance/benches/mem_wal_fineweb_fts.rs covers three metrics across the 12 configs in the design doc: - write throughput at memtable sizes 100k / 500k / 1M - MemTable FTS query latency (avg/p50/p95) over 100 high-frequency tokens + 50 sampled phrases - consistency: |memtable_top10 ∩ post_flush_disk_top10| / |union| as a user-approved replacement for recall@k The bench downloads HuggingFaceFW/fineweb sample/10BT shards, caches them, and is fully env-driven so a single binary handles every config. Driver script bench/run_fineweb_fts.sh loops the 12 configs, uploads each result.json to S3, and prints a summary. Also: make `dataset::mem_wal::index` public so the bench can call `FtsMemIndex::search_with_options` directly to time the MemTable read path.
1 parent afdd467 commit 19e6882

4 files changed

Lines changed: 1078 additions & 1 deletion

File tree

bench/run_fineweb_fts.sh

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
#!/usr/bin/env bash
2+
# Driver for the fineweb FTS benchmark.
3+
#
4+
# Runs the 12 configs (3 memtable sizes × durable yes/no × FTS yes/no), saves
5+
# each result.json locally and to S3, and at the end prints a small summary.
6+
#
7+
# Usage:
8+
# ./bench/run_fineweb_fts.sh [run_id]
9+
#
10+
# Env vars (optional):
11+
# DATASET_PREFIX default: s3://jack-devland-build/bench/mem-fts-fineweb
12+
# BENCH_BASE_ROWS default: 1000000
13+
# BENCH_INGEST_ROWS default: 1000000
14+
# BENCH_BATCH_SIZE default: 1000
15+
# AWS_DEFAULT_REGION default: us-east-1
16+
17+
set -euo pipefail
18+
19+
cd "$(dirname "${BASH_SOURCE[0]}")/.."
20+
21+
RUN_ID="${1:-$(date -u +%Y%m%dT%H%M%SZ)}"
22+
DATASET_PREFIX="${DATASET_PREFIX:-s3://jack-devland-build/bench/mem-fts-fineweb}"
23+
BENCH_BASE_ROWS="${BENCH_BASE_ROWS:-1000000}"
24+
BENCH_INGEST_ROWS="${BENCH_INGEST_ROWS:-1000000}"
25+
BENCH_BATCH_SIZE="${BENCH_BATCH_SIZE:-1000}"
26+
export AWS_DEFAULT_REGION="${AWS_DEFAULT_REGION:-us-east-1}"
27+
28+
LOCAL_DIR="bench/results/${RUN_ID}"
29+
mkdir -p "$LOCAL_DIR"
30+
31+
BIN="target/release/mem_wal_fineweb_fts"
32+
if [ ! -x "$BIN" ]; then
33+
echo "building bench binary..."
34+
cargo build --release -p lance --bench mem_wal_fineweb_fts
35+
# criterion-style bench output goes to deps/; resolve it.
36+
BIN="$(ls -t target/release/deps/mem_wal_fineweb_fts-* | grep -v '\.d$' | head -1)"
37+
fi
38+
echo "using bench binary: $BIN"
39+
40+
CONFIGS=(
41+
"100000 0 0"
42+
"100000 0 1"
43+
"100000 1 0"
44+
"100000 1 1"
45+
"500000 0 0"
46+
"500000 0 1"
47+
"500000 1 0"
48+
"500000 1 1"
49+
"1000000 0 0"
50+
"1000000 0 1"
51+
"1000000 1 0"
52+
"1000000 1 1"
53+
)
54+
55+
echo "=== Run $RUN_ID =="
56+
echo " prefix: $DATASET_PREFIX"
57+
echo " base_rows: $BENCH_BASE_ROWS ingest_rows: $BENCH_INGEST_ROWS batch_size: $BENCH_BATCH_SIZE"
58+
echo ""
59+
60+
for cfg in "${CONFIGS[@]}"; do
61+
read -r MT D F <<< "$cfg"
62+
if [ "$MT" = "1000000" ]; then SZ="1M"; elif [ "$MT" = "500000" ]; then SZ="500k"; else SZ="100k"; fi
63+
NAME="mt${SZ}_durable${D}_fts${F}"
64+
OUT="$LOCAL_DIR/${NAME}.json"
65+
LOG="$LOCAL_DIR/${NAME}.log"
66+
echo ">>> $NAME"
67+
if [ -f "$OUT" ]; then
68+
echo " result already exists, skipping"
69+
continue
70+
fi
71+
set +e
72+
BENCH_RUN_ID="$RUN_ID" \
73+
DATASET_PREFIX="$DATASET_PREFIX" \
74+
BENCH_MAX_MEMTABLE_ROWS="$MT" \
75+
DURABLE_WRITE="$D" \
76+
FTS_ENABLED="$F" \
77+
BENCH_BASE_ROWS="$BENCH_BASE_ROWS" \
78+
BENCH_INGEST_ROWS="$BENCH_INGEST_ROWS" \
79+
BENCH_BATCH_SIZE="$BENCH_BATCH_SIZE" \
80+
BENCH_CACHE_DIR="${BENCH_CACHE_DIR:-/mnt/data/fineweb}" \
81+
RESULT_FILE="$OUT" \
82+
"$BIN" --bench --nocapture 2>&1 | tee "$LOG"
83+
RC=${PIPESTATUS[0]}
84+
set -e
85+
if [ "$RC" -ne 0 ]; then
86+
echo " !!! config failed (rc=$RC); see $LOG"
87+
fi
88+
# Upload to S3 alongside the dataset.
89+
if [ -f "$OUT" ]; then
90+
aws s3 cp "$OUT" "$DATASET_PREFIX/$RUN_ID/results/${NAME}.json" || true
91+
aws s3 cp "$LOG" "$DATASET_PREFIX/$RUN_ID/results/${NAME}.log" || true
92+
fi
93+
done
94+
95+
echo ""
96+
echo "=== summary ==="
97+
python3 - <<PY
98+
import glob, json, os
99+
results = []
100+
for p in sorted(glob.glob(os.path.join("$LOCAL_DIR", "*.json"))):
101+
try:
102+
with open(p) as f: r = json.load(f)
103+
results.append(r)
104+
except Exception as e:
105+
print(f" failed to read {p}: {e}")
106+
107+
print(f"{'config':30s} {'rows/s':>10} {'p95_ms':>7} {'mt_p95_ms':>10} {'cons_mean':>10}")
108+
for r in results:
109+
name = r["config_name"]
110+
tp = r["ingest"]["rows_per_sec"]
111+
p95 = r["ingest"]["put_p95_ms"]
112+
rd = r.get("read")
113+
mt = rd["mt_latency_p95_ms"] if rd else 0
114+
cm = rd["consistency_mean"] if rd else 0
115+
print(f"{name:30s} {tp:>10.0f} {p95:>7.2f} {mt:>10.2f} {cm:>10.3f}")
116+
PY
117+
118+
echo ""
119+
echo "Results:"
120+
echo " local: $LOCAL_DIR"
121+
echo " s3: $DATASET_PREFIX/$RUN_ID/results/"

rust/lance/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,5 +229,9 @@ harness = false
229229
name = "mem_wal_recall_hnsw"
230230
harness = false
231231

232+
[[bench]]
233+
name = "mem_wal_fineweb_fts"
234+
harness = false
235+
232236
[lints]
233237
workspace = true

0 commit comments

Comments
 (0)