Server side loadbalance problem
See original GitHub issue- I have searched the issues of this repository and believe that this is not a duplicate.
- I have checked the FAQ of this repository and believe that this is not a duplicate.
Environment
- Dubbo version: 2.6.2
- Operating System version: win7
- Java version: 1.8
Step to reproduce this issue
Problem one
I want to test pseudo cluster, I create service like follow code :
public interface DemoService
{
String sayHello(String name);
}
implement service interface as follows, both loadbalance strategies are random:
@Service(timeout = 5000, loadbalance="random")
public class DemoServiceImpl implements DemoService
{
@Override
public String sayHello(String name)
{
return "Service1 -> Hello " + name;
}
}
@Service(timeout = 5000, loadbalance="random")
public class DemoServiceImpl2 implements DemoService
{
@Override
public String sayHello(String name)
{
return "Service2 -> Hello " + name;
}
}
I start one appliction to test it.
Expected Result
- random return “Service1” and “Service2” .
Actual Result
- alway return “Service2”
Problem two
change one implement loadbalance stragy as follow:
@Service(timeout = 5000, loadbalance="consistenthash")
public class DemoServiceImpl implements DemoService
{
@Override
public String sayHello(String name)
{
return "Service1 -> Hello " + name;
}
}
Expected Result
- random return “Service1” and “Service2” .
Actual Result
- alway return “Service1”
Question
I don’t know how dubbo it works. but it is very strange , it always use consistenthash stragy.
Dubbo provide client and server side loadbalance stragy , Who is at work.
As I know,dubbo has no central node coordinator, may be is client side effect. If remove server side loadblance stragy or improve it ?
could not provid unique way to use loadbalance
- Single loadbalance stragy
- Mixed loadbalance stragy
Issue Analytics
- State:
- Created 5 years ago
- Comments:21 (11 by maintainers)
Top Results From Across the Web
Server vs Client-side load balancing - LinkedIn
1. Server-side load-balancing: All backend server instances are registered with a central load balancer. A client requests this load balancer ...
Read more >Common issues when using a load balancer | Documentation
Common issues when using a load balancer · Load balancer closing silent connections · Connection pooling · Reuse TCP connection · Sticky-IP ·...
Read more >Server-side load balancer - Tutorial - takeUforward
The server-side load balancer acts as a single point of failure if it fails, all the instances of the microservice become inaccessible as...
Read more >Load balancing Spring Boot Microservices using Netflix's ...
Server side load balancer acts as a single point of failure as if it fails, all the instances of the microservice becomes inaccessible...
Read more >What Is Load Balancing? How Load Balancers Work - NGINX
If a single server goes down, the load balancer redirects traffic to the remaining online servers. When a new server is added to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@freeseawind GOT it.
notice the last attribute
timestamp
is different, it means that the two implementations both trigger the registry operation. So in the zookeeper, you can see two providers, while in the spring IOC context, it also has two implementations.The problem is that Dubbo invoker can not distinguish the two provider because their main attributes are the same. While dubbo try to find the ref in the Spring IOC context, one of the them is always selected.
I think that it is dubbo user’s responsibility to set enough info if two providers are exist in the same context.
more details can reference the
com.alibaba.dubbo.config.spring.ServiceBean
. It implementsInitializingBean
andApplicationListener
, you can know the initialization process by debuging into two methodafterPropertiesSet()
andonApplicationEvent()
.@carryxyh loadbalance parameter on provider is not a good idea. Beacause provider is interface implement, will cause problems with the mixed strategy.