Chaos Toolkit 을 이용한 카오스 엔지니어링(Chaos Engineering)

Chaos Toolkit 을 이용한 카오스 엔지니어링(Chaos Engineering)
데보션 (DEVOCEAN) 기술 블로그 , 개발자 커뮤니티이자 내/외부 소통과 성장 플랫폼
프롤로그
- 시스템의 모든 기능이 다른 기능들과 상호작용하는 것을 확인하기 위한 테스트
- 테스트 수행 방법
- 요구사항을 분석한다.
- 이를 바탕으로 테스트 케이스를 작성해야 한다.
- 테스트 케이스를 수행하여 시스템의 모든 기능들이 다른 기능들과 상호작용하는 것을 확인한다.
- 교차 기능 요구사항의 종류로는 다양한 것이 있다. 이 중, 신뢰성 검증은 소프트웨어의 일관성, 내결함성, 복구 가능성 품질 특성에 대해 스트레스 테스트, 카오스 엔지니어링, 인프라 테스트를 수행한다.
카오스 엔지니어링
고의적이고 통제된 실패를 유발하여 그 영향을 이해하고 더 나은 방어 자세와 사건 유지 관리 전략을 계획 → 장애나 중단이 조직의 추진력을 늦추고 다운타임이 증가함에 따라 소중한 시간을 소비하는 것을 방지하기 위해 중요
- 사용 시스템이 갑자기 발생한 장애 상황을 견딜 수 있는지 시스템 능력에 대한 신뢰를 확보하기 위해 분산 시스템에서 수행하는 훈련
- 시스템 중단, 장애, 재해가 발생했을 때 SW의 결함을 발견하는 방법, 클라우드 시스템 같은 대규모 시스템에 유용
- 임의로 장애 상황을 만들어 현상을 파악하는 방식
- 네트워크 문제, 하드웨어 장애, 트래픽 부하, 서비스 문제 등의 외부 요인
- 소프트웨어 자체 결함 등의 내부 요인
- 목적
- 기본 원칙
- 정상 상태 정의: 시스템이 “정상”일 때의 기준을 설정.
- 가설 설정: 시스템은 특정 실패에도 정상 상태를 유지할 것이라는 가설 수립.
- 실험 주입: 네트워크 지연, 인스턴스 중단, 디스크 고갈 등 다양한 실패를 시뮬레이션.
- 결과 분석: 가설이 유지되는지 확인하고 문제를 개선.
Chaos Toolkit
- 카오스 실험 정의를 가져와 대상 시스템에 대한 실험을 조정
- YAML 또는 JSON으로 실험 정의를 작성


- Discover
- Init
- Run
- Report

카오스 툴킷 실습
Learning Chaos Engineering
Chapter 4. Getting Tooled Up for Automated Chaos Engineering Automated chaos experiments give you the power to potentially explore system weaknesses at any time. There are many turbulent condition–inducing tools … - Selection from Learning Chaos Engineering [Book]

community-playground/learning-chaos-engineering-book-samples/chapter5 at master · chaostoolkit-incubator/community-playground
Contains the Chaos Toolkit Community Playground Project - chaostoolkit-incubator/community-playground
service.py
# -*- coding: utf-8 -*- from datetime import datetime import io import time import threading from wsgiref.validate import validator from wsgiref.simple_server import make_server EXCHANGE_FILE = "./exchange.dat" def update_exchange_file(): """ Writes the current date and time every 10 seconds into the exchange file. The file is created if it does not exist. """ print("Will update to exchange file") while True: with io.open(EXCHANGE_FILE, "w") as f: f.write(datetime.now().isoformat()) time.sleep(10) def simple_app(environ, start_response): """ Read the content of the exchange file and return it. """ start_response('200 OK', [('Content-type', 'text/plain')]) with io.open(EXCHANGE_FILE) as f: return [f.read().encode('utf-8')] if __name__ == '__main__': t = threading.Thread(target=update_exchange_file) t.start() httpd = make_server('', 8080, simple_app) print("Listening on port 8080....") try: httpd.serve_forever() except KeyboardInterrupt: httpd.shutdown() t.join(timeout=1)
experiment.json
{ "title": "Does our service tolerate the loss of its exchange file?", "description": "Our service reads data from an exchange file, can it support that file disappearing?", "tags": [ "tutorial", "filesystem" ], "steady-state-hypothesis": { "title": "The exchange file must exist", "probes": [ { "type": "probe", "name": "service-is-unavailable", "tolerance": [200, 503], "provider": { "type": "http", "url": "http://localhost:8080/" } } ] }, "method": [ { "name": "move-exchange-file", "type": "action", "provider": { "type": "python", "module": "os", "func": "rename", "arguments": { "src": "./exchange.dat", "dst": "./exchange.dat.old" } } } ] }
카오스 실험 결과 분석

- 로그와 리포트를 통해 실험의 성공 여부, 정상 상태의 변화, 시스템의 약점 등을 확인하고, 그에 따라 시스템을 개선할 수 있음


