Add write-data-frame-region for zero-copy DATA frame sending#7
Closed
jcmallery wants to merge 1 commit into
Closed
Add write-data-frame-region for zero-copy DATA frame sending#7jcmallery wants to merge 1 commit into
jcmallery wants to merge 1 commit into
Conversation
write-data-frame-region accepts a source buffer with offset and length instead of a whole octet vector. This eliminates an intermediate subseq allocation when sending large responses as multiple DATA frames. Use case: when splitting a 64KB response buffer into four 16KB DATA frames, each frame previously required: 1. (subseq buffer start (+ start 16384)) — 16KB alloc + copy 2. write-frame's replace into frame buffer — 16KB copy With write-data-frame-region, only step 2 remains (single copy from the source region directly into the frame buffer). Tested in CL-HTTP's HTTP/2 server on SBCL: 75 MB/s throughput for 10MB files, 1000 concurrent requests with zero failures.
Owner
|
Thanks for the discussion. The function is now in v2.0.5 implemented a slightly different way. |
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.
Summary
write-data-frame-regiontocore/frames/data.lispwrite-data-framebut accepts source buffer + offset + lengthsubseqallocationMotivation
When sending large HTTP/2 responses as multiple DATA frames (e.g., splitting a 64KB buffer into four 16KB frames), each frame currently requires:
(subseq buffer start (+ start 16384))— 16KB allocation + copywrite-frame'sreplaceinto the frame buffer — 16KB copyWith
write-data-frame-region, only step 2 remains (single copy directly from the source region).This eliminates ~64 MB/s of nursery consing at peak throughput in CL-HTTP's HTTP/2 server.
Testing
Tested extensively in CL-HTTP on SBCL:
API
Thank you for the excellent http2 library!
🤖 Generated with Claude Code