Piyush Raghuwanshi
Piyush Raghuwanshi

Reputation: 47

how to variable (Ratio) load balance using Ribbon spring boot?

As I distributed similar instance to two different servers, my first server has good configuration but the second server have not enough memory for cache. So I want 80% of the requests being transfered to my first server and the remaining to the second server. How can I configure this using ribbon with spring boot?

Currently, it is working on round robin algorithm. the first request goes on first server and second go on the second one. I want to configure into 4:1.

Upvotes: 2

Views: 136

Answers (1)

humbaba
humbaba

Reputation: 328

Ribbon offers some prebuilt rules as documented here: https://github.com/Netflix/ribbon/wiki/Working-with-load-balancers

I think WeightedResponseTimeRule can be suitable in your case. Instead of statically defining a ratio, let Ribbon decide depending on the response times of the servers.

Or, you can define your custom rule as described here: Ribbon load balance algorithms

Upvotes: 4

Related Questions