question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

@ulinkwo @justinmclean @lonre @ke4qqq @gmcdonald @carryxyh

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:21 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
lexburnercommented, Sep 4, 2018

@freeseawind GOT it.

dubbo://172.19.6.139:20881/github.freeseawind.service.DemoService?anyhost=true&application=provider-test&dubbo=2.6.2&generic=false&interface=github.freeseawind.service.DemoService&loadbalance=random&methods=sayHello&pid=3527&side=provider&timeout=5000&timestamp=1536031418472,
dubbo://172.19.6.139:20881/github.freeseawind.service.DemoService?anyhost=true&application=provider-test&dubbo=2.6.2&generic=false&interface=github.freeseawind.service.DemoService&loadbalance=random&methods=sayHello&pid=3527&side=provider&timeout=5000&timestamp=1536031419012

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 implements InitializingBean and ApplicationListener, you can know the initialization process by debuging into two method afterPropertiesSet() and onApplicationEvent().

0reactions
freeseawindcommented, Sep 4, 2018

@carryxyh loadbalance parameter on provider is not a good idea. Beacause provider is interface implement, will cause problems with the mixed strategy.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found