Skip to content

perf: instrument cursor collect/refill timing, reuse scan buffers#241

Closed
Keykyrios wants to merge 1 commit into
hoytech:masterfrom
Keykyrios:perf/cursor-resume-instrumentation
Closed

perf: instrument cursor collect/refill timing, reuse scan buffers#241
Keykyrios wants to merge 1 commit into
hoytech:masterfrom
Keykyrios:perf/cursor-resume-instrumentation

Conversation

@Keykyrios

Copy link
Copy Markdown

Ref: #195

Adds timing to ScanCursor::collect and DBScan refill so cursor resume cost shows up in dbScanPerf logs. Also moves moreEvents/newEventQueue from stack locals to persistent members (same idea as #198).

New log fields (only when relay.logging.dbScanPerf = true):
refills, avgRefillUs, maxRefillUs, collects, avgCollectUs, maxCollectUs

Also adds:

  • scripts/cursor_resume_bench.py — REQ latency sweep under concurrent write load
  • scripts/scan_perf_report.py — parses the enhanced log lines

How to test:

make clean && make -j4
python3 scripts/cursor_resume_bench.py --seed-events 10000 --seed-only
./strfry relay &
python3 scripts/cursor_resume_bench.py --skip-seed
python3 scripts/scan_perf_report.py relay.log

Requires pip install websockets.

Add per-collect timing to ScanCursor and per-refill timing to DBScan
so that cursor resume latency is visible in dbScanPerf logs. This makes
it possible to distinguish cold seeks (page faults after B-tree mutation)
from warm sequential iteration.

Move refillBuffer/mergeBuffer from stack locals to DBScan members to
eliminate repeated deque allocation during scan refills.

New log fields (emitted when relay.logging.dbScanPerf = true):
  refills, avgRefillUs, maxRefillUs, cursorSeeks, avgSeekUs, maxSeekUs

Add scripts/cursor_resume_bench.py for measuring REQ latency under
concurrent write load, and scripts/scan_perf_report.py for parsing
the enhanced log output.

Ref: hoytech#195
Signed-off-by: Keykyrios <mitrajitghorui@gmail.com>
@Keykyrios Keykyrios closed this May 1, 2026
@Keykyrios Keykyrios reopened this May 1, 2026
@Keykyrios Keykyrios closed this May 5, 2026
@Keykyrios Keykyrios deleted the perf/cursor-resume-instrumentation branch May 5, 2026 07:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant