RSocket LoadBalancing does not seem to work with Spring Boot.
See original GitHub issueHi @OlegDokuka
I was looking at this example and it works just fine.
I was trying to implement this with Spring Boot. However it seems to always use the first instance it connects to.
I have a project here. I also have provided the steps as part of README https://github.com/vinsguru/rsocket-load-balancing
Server-App:
- Navigate to server-app cd server-app
- Build the jar mvn clean package
- Run 2 instances of this app as shown below.
java -jar -Dspring.rsocket.server.port=6565 target/server-app-0.0.1-SNAPSHOT.jar
java -jar -Dspring.rsocket.server.port=6566 target/server-app-0.0.1-SNAPSHOT.jar
Client-app
-
application.yaml - by default uses the above server instance details - localhost:6565 and localhost:6566
-
Runt the main application.
-
Check the server console output. Only one of the instance is processing all the requests!!
Does it require any other config?
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
spring boot - rsocket - how to balance the load - Stack Overflow
1 Answer 1 ... There are two options for this: use low-level load balancer on client side from rsocket-load-balancer; deploy RSocket broker ...
Read more >RSocket Load Balancing - Client Side - Vinsguru
Learn Spring RSocket Load Balancing from client side to distribute the rsocket requests among multiple servers.
Read more >Getting Started With RSocket: Spring Boot Server
Step 3: Start The Spring Boot RSocket Server Alternatively, you can use the “Build” and “Run” commands in your Java IDE if you...
Read more >the Reactive Revolution:RSocket and Spring Cloud Gateway
Spring is adding support for RSocket, it's coming in Spring 5.2. There's already been one or two milestones of framework, Spring Boot will...
Read more >Communication With RSocket – Abstraction Over ... - Grape Up
The second available solution, which provides an abstraction over the RSocket is the integration with Spring Boot. Here we use RSocket as a...
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
@vinsguru the problem is still in configuration
As it was mentioned in the stackoverflow answer, the
LoadbalanceTarget
has 1 important parameter which iskey
usingkey
the RSocketPool is capable of making difference between given targets and identify which target is new and which has already been there. In your setup, you always use thelocalhost
as a key, hence for RSocketPool all the new LoadbalancerTargets seemed to be the same as before, and therefore you observed traffic to only a single target.Also, please note, that if one of the targets disappears, your connection will be immediately disposed (that is something that we have to improve) which means if the connection is still alive and has ongoing traffic, that traffic will be immediately interrupted and your request will be signaled with
onError
. To fix that, I suggest putting extra retry logic. For example:You are welcome @vinsguru. And no worries!