Skip to content

When the client requests the cluster several times in a short time, it will get the same server address. #9615

@chengyj1986xxx

Description

@chengyj1986xxx

Describe the bug
When the client requests the cluster several times in a short time, it will get the same server address.
当客户端短时间内多次请求集群,会得到同一个服务器地址。

Expected behavior
When the client requests the cluster several times in a short time, it should get different server addresses randomly to achieve load balancing of the cluster.
当客户端短时间内多次请求集群,应当随机得到不同的服务器地址,以期实现集群的负载均衡。

Actually behavior
When the client requests the cluster several times in a short time, it actually gets the same server address, or several duplicate server addresses.
当客户端短时间内多次请求集群,实际上获得了同一个服务器地址,或者重复的几个服务器地址。

How to Reproduce
I'm added a method named testReqApi4 in NamingHttpClientProxyTest.java, which is obtained by modifying testReqApi3. It only modifies the last part of testReqApi3 to change the size of variable servers.
我在NamingHttpClientProxyTest.java中添加了testReqApi4方法,这个方法通过修改testReqApi3得来,只是修改了testReqApi3的最后部分,把变量servers改成多个server。
image
The execution result is as follows, and the same server is got.
执行结果如下,获得了同一个server。
image

Desktop (please complete the following information):

  • OS: [e.g. Centos]
  • Version [e.g. nacos-server 1.3.1, nacos-client 1.3.1]
  • Module [e.g. naming/config]
  • SDK [e.g. original, spring-cloud-alibaba-nacos, dubbo]

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/ClientRelated to Nacos Client SDKkind/enhancementCategory issues or prs related to enhancement.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions