grpc 客户端报错: connection reset by peer

weixin_38058190 2019-09-20 10:29:44
在k8s 上部署golang 的 grcp 服务端,
客户端是 php grpc 扩展
问题 : 客户端 connction reset by peer 的情况 ,
利用了tcp本身的keepalive 包来保活,也修改了 net.ipv4.tcp_keepalive_time 等参数,但是还会频繁出现断连的问题,
```go
func main() {
grpcServer := grpc.NewServer(
grpc.KeepaliveParams(keepalive.ServerParameters{Time: 600 * time.Second}),
grpc.MaxConcurrentStreams(10000),
)

protoc.RegisterTServiceServer(grpcServer, new(handle.TImpl))
reflection.Register(grpcServer)

addr := startcfg.GetLisAddr()
lis, err := net.Listen("tcp4", addr)
if err != nil {
panic(err)
}

grpcServer.Serve(lis)
}
```
pod中内核参数
```shell
sysctl -a|grep tcp_keepalive
net.ipv4.tcp_keepalive_intvl = 30
net.ipv4.tcp_keepalive_probes = 10
net.ipv4.tcp_keepalive_time = 600
sysctl: reading key "net.ipv6.conf.all.stable_secret"
sysctl: reading key "net.ipv6.conf.default.stable_secret"
sysctl: reading key "net.ipv6.conf.eth0.stable_secret"
sysctl: reading key "net.ipv6.conf.lo.stable_secret"
```
机器上的 值也改了,求大佬给出一些思路
...全文
366 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
weixin_38063608 2019-09-20
  • 打赏
  • 举报
回复
服务端本省的包比较多,又经过了一曾代理,很难区分keepalive 包,并且代理也不会转发keepalive 包,不知道怎么 在client---proxy 之间保活?
weixin_38073288 2019-09-20
  • 打赏
  • 举报
回复
是连接数上去之后出现,还是少连接数的情况下也会出现?

435

社区成员

发帖
与我相关
我的任务
社区描述
其他技术讨论专区
其他 技术论坛(原bbs)
社区管理员
  • 其他技术讨论专区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