I. Technologies
– Java 1.8
– Maven 3.3.9
– Spring Tool Suite – Version 3.8.1.RELEASE
– Spring Boot: 1.5.1.RELEASE
II. Load Balancer
1. Proxy Load Balancer
Advantage & Disadvantage:
- Centralized Load Balancing
- Can be bottle neck
- Single point of failure
2. Client Load Balancer
Spring Cloud Ribbon is a solution for
Client Load Balancing.
Advantage & Disadvantage:
- Decentralized Load Balancing
- No bottle neck
- Resilent
- Data can be inconsistent
III. Practice
Create 2 projects:
- a Spring Boot project for simple restful services, running at addresses:
{localhost:8090,localhost:8091,localhost:8092}
- a Spring Boot project for
Load Balancing -
Ribbon Client, running at address:
localhost:8080
Step to do:
- Create Spring Boot project for simple Restful service
- Create Spring Boot project for Ribbon client
- Config Ribbon client
- Create a Load Balancing Rest controller
- Run & check results
1. Create Spring Boot project for simple Restful service
- Using
SpringToolSuite, create a SpringBoot project. Then add
web dependency:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
- Create a simple RestController with 2 requestmappings:
More at:
https://grokonez.com/spring-framework/spring-cloud/create-client-load-balancing-spring-cloud-ribbon-spring-boot
How to create Client Load Balancing with Spring Cloud Ribbon + Spring Boot