Skip to content

Cherry-pick #8957 to v1.80.x#9007

Merged
arjan-bal merged 1 commit intogrpc:v1.80.xfrom
arjan-bal:cherry-pick-8957-v1.80.x
Mar 24, 2026
Merged

Cherry-pick #8957 to v1.80.x#9007
arjan-bal merged 1 commit intogrpc:v1.80.xfrom
arjan-bal:cherry-pick-8957-v1.80.x

Conversation

@arjan-bal
Copy link
Copy Markdown
Contributor

Original PR: #8957

RELEASE NOTES:

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 arjan-bal added the Type: Performance Performance improvements (CPU, network, memory, etc) label Mar 24, 2026
@arjan-bal arjan-bal added this to the 1.80 Release milestone Mar 24, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.73%. Comparing base (bd7cd3c) to head (6e85b85).
⚠️ Report is 1 commits behind head on v1.80.x.

Additional details and impacted files
@@             Coverage Diff             @@
##           v1.80.x    #9007      +/-   ##
===========================================
- Coverage    83.35%   82.73%   -0.62%     
===========================================
  Files          410      410              
  Lines        32586    32587       +1     
===========================================
- Hits         27162    26962     -200     
+ Misses        4043     4037       -6     
- Partials      1381     1588     +207     
Files with missing lines Coverage Δ
dialoptions.go 87.09% <100.00%> (-1.98%) ⬇️
server.go 63.13% <ø> (-19.83%) ⬇️

... and 24 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@arjan-bal arjan-bal merged commit c78d26e into grpc:v1.80.x Mar 24, 2026
14 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Performance Performance improvements (CPU, network, memory, etc)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants