fix: configure HTTP/2 maxStreams=1 to prevent bidi stream starvation#10
Merged
Conversation
Without explicit HTTP/2 configuration, the AWS SDK multiplexes all bidirectional streams over a small number of TCP connections (~2x CPU cores). For real-time audio streaming, this causes streams to starve each other -- audio chunks queue behind other streams' data in Netty's HTTP/2 multiplexer, leading to backpressure overflow and transcription failures under concurrent load. Configure NettyNioAsyncHttpClient with: - maxStreams(1): one bidirectional stream per TCP connection, ensuring each stream's audio data flows without contention - maxConcurrency(500): allow up to 500 simultaneous TCP connections in the shared pool - protocol(HTTP2): explicitly set (was implicit via the SDK) Validated with a load test sustaining 400 concurrent bidi streams (0 errors, 0 retries). Without this fix, the same test produces 0 successful transcriptions due to stream starvation. Callers needing custom HTTP/2 settings can still use the existing SageMakerTransportFactory(config, smClient) constructor with a pre-configured client. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
GregHolmes
approved these changes
Apr 13, 2026
lukeocodes
approved these changes
Apr 13, 2026
lukeocodes
added a commit
that referenced
this pull request
Apr 13, 2026
🤖 I have created a release *beep* *boop* --- ## [0.1.1](v0.1.0...v0.1.1) (2026-04-13) ### Bug Fixes * configure HTTP/2 maxStreams=1 to prevent bidi stream starvation ([29dc4b8](29dc4b8)) * configure HTTP/2 maxStreams=1 to prevent bidi stream starvation ([#10](#10)) ([da68ffc](da68ffc)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
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
NettyNioAsyncHttpClientwithHttp2Configuration.maxStreams(1L)to force one bidirectional stream per TCP connectionmaxConcurrency(500)to support up to 500 simultaneous connections in the shared poolProtocol.HTTP2Problem
Without explicit HTTP/2 configuration, the AWS SDK multiplexes all bidirectional streams over a small number of TCP connections (~2x CPU cores). For real-time audio streaming, this causes streams to starve each other -- audio chunks queue behind other streams' data in Netty's HTTP/2 multiplexer, leading to backpressure overflow and transcription failures under concurrent load.
Validation
Load tested with 400 concurrent bidirectional streams against a single SageMaker endpoint:
Backwards Compatibility
Callers needing custom HTTP/2 settings can still use the existing
SageMakerTransportFactory(config, smClient)constructor with a pre-configured client.Test plan
🤖 Generated with Claude Code