grpc: Enable shared write buffers by default#8957
Merged
arjan-bal merged 2 commits intogrpc:masterfrom Mar 9, 2026
Merged
Conversation
6744c60 to
e690776
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #8957 +/- ##
==========================================
- Coverage 83.42% 82.62% -0.80%
==========================================
Files 410 410
Lines 32572 32573 +1
==========================================
- Hits 27172 26914 -258
- Misses 4030 4065 +35
- Partials 1370 1594 +224
🚀 New features to boost your workflow:
|
easwars
approved these changes
Mar 6, 2026
Contributor
easwars
left a comment
There was a problem hiding this comment.
Can we have a single release note that mentions the details for both client and server instead of two separate ones. Thanks.
2 tasks
arjan-bal
added a commit
to arjan-bal/grpc-go
that referenced
this pull request
Mar 24, 2026
gRPC is already using pooled buffers extensively. These write buffers can hold more than 20% of the "in use" memory when using LB policies like roundrobin, least request etc. The pools help releasing the memory when a subchannel is inactive. ## Benchmarks There is no significant performance difference in the local benchmarks. Before ``` go1.24.13/grpc1.80.0-dev streaming-networkMode_Local-bufConn_true-keepalive_false-benchTime_2m0s-trace_false-latency_0s-kbps_0-MTU_0-maxConcurrentC alls_120-reqSize_1024B-respSize_1024B-compressor_off-channelz_false-preloader_false-clientReadBufferSize_-1-clientWriteBuf ferSize_-1-serverReadBufferSize_-1-serverWriteBufferSize_-1-sleepBetweenRPCs_0s-connections_1-recvBufferPool_simple-shared WriteBuffer_false: 50_Latency: 344.0650µs 90_Latency: 478.0550µs 99_Latency: 884.7730µs Avg_Latency: 354.6700µs Bytes/op: 4964.3704955955A llocs/op: 19.35011915747468 Histogram (unit: µs) Count: 40403676 Min: 9.7 Max: 213729.4 Avg: 354.67 ------------------------------------------------------------ [ 9.742000, 9.743000) 1 0.0% 0.0% [ 9.743000, 9.750424) 0 0.0% 0.0% [ 9.750424, 9.812970) 0 0.0% 0.0% [ 9.812970, 10.339881) 3 0.0% 0.0% [ 10.339881, 14.778782) 1522 0.0% 0.0% [ 14.778782, 52.173796) 39748 0.1% 0.1% [ 52.173796, 367.203851) 23974441 59.3% 59.4% ###### [ 367.203851, 3021.138790) 16383483 40.5% 100.0% #### [ 3021.138790, 25378.912455) 3968 0.0% 100.0% [ 25378.912455, 213729.439000) 509 0.0% 100.0% [ 213729.439000, 1800467.071380) 1 0.0% 100.0% Number of requests: 40403676 Request throughput: 2.7582242816e+09 bit/s Number of responses: 40403676 Response throughput: 2.7582242816e+09 bit/s ``` After ``` go1.24.13/grpc1.80.0-dev streaming-networkMode_Local-bufConn_true-keepalive_false-benchTime_2m0s-trace_false-latency_0s-kbps_0-MTU_0-maxConcurrentC alls_120-reqSize_1024B-respSize_1024B-compressor_off-channelz_false-preloader_false-clientReadBufferSize_-1-clientWriteBuf ferSize_-1-serverReadBufferSize_-1-serverWriteBufferSize_-1-sleepBetweenRPCs_0s-connections_1-recvBufferPool_simple-shared WriteBuffer_true: 50_Latency: 346.4820µs 90_Latency: 478.2350µs 99_Latency: 695.2270µs Avg_Latency: 353.1640µs Bytes/op: 4972.45957928533 5 Allocs/op: 19.64101560175674 Histogram (unit: µs) Count: 40619977 Min: 10.1 Max: 74013.3 Avg: 353.16 ------------------------------------------------------------ [ 10.103000, 10.104000) 1 0.0% 0.0% [ 10.104000, 10.110488) 0 0.0% 0.0% [ 10.110488, 10.159069) 2 0.0% 0.0% [ 10.159069, 10.522840) 5 0.0% 0.0% [ 10.522840, 13.246726) 612 0.0% 0.0% [ 13.246726, 33.642970) 15498 0.0% 0.0% [ 33.642970, 186.368403) 2763883 6.8% 6.8% # [ 186.368403, 1329.964187) 37638929 92.7% 99.5% ######### [ 1329.964187, 9893.117609) 200384 0.5% 100.0% [ 9893.117609, 74013.323000) 662 0.0% 100.0% [ 74013.323000, 554140.273508) 1 0.0% 100.0% Number of requests: 40619977 Request throughput: 2.772990429866667e+09 bit/s Number of responses: 40619977 Response throughput: 2.772990429866667e+09 bit/s ``` RELEASE NOTES: * grpc: Enable shared write buffers by default. Use the the [WithSharedWriteBuffer](https://pkg.go.dev/google.golang.org/grpc#WithSharedWriteBuffer) dial option or the [SharedWriteBuffer](https://pkg.go.dev/google.golang.org/grpc#SharedWriteBuffer) server option to disable it.
arjan-bal
added a commit
that referenced
this pull request
Mar 24, 2026
Original PR: #8957 RELEASE NOTES: * grpc: Enable shared write buffers by default. Use the [WithSharedWriteBuffer](https://pkg.go.dev/google.golang.org/grpc#WithSharedWriteBuffer) dial option or the [SharedWriteBuffer](https://pkg.go.dev/google.golang.org/grpc#SharedWriteBuffer) server option to disable it.
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.
gRPC is already using pooled buffers extensively. These write buffers can hold more than 20% of the "in use" memory when using LB policies like roundrobin, least request etc. The pools help releasing the memory when a subchannel is inactive.
Benchmarks
There is no significant performance difference in the local benchmarks.
Before
After
RELEASE NOTES: