grpc
resource_error
ai_generated
true
内部错误: grpc: 服务器上超过最大并发流数
INTERNAL: grpc: max concurrent streams exceeded on server
ID: grpc/grpc-max-concurrent-streams-exceeded
80%修复率
88%置信度
1证据数
2023-11-20首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| grpc-go 1.61.0 | active | — | — | — |
| grpc-java 1.60.0 | active | — | — | — |
| envoy 1.27.0 | active | — | — | — |
| nginx 1.25.0 | active | — | — | — |
根因分析
服务器的 HTTP/2 最大并发流限制(默认 100)已达到,新流被拒绝。
English
Server's HTTP/2 max concurrent streams limit (default 100) is reached, and new streams are rejected.
官方文档
https://grpc.io/docs/guides/performance/#flow-control解决方案
-
Increase the server's max concurrent streams limit. In gRPC-Go, use: import "google.golang.org/grpc" s := grpc.NewServer(grpc.MaxConcurrentStreams(200)) Or set environment variable GRPC_GO_MAX_CONCURRENT_STREAMS=200 before starting the server.
-
Reduce the number of long-lived streams by batching requests or using unary RPCs instead of streaming. Alternatively, add more server instances behind a load balancer to distribute streams.
无效尝试
常见但无效的做法:
-
85% 失败
The limit is on the server side per connection; client pool size doesn't affect server stream limits.
-
90% 失败
Stream count is unrelated to message size; this does not free up stream slots.