Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nacos 1.x about udp push #12054

Open
moutainMan opened this issue May 3, 2024 · 6 comments
Open

Nacos 1.x about udp push #12054

moutainMan opened this issue May 3, 2024 · 6 comments
Labels
kind/question Category issues related to questions or problems

Comments

@moutainMan
Copy link

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?

@Daydreamer-ia
Copy link
Contributor

Daydreamer-ia commented May 4, 2024

每个推送到 udp 的包都带着推送时间 lastRefTime,永远应用最新的结果。但目前不推荐使用 udp 方式了,建议升级版本到 2.x (服务端和客户端)

@KomachiSion
Copy link
Collaborator

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.

@KomachiSion KomachiSion added the kind/question Category issues related to questions or problems label May 6, 2024
@moutainMan
Copy link
Author

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推送可有可无。 当然定时拉取可以保证服务状态最新

@Daydreamer-ia
Copy link
Contributor

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());
}

@moutainMan
Copy link
Author

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数组里面的内容可能会乱。

当然,这是历史问题,现在是长连接推送没毛病。

@KomachiSion
Copy link
Collaborator

所以udp推送只能算是优化, 在没有乱序没有网络故障和网络防火墙的时候,能比轮询查询更快的感知到列表变化, 但是当有乱序、故障、或udp防火墙的时候,udp不可达或达的数据有问题,会通过核心的轮询查询或者最新的正确数据。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/question Category issues related to questions or problems
Projects
None yet
Development

No branches or pull requests

3 participants