nacos
nacos copied to clipboard
Nacos 1.x about udp push
Issue Description
In nacos 1.x version, nacos server uses udp to push changes in service status to each client. I saw that nacos client only does ACK processing and does not consider the out-of-order situation. What should I do if the udp push is out-of-order? How does the client handle it?
Describe what happened (or what feature you want)
Describe what you expected to happen
How to reproduce it (as minimally and precisely as possible)
Tell us your environment
Anything else we need to know?
每个推送到 udp
的包都带着推送时间 lastRefTime
,永远应用最新的结果。但目前不推荐使用 udp
方式了,建议升级版本到 2.x
(服务端和客户端)
udp push is an enhancement way to push data to client 1.X.
Actual 1.X client use polling way to get data as core way, and the data with the lastTime to keep the data is newest data.
udp push is an enhancement way to push data to client 1.X.
Actual 1.X client use polling way to get data as core way, and the data with the lastTime to keep the data is newest data.
你没理解我的意思,nacos server udp是可能存在乱序的,client端并没有处理乱序问题。如果乱序,意味着client本地缓存是错误的数据,所以udp推送不算优化吧,因为你无法直到udp是否乱序。udp推送可有可无。 当然定时拉取可以保证服务状态最新
udp push is an enhancement way to push data to client 1.X. Actual 1.X client use polling way to get data as core way, and the data with the lastTime to keep the data is newest data.
你没理解我的意思,nacos server udp是可能存在乱序的,client端并没有处理乱序问题。如果乱序,意味着client本地缓存是错误的数据,所以udp推送不算优化吧,因为你无法直到udp是否乱序。udp推送可有可无。 当然定时拉取可以保证服务状态最新
客户端处理了的
if (oldService.getLastRefTime() > serviceInfo.getLastRefTime()) {
NAMING_LOGGER.warn("out of date data received, old-t: " + oldService.getLastRefTime() + ", new-t: "
+ serviceInfo.getLastRefTime());
}
udp push is an enhancement way to push data to client 1.X. Actual 1.X client use polling way to get data as core way, and the data with the lastTime to keep the data is newest data.
你没理解我的意思,nacos server udp是可能存在乱序的,client端并没有处理乱序问题。如果乱序,意味着client本地缓存是错误的数据,所以udp推送不算优化吧,因为你无法直到udp是否乱序。udp推送可有可无。 当然定时拉取可以保证服务状态最新
客户端处理了的
if (oldService.getLastRefTime() > serviceInfo.getLastRefTime()) { NAMING_LOGGER.warn("out of date data received, old-t: " + oldService.getLastRefTime() + ", new-t: " + serviceInfo.getLastRefTime()); }
额,上面也只是打印呀。 再说udp乱序是由于IP层分包导致,即使你上面处理了也没用。 源码里是用一个byte数组接收,所以byte数组里面的内容可能会乱。
当然,这是历史问题,现在是长连接推送没毛病。
所以udp推送只能算是优化, 在没有乱序没有网络故障和网络防火墙的时候,能比轮询查询更快的感知到列表变化, 但是当有乱序、故障、或udp防火墙的时候,udp不可达或达的数据有问题,会通过核心的轮询查询或者最新的正确数据。