Repository navigation
Avoid speculative reads past complete Thrift responses - #632
Draft
vuanhphung wants to merge 1 commit into
Draft
vuanhphung wants to merge 1 commit into
vuanhphung wants to merge 1 commit into
Conversation
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
This branch was successfully deployed
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.
Every complete Thrift HTTP reply currently ends with a speculative read of another message header, constructing and catching
InputBufferUnderrunErroron the successful path. A warmed 20,000-statement profile attributes 232 ms to that exception's construction; an instrumented 2,000-statement run counts 2,000 exceptions on main and zero here, with identical RPC counts. This per-reply work consumes the single JS thread under concurrent short-statement load.Check the transport's borrowed read/write positions after decoding each message and stop when the buffer is exhausted. Keep the existing underrun/rollback path for truncated replies and transports without
borrow, including multi-message dispatch and callback behavior. Log output and telemetry code are unchanged. The kernel's HTTP decoder is Rust and does not use this loop.Verification: 1,812 unit tests; lint/format/type-check/build; 26 live e2e tests, none skipped; 27 main/branch typed-value checksum cases; enabled log/telemetry parity; 64-MiB heap stress. Five fresh-process runs per side, rotated A/B order; mock adds 2 ms response delay. Mock LIMIT10 at c50/20 sessions raises QPS 8.1% and lowers p99 32.16 -> 26.89 ms. Gains vary by scenario; shared-warehouse live QPS/tails are noisy and sometimes worse, so no live latency/throughput improvement is claimed.
Adversarial review: pending; this PR remains a draft.
This pull request and its description were written by Isaac.