I am working on a spring boot application.
I want to know how I can place load balancer in front of an application so that to distribute load across some number of servers.
I googled and found that there are some Netflix API like Eureka, Hystrix, Ribbon and Archaius that will help accomplish laod balancing job.
But could not found how these terminologies helps to distribute request and balance load at the same time provide high reliability and availability across all users accessing particular service.
I am going though all these but can not find out entry point to startup. Actually I am not getting from where to start.
You can use HAProxy
You can run it on your server with your own configuration file, for example:
global
daemon
maxconn 256
defaults
mode tcp
timeout connect 5000ms
listen http-in
timeout client 180s
timeout server 180s
bind 127.0.0.1:80
server server1 157.166.226.27:8080 maxconn 32 check
server server2 157.166.226.28:8080 maxconn 32 check
server server3 157.166.226.29:8080 maxconn 32 check
server server4 157.166.226.30:8080 maxconn 32 check
server server5 157.166.226.31:8080 maxconn 32 check
server server6 157.166.226.32:8080 maxconn 32 check
This will allow every http request arriving on port 80 of local host to be distributed across listed servers, using round robin algorithm. For details, please see HAProxy documentation.
Understanding that your application is offering REST services I suggest you do not pursue looking into Netflix API. It is great but it will not help you for your use case. I suggest you have a look at ha-proxy, nginx or httpd for simple load balancing capabilities. Good part is that you don't have to look into session stickiness since REST is stateless per default.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With