Skip to content
This repository was archived by the owner on Nov 21, 2026. It is now read-only.

benchmarks: served ArcadeDB time-series arms read query results as streamed NDJSON, behind BENCH_ARCADEDB_TS_NDJSON=1 (default off) - #293

Merged
tae898 merged 1 commit into
mainfrom
issue/ts-ndjson
Oct 8, 2026
Merged

tae898 merged 1 commit into
mainfrom
issue/ts-ndjson

Conversation

@tae898

@tae898 tae898 commented Oct 8, 2026 •

Copy link
Copy Markdown

The PostgreSQL (psycopg) and MongoDB (cursor) time-series arms read rows as their server sends them. The two served ArcadeDB time-series arms (arcadedb_ts_doc_server, arcadedb_ts_native_server) asked for one buffered JSON answer, which the server builds whole before the first byte (393k rows, about 20 MB, on the high-usage query at ts1000). ArcadeDB 26.10.1 answers Accept: application/x-ndjson on POST /api/v1/query/<db> with a chunked body of {"record": ...} lines and a last {"stats": {"returned": N}} line. Measured on 26.10.1 (d36b4ca) with the lane's own query texts, the streamed read of the high-usage query took 0.86x (document arm) and 0.82x (native arm) of the buffered call's time, with identical answers.

This adds BENCH_ARCADEDB_TS_NDJSON=1, default off, following the BENCH_DENSE_ID_INDEX pattern (#292):

  • lean_http.post_ndjson sends the Accept header through whichever session the lane runs (lean, lean2, or requests), reads the de-chunked body, parses all lines in one json.loads, and raises NdjsonError when stats.returned does not match the records read, when the stats line is missing, or when a line is neither a record nor the stats line (so a buffered answer is never mistaken for a stream).
  • l4_tsbs.py: both served arms use it for every _post("query", ...) when the switch is on, and their rows stamp arcadedb_ts_result_format: "ndjson". Unset, the request, the answer path, and the row fields are what they were. Any value other than 1 is refused.
  • overrides.py entry ts_ndjson, PROTOCOL.md section 7 row (with the fairness note: the PostgreSQL and MongoDB arms already stream, and buffered JSON stays available as a labelled sensitivity run), CAMPAIGN.md section 7 row 85, RESULTS-MAP field list, page_check NOT_PRINTED entry, and runner forwarding into the lane container.
  • /next: while served ArcadeDB time-series rows lack the stamp, one sentence under the time-series table says those arms read each answer only after the server has built all of it, and a next-measurement line says the next measurement reads ArcadeDB's served time-series results as a stream, as the other served engines do.

Tests: test_ts_ndjson.py (12 tests) covers the parser and its count check, the header on the wire and the chunked body through lean and lean2 against a local stub server, the unset path unchanged with no row field, the set path stamped and parsed, a stats mismatch raising, the override registry, runner forwarding, and the /next sentence and next-measurement line keyed on unstamped rows. The whole benchmarks/experiments suite passes (640 passed, 13 skipped).

Smoke (no timed A/B): runner.py, lane l4, both served ArcadeDB time-series arms at ts100, sweep tier, one worker on cores 4-7, official 26.10.1 server image, once with the switch off and once on. All six query answer digests are identical between the two runs for both arms, the high-usage query returns 32,944 rows in both, the on rows carry arcadedb_ts_result_format: "ndjson", and the off rows have no such field.

🤖 Generated with Claude Code

…reamed NDJSON, behind BENCH_ARCADEDB_TS_NDJSON=1 (default off)

The PostgreSQL (psycopg) and MongoDB (cursor) arms read rows as their server sends them; the two served ArcadeDB time-series arms asked for one buffered JSON answer, which the server builds whole before sending. With the switch on, both arms send Accept: application/x-ndjson on every query and read the record lines and the last stats line through lean_http.post_ndjson, which checks stats.returned against the records read, and their rows stamp arcadedb_ts_result_format = ndjson. Unset, nothing changes. /next says the served ArcadeDB arms read a buffered answer while the rows lack the stamp, and the next-measurement list says the next measurement reads them as a stream. Registered in overrides.py, PROTOCOL.md section 7, CAMPAIGN.md row 85.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WQegLio3qLR2dE6gBFhRK6
@tae898
tae898 merged commit 596add8 into main Oct 8, 2026
2 checks passed
@tae898
tae898 deleted the issue/ts-ndjson branch October 8, 2026 13:15
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant