Notice
Recent Posts
Recent Comments
Link
«   2024/07   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31
Archives
Today
Total
관리 메뉴

개발자일기

운영 이슈 테스트 Chaos Monkey 본문

카테고리 없음

운영 이슈 테스트 Chaos Monkey

ka0oll 2020. 3. 21. 15:42

더 자바, "코드를 테스트 하는 다양한 방법" 수강후 정리

카오스 엔지니어링 : 실제 환경 시스템의 불확실성에 대한 테스트

언제쓰냐

  • 인프라장애시 Fallback이 정상 동작하는지
  • 의존하는 api의 인프라장애시 fallback api가 정상 동작 하는지
  • 시스템 지연에 따른 알람이 정상적으로 호출되는지

Chaos Monkey

스프링 부트 어플리케이션에서 적용해볼수 있는 라이브러리
https://codecentric.github.io/chaos-monkey-spring-boot/

카오스 멍키 스프링 부트 주요 개념

공격 대상 (Watcher) : 해당 어노테이션을 가지고 있는 컴포넌트에 공격을 할수 있다.

  • @RestController
  • @Controller
  • @Service
  • @Repository
  • @Component

공격 유형 (Assaults) : 공격 대상에 다음과 같은 공격을 할수있다.

  • 응답 지연 (Latency Assault)
  • 예외 발생 (Exception Assault)
  • 애플리케이션 종료 (AppKiller Assault)
  • 메모리 누수 (Memory Assault)

spring boot Actuator과 함께 적용

 

Chaos Monkey for Spring Boot Reference Guide

Chaos Monkey for Spring Boot can be customized to your planned experiment. You can decide which attacks you want to run and which parts of your application should be attacked. Except for the Watcher, you can also influence the behavior of the Chaos Monkey

codecentric.github.io

 

적용 example

커스텀 메소드에도 와처 적용

POST /chaosmonkey/assaults

{
"level": 5, //5번에 한번
"latencyRangeStart": 2000, //최소 지연
"latencyRangeEnd": 5000, // 최대
"latencyActive": true, // 지연 기능 설정
"exceptionsActive": true, // 예외 발생
"killApplicationActive": false,
"watchedCustomServices"://커스텀 적용할 대상 ["com.example.chaos.monkey.chaosdemo.controller.HelloController.sayHello","com.example.chaos.monkey.chaosdemo.controller.HelloController.sayGoodbye"] 
}
Comments