Load Balancer not refreshing newly added nodes.
See original GitHub issueI am working on a use case to bring up server nodes that gets added to LoadBalancedRSocketMono
. Server nodes when they come up or goes down will register itself to a collection which is streamed to LoadBalancedRSocketMono
. But LoadBalancedRSocketMono
works only on the first registered server node when the create
method was called. Below is the sample snippet. I was raising this question in community.netifi.com till last week and site is down for now. Can you please help me understand what I am doing wrong or is this a bug?
package com.rsocket.server;
import io.rsocket.Payload;
import io.rsocket.RSocketFactory;
import io.rsocket.client.LoadBalancedRSocketMono;
import io.rsocket.client.filter.RSocketSupplier;
import io.rsocket.transport.netty.client.TcpClientTransport;
import io.rsocket.util.DefaultPayload;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import java.util.stream.BaseStream;
import java.util.stream.Collectors;
public class DynamicLBClient {
public static void main(String[] args) {
DynamicLBClient dynamicLBClient = new DynamicLBClient();
dynamicLBClient.callLB();
}
private void callLB() {
int[] server1 = new int[] {9000};
int[] server2 = new int[] {9001};
Set<Set<RSocketSupplier>> suppliers = new HashSet<>();
suppliers.add(Arrays.stream(server1)
.mapToObj(port -> new RSocketSupplier(() -> Mono.just(RSocketFactory
.connect()
.transport(TcpClientTransport.create("localhost", port))
.start().doOnSubscribe(s -> System.out.println("RSocket connection established." + s))
.block())))
.collect(
Collectors.toSet()));
LoadBalancedRSocketMono balancer = LoadBalancedRSocketMono
.create(Flux.fromStream(suppliers.stream()));
Mono<Payload> monoPayload = balancer.block().requestResponse(DefaultPayload.create("test-request"));
Payload server1Payload = monoPayload.block();
System.out.println("Response Received Server 1---->" + server1Payload.getDataUtf8());
suppliers.add(Arrays.stream(server2)
.mapToObj(port -> new RSocketSupplier(() -> Mono.just(RSocketFactory
.connect()
.transport(TcpClientTransport.create("localhost", port))
.start().doOnSubscribe(s -> System.out.println("RSocket connection established." + s))
.block())))
.collect(
Collectors.toSet()));
Mono<Payload> server2Mono = balancer.log().block().requestResponse(DefaultPayload.create("test-request-second-server"));
Payload server2Payload = server2Mono.block();
System.out.println("Response Received- Server 2 --->" + server2Payload.getDataUtf8());
}
}
Below lines have to be called again
in order for the new server node to service the calls:
balancer = LoadBalancedRSocketMono
.create(Flux.fromStream(suppliers.stream()));
Issue Analytics
- State:
- Created 4 years ago
- Comments:12 (6 by maintainers)
Top Results From Across the Web
Content not updating after adding new nodes to the Load ...
To restart all nodes at the same time: 1. Re-save the web.config file on one node. - Do not access the website on...
Read more >Nodebalancer not updated when adding new nodes to the ...
When adding/removing nodes in a cluster, existing Nodebalancer endpoints should be updated to reflect the change.
Read more >Troubleshoot your Network Load Balancer
The following information can help you troubleshoot issues with your Network Load Balancer. A registered target is not in service. If a target...
Read more >Cloud Load Balancers troubleshooting - - Rackspace
If a load balancer suddenly stops working, it might be due to changes on the nodes attached to the load balancer. Review recent...
Read more >Troubleshoot External HTTP(S) Load Balancing - Google Cloud
Compression isn't working ... HTTP(S) Load Balancing does not compress or decompress responses itself, but it can serve responses generated by your backend ......
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
@pckeyan feel free to open a new issue if you spot any other problems related to the new implementation
Yeah. This is a bug. So it is not a future but rather a bug so it should be fixed