참고 소스
https://github.com/sblee1031/Kosta/tree/main/ORACLE_DB_THEOTY/Oracle_DB_project/resttempate
넷플릭스 MSA
https://www.samsungsds.com/kr/insights/msa_and_netflix.html
기존 EJB에서 DevOps로 개발과 운영을 함께 하는 시스템으로 바뀜.
Circuit Open이란?
Catalogs2Hystrix - application.yml
server:
port: 8081
spring:
application:
name: catalog
hystrix:
command:
default: # command Key. use 'default' for global setting.
execution:
isolation:
thread:
timeoutInMilliseconds: 500
metrics: #1분(60000)동안 최소 1회 호출 이상, 50% 이상 실패면 circuit open
rollingStats:
timeInMilliseconds: 60000
circuitBreaker:
requestVolumeThreshold: 1
errorThresholdPercentage: 50
Customers2Hystrix - CustomerController.java
package egovframework.msa.sample.controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/customers")
public class CustomerController {
int cnt=0;
@GetMapping("/{customerId}")
public String getCustomerDetail(@PathVariable String customerId) {
//timeout test
// long milli = 3*1000;
// try {
// Thread.sleep(milli);
// } catch (InterruptedException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
//
// System.out.println("request customerId :" + customerId);
// return "[Customer id = " + customerId + " at " + System.currentTimeMillis() + "]";
//exception test
// throw new RuntimeException("I/O Exception");
//circuit open test
throw new RuntimeException("I/O Exception");
}
}
Client Load Balancer - Ribbon (Catalog - Front Server --> Customer - Back Server)
LoadBalancer - Ribbon 설정
LoadBalancing 결과
Eureka
MSA개발 주의점
Kafka를 활용한 비동기 일처리 개념
'KOSTA > SpringBoot' 카테고리의 다른 글
Spring Boot에서 CORS 적용해보기 (0) | 2021.08.13 |
---|---|
cascade , mappedBy, fetch (0) | 2021.08.12 |
SpringBoot - JPA(2) (0) | 2021.08.05 |
Spring - Qualifier설정, Repboard 병합, JPA (0) | 2021.08.04 |
Spring Boot - Mybatis 설정 (0) | 2021.08.03 |