Repository navigation
Read CQL frames by offset instead of re-slicing the buffer - #93
Merged
Merged
Conversation
TFramedTransport copies the rest of the frame on every read, and the binary protocol reads a CQL result one 1-8 byte field at a time, so decoding an n-byte result costs O(n^2). A 4.4MB result took 3.7s to decode; ~5MB exhausts a 40s execution limit. DalFramedTransport serves reads from the frame by offset, keeping decode linear (15MB in ~1s). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
bajb
approved these changes
Nov 6, 2026
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.
Large CQL results take quadratic time to decode:
TFramedTransportcopies the rest of the frame on every read, and the pure-PHP binary protocol reads one 1–8 byte field at a time. In production, results of roughly 5MB and up hit PHP's 40smax_execution_timeinside thrift'ssubstr.DalFramedTransport, which reads the frame by offset; decode time is linear in result size.Test plan
DalFramedTransportTest: frame boundaries,readAllacross frames,putBack, unframed passthrough, framed writes, and a 2MB small-field read (failed at 8.6s on the stock transport, passes in milliseconds). Run on PHP 8.5; edge cases also checked on PHP 7.4.SELECT(4.4MB result) on a dev Cassandra 3.11: identical decoded output (md5 match), 3.74s → 0.50s.🤖 Generated with Claude Code