🏢 Netflix 기술 스택 분석
넷플릭스가 전 세계 2.4억 사용자에게 스트리밍 서비스를 제공하는 기술 스택 심층 분석 - 마이크로서비스, AWS, Chaos Engineering의 교과서
🏢 Netflix 기술 스택 분석
전 세계 2.4억 구독자에게 매일 1.4억 시간의 콘텐츠를 스트리밍하는 Netflix의 기술 스택을 심층 분석합니다.
"Freedom and Responsibility" - Netflix의 엔지니어링 문화와 기술적 혁신
📊 회사 개요
서비스 규모
- 구독자: 190개국 2.38억 명 (2024 Q3)
- 콘텐츠: 15,000+ 타이틀 (지역별 상이)
- 트래픽: 인터넷 트래픽의 15% 차지
- 동시 스트림: 피크 시간 수천만 동시 스트림
- 데이터 전송: 일일 600TB+
엔지니어링 조직
- 엔지니어: 2,500명+
- 팀 구조: 자율적인 소규모 팀 (2-pizza teams)
- 문화: "Highly Aligned, Loosely Coupled"
- 오픈소스: 200+ 프로젝트 공개
기술적 도전과제
- 글로벌 스케일: 전 세계 실시간 스트리밍
- 개인화: 1억 개의 서로 다른 Netflix 버전
- 신뢰성: 99.99% 가용성 목표
- 성능: 시작 시간 < 2초, 리버퍼링 최소화
🏗️ 아키텍처 Overview
시스템 다이어그램
┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │ Devices │────►│ Edge │────►│ Backend │ │ (TV,Mobile) │ │ (AWS CDN) │ │ (AWS) │ └─────────────┘ └─────────────┘ └─────────────┘ │ │ │ │ ┌─────▼─────┐ ┌─────▼─────┐ │ │ Zuul │ │ EVCache │ │ │ (Gateway) │ │ (Cache) │ │ └───────────┘ └───────────┘ │ │ └────────────────────────────────────────┤ ┌─────▼─────┐ │ Microsvcs │ │ (1000+) │ └───────────┘ 핵심 설계 원칙
- Microservices First: 1000+ 마이크로서비스
- Stateless Design: 수평 확장 가능
- Circuit Breakers: 장애 격리
- Chaos Engineering: 의도적 장애 주입
- Data Replication: 다중 리전 복제
진화 과정
- 2008: 모놀리스에서 AWS 마이그레이션 시작
- 2010: 스트리밍 서비스 런칭
- 2012: Chaos Monkey 도입
- 2015: 글로벌 엣지 인프라 구축
- 2020: Studio 기술 통합
- 2023: 광고 지원 티어 인프라
🧩 기술 스택 상세
Backend 기술
// Netflix의 전형적인 마이크로서비스 구조 @SpringBootApplication @EnableEurekaClient @EnableHystrix @EnableFeignClients public class VideoMetadataService { @Autowired private EVCache evCache; @HystrixCommand( fallbackMethod = "getDefaultMetadata", commandProperties = { @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "3000"), @HystrixProperty(name = "circuitBreaker.requestVolumeThreshold", value = "20") } ) public VideoMetadata getVideoMetadata(String videoId) { // EVCache 체크 VideoMetadata cached = evCache.get("metadata:" + videoId); if (cached != null) return cached; // Cassandra에서 조회 VideoMetadata metadata = cassandraRepo.findById(videoId); evCache.set("metadata:" + videoId, metadata, 300); return metadata; } } 주요 백엔드 기술:
- 언어: Java (주력), Python, Node.js, Go
- 프레임워크: Spring Boot, Play Framework
- API Gateway: Zuul 2
- 서비스 디스커버리: Eureka
- 로드 밸런싱: Ribbon
- Circuit Breaker: Hystrix
- 구성 관리: Archaius
Frontend 기술
// Netflix TV UI의 React 컴포넌트 예시 const VideoPlayer = () => { const [manifest, setManifest] = useState(null); const [bitrate, setBitrate] = useState("auto"); useEffect(() => { // 적응형 비트레이트 스트리밍 const player = new NetflixPlayer({ adaptiveBitrate: true, bufferSize: 30, // 30초 버퍼 maxBitrate: getMaxBitrateForDevice(), onBitrateChange: (newBitrate) => { setBitrate(newBitrate); trackEvent("bitrate_change", { bitrate: newBitrate }); }, }); return () => player.destroy(); }, []); return <PlayerUI bitrate={bitrate} />; }; 플랫폼별 기술:
- Web: React, Falcor (GraphQL 대안)
- TV Apps: React + Gibbon (렌더링 레이어)
- Mobile: Native (Swift/Kotlin) + React Native
- 게임 콘솔: C++ 기반 커스텀 UI
Data & Infrastructure
데이터베이스
-- Cassandra 데이터 모델 예시 CREATE TABLE viewing_history ( user_id UUID, video_id UUID, timestamp timestamp, position_seconds int, device_type text, PRIMARY KEY ((user_id), timestamp, video_id) ) WITH CLUSTERING ORDER BY (timestamp DESC); 데이터 저장소:
- Cassandra: 시청 기록, 메타데이터 (100+ 클러스터)
- EVCache: 분산 캐시 (Memcached 기반)
- S3: 정적 에셋, 백업
- Elasticsearch: 검색, 로그 분석
- Spark: 배치 처리, ML 학습
스트리밍 인프라
# CDN 구성 Open Connect: Appliances: 17,000+ Locations: 1,000+ ISPs Cache_Hit_Rate: 95%+ Encoding: Formats: [H.264, H.265, AV1, VP9] Profiles: 120+ per title Bitrates: 235kbps - 15.5Mbps Adaptive_Streaming: Protocol: DASH + Custom Chunk_Size: 4 seconds Buffer_Target: 30 seconds DevOps & SRE
Chaos Engineering
# Chaos Monkey 설정 예시 chaos_config = { "enabled": True, "schedule": { "type": "cron", "expression": "0 9-17 * * 1-5" # 평일 업무시간 }, "termination": { "probability": 0.01, # 1% 확률로 인스턴스 종료 "strategies": ["RANDOM", "OLDEST"], "excluded_clusters": ["critical-payment", "auth-service"] }, "notifications": { "slack": "#chaos-engineering", "email": "oncall@netflix.com" } } Chaos Engineering 도구:
- Chaos Monkey: 랜덤 인스턴스 종료
- Chaos Kong: 전체 리전 장애 시뮬레이션
- Chaos Gorilla: 가용 영역 장애
- Latency Monkey: 네트워크 지연 주입
- Conformity Monkey: 모범 사례 준수 확인
모니터링 스택
// Atlas 메트릭 수집 예시 class VideoStreamingMetrics { constructor() { this.registry = new Atlas.Registry(); this.playbackStarts = this.registry.counter("playback.starts"); this.rebufferRatio = this.registry.gauge("playback.rebuffer.ratio"); this.startupTime = this.registry.timer("playback.startup.time"); } trackPlaybackStart(metadata) { this.playbackStarts.increment({ device: metadata.device, country: metadata.country, title: metadata.titleId, }); this.startupTime.record(metadata.startupTime); } } 관측성 도구:
- Atlas: 시계열 메트릭 (자체 개발)
- Vector: 실시간 로그 분석
- Mantis: 실시간 스트림 프로세싱
- Vizceral: 트래픽 시각화
💡 핵심 기술 인사이트
1. 개인화 알고리즘
# 추천 시스템 간소화 예시 def get_recommendations(user_id): # 1. 협업 필터링 similar_users = find_similar_users(user_id) collaborative_recs = aggregate_preferences(similar_users) # 2. 콘텐츠 기반 필터링 user_profile = build_user_profile(user_id) content_recs = find_similar_content(user_profile) # 3. 딥러닝 모델 neural_recs = deep_ranking_model.predict(user_id) # 4. 앙상블 final_recs = ensemble_blend( collaborative_recs * 0.4, content_recs * 0.3, neural_recs * 0.3 ) return personalize_artwork(final_recs, user_id) 2. A/B 테스팅 플랫폼
- 규모: 동시에 1000+ 실험 진행
- 분할: 사용자를 수천 개 셀로 분할
- 메트릭: 시청 시간, 구독 유지율, 참여도
- 통계: Bayesian 추론 사용
3. Open Connect CDN
- 자체 CDN: ISP 내부에 캐시 서버 배치
- 효율성: 95%+ 캐시 히트율
- 하드웨어: 커스텀 최적화 서버
- 소프트웨어: FreeBSD 기반
📈 성과 & 지표
기술적 성과
- 가용성: 99.99% (연간 52분 다운타임)
- 스트리밍 시작 시간: < 2초
- 리버퍼링: < 0.5%
- 비디오 품질: 평균 1080p+
- 전 세계 동시 스트림: 수천만
비즈니스 영향
- AWS 비용: 연간 $5억+ (추정)
- 인프라 효율성: 지속적 개선으로 비용 절감
- 개발 속도: 일일 수천 번 배포
- 실험 속도: 연간 수만 개 A/B 테스트
🎓 Netflix에서 배울 점
✅ 적용 가능한 패턴
- Circuit Breaker Pattern: 장애 전파 방지
- Bulkhead Pattern: 리소스 격리
- API Gateway Pattern: 중앙화된 엔트리 포인트
- Service Mesh: 서비스 간 통신 관리
- Chaos Engineering: 사전 장애 대응
❌ 피해야 할 실수
- 과도한 마이크로서비스: 작은 팀에는 부담
- 분산 모놀리스: 잘못된 서비스 분리
- 캐시 의존성: EVCache 없이는 작동 불가
- 복잡한 디버깅: 분산 시스템의 어려움
📚 추천 리소스
🔮 미래 전망
현재 집중 분야
- AV1 코덱: 대역폭 30% 절감
- 게임 스트리밍: 클라우드 게이밍 인프라
- 실시간 인코딩: 라이브 이벤트 지원
- 엣지 컴퓨팅: 더 가까운 곳에서 처리
- AI/ML: 더 정교한 개인화
기술 트렌드
- 서버리스: 일부 워크로드 이전
- WebAssembly: 클라이언트 성능 향상
- 5G: 모바일 스트리밍 품질 개선
- Blockchain: 콘텐츠 권리 관리 실험
"우리는 엔터테인먼트를 재창조하고 있습니다. 기술은 그 여정의 핵심입니다."
- Netflix Engineering
마지막 업데이트: 2025-01-28