spring boot application in cluster
Asked Answered
T

4

5

I am developing a spring boot application.

Since spring boot created a .jar file for an application. I want to cluster this particular application on different server. Lets say I build a jar file and ran a project then it should run in cluster mode from number of defined servers and should be able to serve end user needs.

My jar will reside on only one server but it will be clustered across number of servers. When end user calls a web service from my spring boot app he never know from where it is getting called.

The reason behind clustering is suppose any of the server goes down in future, end user will still be able to access web services from another server. But I don't know how to make it clustered.

Can any one please give me insight on this ?

Thuggee answered 5/10, 2015 at 11:12 Comment(0)
B
3

If you want to have it clustered, you just run your Spring Boot application on multiple servers (of course, the JAR must be present on those servers, otherwise you can't run it). You would then place a loadbalancer in front of the application servers to distribute the load.

Bestraddle answered 5/10, 2015 at 12:31 Comment(8)
Hey dunni thanks for your response. Can you please share any such doc explaining this process.Thuggee
projects.spring.io/spring-cloud en.wikipedia.org/wiki/Load_balancing_(computing) nginx.org/en/docs/http/load_balancing.htmlBestraddle
There are so many projects mentioned, so which one suites my requirement according to youThuggee
You haven't specified your requirements in detail, so it's not possible to answer that. Also this problem exceeds the scope of this site. If you have a specific problem with your code, you can ask for that. However, this site is not for general purpose questions.Bestraddle
Actually i just want to cluster an application for high availability.Thuggee
How does the load balancing works when it comes to spring boot application ?Thuggee
A typical loadbalancing doesn't care, what type of application there is. It is not different to a deployment scenario with application servers like WebSphere or JBoss. The loadbalancer just spread the requests to the application instances, that are running.Bestraddle
I googled and found that there are some Netflix API like Eureka, Hystrix, Ribbon and archaius. But can not find how these terms helps to distribute request and balance load at the same time provide high reliability and availability.Thuggee
E
3

If all services you are going to expose are stateless so you only need to use load balancer in front of your nodes for ex. apache or nginx, if your services are stateful "store any state [session, store data in db]" so you have to use distributed cache or in memory data grid:

  1. for session you can use spring-session project which could used rails to store sessions.
  2. for store data in DB you need to cluster DB it self and can use distributed cache above your DB layer like Hazelcast.
Effeminize answered 17/2, 2016 at 6:52 Comment(1)
Please share any git hub link for similar architecture.Frunze
T
3

Look into spring cloud, they have used some netflix open software along with amazons to create 12 factor apps for micro services. Ideally you would need a load balancer, service registry that can help you achieve multiple instances of spring boot. I believe you have to add a dependency called eureka. Check the below link

Spring cloud

Temperament answered 29/11, 2016 at 23:25 Comment(0)
M
0

You can deploy it in cloud foundry and use autoscale function to increase your application instances.

Millstream answered 10/4, 2017 at 2:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.