Repository navigation
perf: drop per-request schema and stream-metadata scans on ingest - #160
Merged
Merged
Conversation
fields_mismatch scanned the schema once per field of every row. A lookup table built once per batch replaces the scan; the first field of a name still wins. It runs for batches that leave the known-scalar fast path (arrays, nested values, new fields). Benchmark by the agent that wrote it (100 fields, 400 rows, release build): 67.5M -> 12.4M instructions per batch. A differential test compares the table with the previous scan, which is kept as a test-only oracle. Written by a GLM-5.3 agent; reviewed by Claude, not re-measured. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
- ingest and post_event listed every internal stream of the tenant, locking each stream's metadata, to ask whether one named stream is internal. They now look up that stream. - The dataset field-count check built a sorted Schema to read its length. It now reads the length of the stored schema map. Benchmark by the agent that wrote the first change (64 streams, release build): 4,647 -> 539 instructions per request. The second is not measured on its own. First change written by a GLM-5.3 agent; reviewed by Claude, not re-measured. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…verhead # Conflicts: # src/handlers/http/modal/utils/ingest_utils.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Two small reductions in per-request work on the ingest path.
fields_mismatchscanned the schema once per field of every row. A lookup table built once per batch replaces the scan; the first field of a name still wins. This path runs for batches that leave the known-scalar fast path (arrays, nested values, new fields). A differential test compares the table with the previous scan, which is kept as a test-only oracle.ingestandpost_eventlisted every internal stream of the tenant, locking each stream's metadata, to ask whether one named stream is internal; they now look that stream up. The dataset field-count check built a sorted schema to read its length; it now reads the length of the stored schema map.Measured
By the agent that wrote the changes, release build. These numbers were not re-measured:
The field-count change is not measured on its own.
Verified
This branch was not tested on its own. With all six PRs of this set merged together (#156–#161):
cargo test --lib1,515 passed, 0 failed, and on a running server every one of 17 protobuf requests (15 realistic shapes filling the 10 MiB payload limit, 2 crafted) returned 200 and stored the expected number of rows, authenticated with an API key.Related
A third change from the same pass, reading the stream metadata under one lock per request, is held back: #155.
Merging
Independent of the OTLP PRs and merges cleanly with them. It conflicts with the security-hardening PR in one place, where both append tests to the same module in
ingest_utils.rs; keep both.This PR has:
🤖 Generated with Claude Code