Cloud Architecture
Circuit Breaking
백셀건전지
2022. 6. 14. 17:03
- 하나의 서비스가 장애가 발생하게 되면 장애 서비스를 호출하는 서비스는 대기 상태가 되고, 다시 대기중인 서비스를 호출하는 또 다른 서비스도 대기하게 되어 장애가 차례대로 전파됨
- 이런 현상이 서비스간에 연쇄적으로 발생하지 않게 하기 위한 기능이 Circuit Breaker
- 탄력적인 microservice architecture를 구성하기 위한 중요한 패턴
- istio에서는 destination rule로 구현 가능
$ kubectl apply -f - <<EOF
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: httpbin
spec:
host: httpbin
trafficPolicy:
connectionPool:
tcp:
maxConnections: 1
http:
http1MaxPendingRequests: 1
maxRequestsPerConnection: 1
outlierDetection:
consecutive5xxErrors: 1
interval: 1s
baseEjectionTime: 3m
maxEjectionPercent: 100
EOF
- maxConnection:1 과 http1MaxPendingRequest:1 옵션으로 1개 이상의 connection이 지속적으로 들어오게 되면, istio-proxy 컨테이너가 circuit을 열어서 추가적인 요청이나 연결을 끊게 된다.