You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brpc.apache.org by GitBox <gi...@apache.org> on 2022/08/17 19:55:22 UTC
[GitHub] [incubator-brpc] zyearn opened a new issue, #1895: Support TCP heartbeat to support the case that brpc client unaware of servers' down
zyearn opened a new issue, #1895:
URL: https://github.com/apache/incubator-brpc/issues/1895
Brpc already have the feature to close fd when it's idle, but it lack the same feature for clients.
This new feature can make clients close fd when servers are turned down unexpectedly(no FIN sent).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
[GitHub] [incubator-brpc] zyearn commented on issue #1895: Support TCP heartbeat to support the case that brpc client unaware of servers' down
Posted by GitBox <gi...@apache.org>.
zyearn commented on issue #1895:
URL: https://github.com/apache/incubator-brpc/issues/1895#issuecomment-1221378212
> 可以通过给客户端socket设置SO_KEEPALIVE参数来实现。开启keepalive操作系统会来探活然后关闭已经断开的socket。
>
> ```c++
> if (setsockopt(client_fd, SOL_SOCKET, SO_KEEPALIVE, &val, sizeof(val)) < 0) {
> ...
> }
> ```
>
> 对代码侵入性比较小。另外可以把把TCP_KEEPIDLE、TCP_KEEPINTVL、TCP_KEEPCNT三个socket选项的值提供给Channel设置。 让用户自定义探活动时间
>
> ```c++
> if (setsockopt(client_fd, IPPROTO_TCP, TCP_KEEPIDLE, &val1, sizeof(val1)) < 0) {
> ...
> }
> if (setsockopt(cliend_fd, IPPROTO_TCP, TCP_KEEPINTVL, &val2, sizeof(val2)) < 0) {
> ...
> }
> if (setsockopt(, IPPROTO_TCP, TCP_KEEPCNT, &val3, sizeof(val3)) < 0) {
> ...
> }
> ```
>
> 不设置的时候会走系统中对应的配置:
>
> ```shell
> cat /proc/sys/net/ipv4/tcp_keepalive_time
> 7200
>
> cat /proc/sys/net/ipv4/tcp_keepalive_intvl
> 75
>
> cat /proc/sys/net/ipv4/tcp_keepalive_probes
> 9
> ```
>
> 2个小时以后会被操作系统关闭。
嗯是这个思路。
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
Re: [I] Support TCP heartbeat to support the case that brpc client unaware of servers' down (brpc)
Posted by "chenBright (via GitHub)" <gi...@apache.org>.
chenBright commented on issue #1895:
URL: https://github.com/apache/brpc/issues/1895#issuecomment-2487196184
可以看看[熔断功能](https://github.com/apache/brpc/blob/master/docs/cn/circuit_breaker.md)。
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
Re: [I] Support TCP heartbeat to support the case that brpc client unaware of servers' down (brpc)
Posted by "yanglimingcn (via GitHub)" <gi...@apache.org>.
yanglimingcn commented on issue #1895:
URL: https://github.com/apache/brpc/issues/1895#issuecomment-2482319125
有个场景我想再问一下,如果客户单给服务端发送的请求会被路由器drop掉,但是在tcp层面上这个socket是好的,bRPC现在会是什么行为呢?@chenBright
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
[GitHub] [incubator-brpc] guodongxiaren commented on issue #1895: Support TCP heartbeat to support the case that brpc client unaware of servers' down
Posted by GitBox <gi...@apache.org>.
guodongxiaren commented on issue #1895:
URL: https://github.com/apache/incubator-brpc/issues/1895#issuecomment-1221225264
可以通过给客户端socket设置SO_KEEPALIVE参数来实现。开启keepalive操作系统会来探活然后关闭已经断开的socket。
```cpp
if (setsockopt(client_fd, SOL_SOCKET, SO_KEEPALIVE, &val, sizeof(val)) == -1) {
...
}
```
对代码侵入性比较小。另外可以把把TCP_KEEPIDLE、TCP_KEEPINTVL、TCP_KEEPCNT三个socket选项的值提供给Channel设置。
让用户自定义探活动时间
```cpp
if (setsockopt(client_fd, IPPROTO_TCP, TCP_KEEPIDLE, &val1, sizeof(val)) < 0) {
...
}
if (setsockopt(cliend_fd, IPPROTO_TCP, TCP_KEEPINTVL, &val2, sizeof(val)) < 0) {
...
}
if (setsockopt(, IPPROTO_TCP, TCP_KEEPCNT, &val, sizeof(val3)) < 0) {
...
}
```
不设置的时候会走系统中对应的配置:
```bash
cat /proc/sys/net/ipv4/tcp_keepalive_time
7200
cat /proc/sys/net/ipv4/tcp_keepalive_intvl
75
cat /proc/sys/net/ipv4/tcp_keepalive_probes
9
```
2个小时以后会被操作系统关闭。
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
Re: [I] Support TCP heartbeat to support the case that brpc client unaware of servers' down (brpc)
Posted by "chenBright (via GitHub)" <gi...@apache.org>.
chenBright commented on issue #1895:
URL: https://github.com/apache/brpc/issues/1895#issuecomment-2486098708
> 有个场景我想再问一下,如果客户单给服务端发送的请求会被路由器drop掉,但是在tcp层面上这个socket是好的,bRPC现在会是什么行为呢?@chenBright
@yanglimingcn RPC超时。
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
Re: [I] Support TCP heartbeat to support the case that brpc client unaware of servers' down (brpc)
Posted by "yanglimingcn (via GitHub)" <gi...@apache.org>.
yanglimingcn commented on issue #1895:
URL: https://github.com/apache/brpc/issues/1895#issuecomment-2487136066
> > 有个场景我想再问一下,如果客户单给服务端发送的请求会被路由器drop掉,但是在tcp层面上这个socket是好的,bRPC现在会是什么行为呢?@chenBright
>
> @yanglimingcn RPC超时。
RPC超时了,bRPC看上去不会认为这个socket有问题,会继续使用这个socket做重试?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
Re: [I] Support TCP heartbeat to support the case that brpc client unaware of servers' down (brpc)
Posted by "chenBright (via GitHub)" <gi...@apache.org>.
chenBright commented on issue #1895:
URL: https://github.com/apache/brpc/issues/1895#issuecomment-1525308719
> 这个啥时候发pr
@yanglimingcn 已合入到master
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
[GitHub] [incubator-brpc] yanglimingcn commented on issue #1895: Support TCP heartbeat to support the case that brpc client unaware of servers' down
Posted by GitBox <gi...@apache.org>.
yanglimingcn commented on issue #1895:
URL: https://github.com/apache/incubator-brpc/issues/1895#issuecomment-1335170504
这个啥时候发pr
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
Re: [I] Support TCP heartbeat to support the case that brpc client unaware of servers' down (brpc)
Posted by "wumuzi520 (via GitHub)" <gi...@apache.org>.
wumuzi520 commented on issue #1895:
URL: https://github.com/apache/brpc/issues/1895#issuecomment-1512720109
如果Client和Server端有连接,但长时间没发送数据,Server端会主动关闭这个连接么?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
Re: [I] Support TCP heartbeat to support the case that brpc client unaware of servers' down (brpc)
Posted by "chenBright (via GitHub)" <gi...@apache.org>.
chenBright commented on issue #1895:
URL: https://github.com/apache/brpc/issues/1895#issuecomment-1512761975
> 如果Client和Server端有连接,但长时间没发送数据(Server还活着),Server端会主动关闭这个连接么?
brpc server支持关闭空闲连接
https://github.com/apache/brpc/blob/435b5120cb26992d0d7789d959e75135d72cb52e/src/brpc/server.h#L58-L64
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
Re: [I] Support TCP heartbeat to support the case that brpc client unaware of servers' down (brpc)
Posted by "chenBright (via GitHub)" <gi...@apache.org>.
chenBright closed issue #1895: Support TCP heartbeat to support the case that brpc client unaware of servers' down
URL: https://github.com/apache/brpc/issues/1895
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org