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

LoadBalancedRSocketMono loose sockets on server restart #633

Closed
GusevAnton opened this issue May 15, 2019 · 2 comments · Fixed by #953
Closed

LoadBalancedRSocketMono loose sockets on server restart #633

GusevAnton opened this issue May 15, 2019 · 2 comments · Fixed by #953
Assignees
Labels
Projects
Milestone

Comments

@GusevAnton
Copy link

GusevAnton commented May 15, 2019

I have more than one server applications and I'm using LoadBalancedRSocketMono.
If I restart one of them, then all request will forward to a single node.

I've found the exception here, because new socket have zero values.

private synchronized void quickSlowestRS() {
    if (activeSockets.size() <= 1) {
      return;
    }

    WeightedSocket slowest = null;
    double lowestAvailability = Double.MAX_VALUE;
    for (WeightedSocket socket : activeSockets) {
      double load = socket.availability();
      if (load == 0.0) {
        slowest = socket;
        break;
      }
      if (socket.getPredictedLatency() != 0) {
        load *= 1.0 / socket.getPredictedLatency();
      }
      if (load < lowestAvailability) {
        lowestAvailability = load;
        slowest = socket;
      }
    }

    if (slowest != null) {
      activeSockets.remove(slowest);
    }
  }

the call is in WeightedSocket

synchronized (LoadBalancedRSocketMono.this) {
                  if (activeSockets.size() >= targetAperture) {
                    quickSlowestRS();
                    pendingSockets -= 1;
                  }
}

I think we don't need execute this method when we restart server node.

@robertroeser
Copy link
Member

Hi - we just released 0.12.2-RC3 that contained a fix for the load balancer.

@GusevAnton
Copy link
Author

Hi! I've tested again, and unfortunately caught the same result.
The first node doesn't catch request after restart.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Addons
  
Done
Development

Successfully merging a pull request may close this issue.

4 participants