Self-Healing Egress Platform셀프 힐링 이그레스 플랫폼
A 28-backend egress platform that tracks usage, rotates IPs, and recovers on its own.사용 이력을 추적하고, IP를 로테이션하고, 스스로 복구하는 28개 백엔드 이그레스 플랫폼.
Problem문제
Collection at scale needed reliable, geographically diverse egress IPs. External proxy spend was rising, and the existing system had no operational history, so there was no clear way to answer who was using which IP at a given moment.대규모 수집에는 안정적이고 지리적으로 다양한 이그레스 IP가 필요했습니다. 외부 프록시 비용은 오르고 있었고, 기존 시스템에는 운영 기록이 없어 특정 시점에 누가 어떤 IP를 쓰고 있는지 답할 방법이 없었습니다.
System시스템
Built in three stages as sole owner: market research, vendor selection, and contract negotiation for external proxies; a cost-driven shift to rotating an existing VPN pool, prototyped in docker-compose and moved to Kubernetes; then a Postgres event ledger, drain-rotate automation, and synthetic CONNECT health checks that quarantine and restore backends automatically.단독 오너로 3단계에 걸쳐 구축했습니다. 외부 프록시 시장 조사·벤더 선정·계약 협상, 비용 절감을 위해 기존 VPN 풀을 로테이션하는 방식으로 전환(docker-compose 프로토타입 후 Kubernetes 이전), 그리고 Postgres 이벤트 레저, drain-rotate 자동화, 백엔드를 자동으로 격리·복구하는 합성 CONNECT 헬스 체크입니다.
Impact임팩트
Runs 28 backends (26 global and 2 Korea) behind HAProxy with consistent source-hash balancing. Single-backend failures at night or on weekends recover without human intervention, and a daily Slack health report makes overnight events visible each morning.HAProxy 뒤에서 일관된 source-hash 밸런싱으로 28개 백엔드(글로벌 26 + 한국 2)를 운영합니다. 야간이나 주말의 단일 백엔드 장애는 사람 개입 없이 복구되고, 매일 아침 Slack 헬스 리포트로 밤사이 이벤트를 확인할 수 있습니다.
Architecture notes아키텍처 노트
The public lab uses the same operating pattern shown here: a scheduled agent does the heavy work ahead of time, writes a static JSON artifact, and the page reads that artifact. Loading the page never calls an LLM. If collection or generation fails, the existing page still works; only the next refresh is delayed.
공개 Lab도 여기서 보여준 것과 같은 운영 패턴으로 동작합니다. 스케줄 에이전트가 무거운 작업을 미리 처리해 정적 JSON 아티팩트를 쓰고, 페이지는 그 파일을 읽기만 합니다. 페이지를 여는 것만으로는 LLM이 호출되지 않으며, 수집이나 생성이 실패해도 기존 페이지는 계속 동작하고 다음 갱신만 늦어집니다.
The drain-rotate algorithm uses HAProxy’s admin port to gracefully drain active connections from a backend, polls the stats CSV until the connection count reaches zero, then patches the SERVER_HOSTNAMES config and triggers a kubectl rollout restart with strategy: Recreate. Once the new pod is up, it probes the public IP through the backend and writes the result to a Postgres event ledger.
A separate synthetic CONNECT health checker runs as a cron pod. It performs direct CONNECT probes through each backend to a small set of round-robin endpoints. Five consecutive failures quarantine the backend; one later success restores it. This catches a class of failures that HAProxy’s built-in L7 health check misses.
A daily Slack report summarizes the previous 24 hours from the event ledger, so overnight rotations, quarantines, and recoveries are visible the next morning instead of being discovered through a downstream failure.
drain-rotate 알고리즘은 HAProxy의 admin 포트로 백엔드의 활성 커넥션을 점진적으로 비우고, stats CSV를 폴링해 커넥션 수가 0이 될 때까지 기다린 뒤, SERVER_HOSTNAMES 설정을 패치하고 strategy: Recreate로 kubectl rollout restart를 트리거합니다. 새 Pod이 뜨면 그 백엔드를 통해 공인 IP를 확인하고 결과를 Postgres 이벤트 레저에 기록합니다.
별도의 합성 CONNECT 헬스 체커가 크론 Pod으로 돕니다. 각 백엔드를 통해 라운드로빈 엔드포인트 몇 곳으로 직접 CONNECT 프로브를 수행합니다. 5회 연속 실패하면 백엔드를 격리하고, 이후 1회 성공하면 복구합니다. HAProxy 내장 L7 헬스 체크가 놓치는 유형의 장애를 여기서 잡아냅니다.
매일 아침 Slack 리포트가 이벤트 레저에서 직전 24시간을 요약합니다. 밤사이의 로테이션, 격리, 복구를 다운스트림 장애로 뒤늦게 발견하는 대신 다음 날 아침에 바로 확인할 수 있습니다.