shoyu666 commented on issue #9937:
URL: https://github.com/apache/dubbo/issues/9937#issuecomment-1126673554
- 结论
只是探针没什么问题和风险点
- 说明
从探针角度看,k8s 存活探针只是周期性的连接指定的TCP端口,用来检查容器是否正常。本质上是连接端口后再断开。
```go
if p.TCPSocket != nil {
port, err := extractPort(p.TCPSocket.Port, container)
if err != nil {
return probe.Unknown, "", err
}
host := p.TCPSocket.Host
if host == "" {
host = status.PodIP
}
klog.V(4).InfoS("TCP-Probe", "host", host, "port", port,
"timeout", timeout)
return pb.tcp.Probe(host, port, timeout)
}
```
```
func DoTCPProbe(addr string, timeout time.Duration) (probe.Result, string,
error) {
conn, err := net.DialTimeout("tcp", addr, timeout)
if err != nil {
// Convert errors to failures to handle timeouts.
return probe.Failure, err.Error(), nil
}
err = conn.Close()
if err != nil {
klog.Errorf("Unexpected error closing TCP probe socket: %v
(%#v)", err, err)
}
return probe.Success, "", nil
}
```
- 从qos服务角度看,qos服务(netty),接受连接,连接后返回一个dubbo log字符串。探针只是连接并断开,并没有发送类似 LS命令。
```
//org/apache/dubbo/qos/server/handler/QosProcessHandler.java
@Override
public void channelActive(final ChannelHandlerContext ctx) throws
Exception {
welcomeFuture = ctx.executor().schedule(new Runnable() {
@Override
public void run() {
if (welcome != null) {
ctx.write(Unpooled.wrappedBuffer(welcome.getBytes()));
ctx.writeAndFlush(Unpooled.wrappedBuffer(PROMPT.getBytes()));
}
}
}, 500, TimeUnit.MILLISECONDS);
}
```
- 扩展
上面可以看出损耗只是tcp的连接和断开连接,如果只是探测容器是否正常,也可以使用java进程,dubbo端口等等。
但是探测一个服务是否正常,一般不只是进程,端口是否正常,也就是即使进程端口正常,业务上也可能处于不正常的情况。
可以让探针探测聚合统计接口,也可以有更全面的监控平台。
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]