resilient-service.py
# -*- coding: utf-8 -*- from datetime import datetime import io import os.path import time import threading from wsgiref.validate import validator from wsgiref.simple_server import make_server EXCHANGE_FILE = "./exchange.dat" def update_exchange_file(): """ Writes the current date and time every 10 seconds into the exchange file. The file is created if it does not exist. """ print("Will update to exchange file") while True: with io.open(EXCHANGE_FILE, "w") as f: f.write(datetime.now().isoformat()) time.sleep(10) def simple_app(environ, start_response): """ Read the content of the exchange file and return it. """ if not os.path.exists(EXCHANGE_FILE): start_response( '503 Service Unavailable', [('Content-type', 'text/plain')] ) return [b'Exchange file is not ready'] start_response('200 OK', [('Content-type', 'text/plain')]) with io.open(EXCHANGE_FILE) as f: return [f.read().encode('utf-8')] if __name__ == '__main__': t = threading.Thread(target=update_exchange_file) t.start() httpd = make_server('', 8080, simple_app) print("Listening on port 8080....") try: httpd.serve_forever() except KeyboardInterrupt: httpd.shutdown() t.join(timeout=1)
- 각 단계별 성공/실패 여부: steady-state-hypothesis, method, rollback 등 단계별 실행 결과
- 실패 조건의 발생 여부: 정의된 가설(steady state)이 깨졌는지 여부
- 실험 도중 발생한 예외: 외부 API 오류, 시스템 리소스 부족 등
- 타임스탬프 및 실행 시간: 병목 구간 분석에 유용
- 패턴 1: 정상 상태의 조건이 충족되지 않음
- 예: “응답 시간이 200ms 이내여야 함” → 실험 후 700ms로 측정됨
- 대응: 성능 튜닝, 캐시 적용, 비동기 처리 등 고려
- 패턴 2: 롤백 실패
- 예: 장애 주입 후 시스템 복구 절차가 실패
- 대응: 복구 자동화 시나리오 재검토 필요
- 패턴 3: 특정 구성 요소의 단점 노출
- 예: 데이터베이스 장애 시 백업 DB로 전환 실패
- 대응: 장애 조치(failover) 설정, 이중화 구성 점검
카오스 툴킷 확장

- Toolkit 이라는 이름에서 드러나듯, Chaos Toolkit은 확장성이 용이하고 다양한 플랫폼에서의 테스트가 가능하다.
- 시스템 내부 동작을 이해하고 있어야 실제 장애 조건을 유의미하게 주입할 수 있음
- 장애 대응 방식(failover, queueing, 캐싱 등)을 알아야 시나리오가 실효성 있음
- 비즈니스 중요 로직과 병목 구간을 파악하고 있어야 좋은 시나리오 설계 가능
- 1.Redis 캐시로 몰려드는 트래픽을 견디다 - 토니모리 공식몰 성능 개선기
- 2.PKCE:OAuth를 더욱더 안전하게 만드는 방법
- 3.AWS DataZone에서 OpenLineage 기반의 Airflow 데이터 계보 그리기
- 4.Chaos Toolkit 을 이용한 카오스 엔지니어링(Chaos Engineering)
- 5.성능 향상을 위한 SQL 작성법
- 6.MongoDB WiredTiger의 파일 구조

Google Antigravity 시작하기 및 실제 프로젝트 구현해보기
구글 안티그래비티를 실제 프로젝트에 적용하며 얻은 기술적 통찰을 정리한다. 단순한 코드 추천을 넘어 스스로 계획을 수립하고 실행하는 '에이전트'로서의 특징과, 실제 배포 과정에서의 생산성 및 쿼터 관리 효율성을 분석한다. 개발자의 역할이 단순 코더에서 전체 프로세스를 관리하는 디렉터로 변화하는 지점을 가식 없이 기술한다. This post provides a technical review of Google Antigravity based on real-world project application. It explores its capabilities as an autonomous "Agent" that goes beyond code suggestions to planning and execution. The review analyzes productivity gains and the realities of quota management, highlighting the industry's shift where developers evolve from manual coders into strategic directors of AI agents.

Notion API 변경 대응: morethan-log 오류 해결 로그
최근 Notion API 데이터 구조 변경(중첩된 value 속성)으로 인해 morethan-log 블로그 게시물이 로딩되지 않는 오류를 해결합니다. getPosts.ts 및 주요 파일의 코드 수정 방법을 정리했습니다.
![[Review] AWS Certified Solutions Architect - Associate 합격 후기](/_next/image?url=https%3A%2F%2Fwww.notion.so%2Fimage%2Fattachment%253A44c7d16f-9a0a-407d-a27a-f8a386d4da24%253Aaws-saa-c03-2weeks-review.png%3Ftable%3Dblock%26id%3D2fbf7343-f364-802a-a7d6-fdf97ffda78c%26cache%3Dv2&w=3840&q=75)
[Review] AWS Certified Solutions Architect - Associate 합격 후기
2년 넘게 AWS 실무를 경험한 후, 시스템 아키텍트로 나아가기 위해 도전한 AWS Solutions Architect - Associate (SAA-C03) 단기 합격 후기입니다. 퇴근 후 2시간씩 투자한 밀도 있는 학습 루틴, 덤프(기출) 활용법, 오역 대처법, 그리고 시험장 메모장 활용 팁까지 실전에 꼭 필요한 전략을 확인해 보세요. How I passed the AWS SAA-C03 in just 2 weeks! Read my real-world study strategy, including focused dump analysis, active note-taking on Notion, and practical exam room tips (like checking English originals for translation errors) to boost your score.

노션(Notion)을 서비스 DB로 활용한 토이 프로젝트 후기
토이 프로젝트에서 Notion API를 활용하며 느낀 장단점과, 초당 3회 Rate Limit을 극복하기 위한 Next.js ISR 및 캐싱 전략을 공유합니다.