dubbo icon indicating copy to clipboard operation
dubbo copied to clipboard

[Bug] Use Nacos as registry center, every diffrent registry.group eatablished it's own NamingService connection, that causes too many connections to be established

Open goto456 opened this issue 4 months ago • 4 comments

Pre-check

  • [x] I am sure that all the content I provide is in English.

Search before asking

  • [x] I had searched in the issues and found no similar issues.

Apache Dubbo Component

Java SDK (apache/dubbo)

Dubbo Version

Dubbo Java 3.2.13, JDK 8, Mac OS/Linux

Steps to reproduce this issue

In one Dubbo project use Nacos as registry center, there are several interfaces, and set different registry.group for each interface, that will established one connection to Nacos for each interface(registry.group), so it causes too many connections to be established.

I check the code in class org.apache.dubbo.registry.nacos.NacosRegistryFactory, in the method createRegistry will create a NamingService every time.

Is it neccessary to create a new NamingService every time for each different registry.group ?

some related code:

Image Image Image

What you expected to happen

Establish only one NamingService Connection for each Nacos Host,not for each registry.group

Anything else

No response

Are you willing to submit a pull request to fix on your own?

  • [x] Yes I am willing to submit a pull request on my own!

Code of Conduct

goto456 avatar Aug 07 '25 06:08 goto456

what's your dubbo.registry.register-mode? if you choose dubbo3 + nacos2.x, you'd better only use instance mode, or use zk as your registry center if you keep using interface mode.

zrlw avatar Aug 07 '25 09:08 zrlw

what's your dubbo.registry.register-mode? if you choose dubbo3 + nacos2.x, you'd better only use instance mode, or use zk as your registry center if you keep using interface mode.

I used instance mode, dubbo 3.2.13 + nacos 2.1.0

goto456 avatar Aug 08 '25 11:08 goto456

how many groups do you have? how much less will the connections number be if share connection between different registry groups?

zrlw avatar Aug 09 '25 01:08 zrlw

how many groups do you have? how much less will the connections number be if share connection between different registry groups?

There are 100+ groups in each consumer service. If it shares connection between different registry groups, it will decrease many connections.

goto456 avatar Aug 12 '25 05:08 goto456