KOSTA/SpringBoot
MSA , 표준프레임워크 개발 가이드
놀코
2021. 9. 10. 09:57
참고 소스
https://github.com/sblee1031/Kosta/tree/main/ORACLE_DB_THEOTY/Oracle_DB_project/resttempate
GitHub - sblee1031/Kosta: KOSTA_219
KOSTA_219. Contribute to sblee1031/Kosta development by creating an account on GitHub.
github.com
넷플릭스 MSA
https://www.samsungsds.com/kr/insights/msa_and_netflix.html
넷플릭스로 알아보는 MSA
넷플릭스로 알아보는 MSA
www.samsungsds.com
[표준프레임워크]MSA_적용_개발_가이드_v1.2.0.pdf
6.21MB
기존 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를 활용한 비동기 일처리 개념