Files
2nd/10_Wiki/Topics/Architecture/Cosmos_플랫폼_(Netflix).md
T
2026-05-10 22:08:15 +09:00

165 lines
4.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
id: wiki-2026-0508-cosmos-플랫폼-netflix
title: Cosmos 플랫폼 (Netflix)
category: 10_Wiki/Topics
status: verified
canonical_id: self
aliases: [Netflix Cosmos, Cosmos Platform, Cosmos]
duplicate_of: none
source_trust_level: A
confidence_score: 0.85
verification_status: applied
tags: [netflix, media-processing, workflow, microservices]
raw_sources: []
last_reinforced: 2026-05-10
github_commit: pending
tech_stack:
language: java
framework: spring-boot
---
# Cosmos 플랫폼 (Netflix)
## 매 한 줄
> **"매 Netflix 의 next-gen media computing platform"**. Reloaded (predecessor) 의 후계, 2018-2020 announce. Microservices + workflow orchestration + serverless functions 매 통합. Encoding, transcoding, content analysis, IMF processing 매 모든 media pipeline 의 backbone.
## 매 핵심
### 매 architecture (3 layers)
- **Optimus (API layer)** — external-facing service, business logic, request validation.
- **Plato (Workflow layer)** — Conductor-based workflow orchestration, retry, branching.
- **Stratum (Functions layer)** — serverless compute, Titus (container) 위 실행.
### 매 design 원칙
- **Asynchronous everything** — sync call 매 minimum, message-based.
- **Schema-first** — Protobuf gRPC 매 contract.
- **Workflow as DSL** — JSON workflow definition (Conductor).
- **Function granularity** — small, idempotent, stateless.
- **Event-driven** — Kafka, SQS 매 inter-service.
### 매 응용
1. Video encoding pipeline — source → multiple bitrates × codecs.
2. Image processing — title art, thumbnails, language variants.
3. Subtitle / caption processing.
4. Content quality control (QC) automation.
5. IMF (Interoperable Master Format) ingestion.
## 💻 패턴
### Workflow definition (Plato / Netflix Conductor)
```json
{
"name": "encode_video_v3",
"version": 3,
"tasks": [
{
"name": "probe",
"type": "FUNCTION",
"function": "stratum:ffprobe",
"inputParameters": { "url": "${workflow.input.sourceUrl}" }
},
{
"name": "fan_out_encode",
"type": "FORK_JOIN_DYNAMIC",
"dynamicForkTasksParam": "encodeTasks"
},
{
"name": "join_results",
"type": "JOIN"
},
{
"name": "publish",
"type": "FUNCTION",
"function": "stratum:publishToCDN"
}
]
}
```
### Stratum function (Java, Spring Boot)
```java
@CosmosFunction(name = "ffprobe")
public class FfprobeFunction implements Function<ProbeRequest, ProbeResponse> {
@Override
public ProbeResponse apply(ProbeRequest req) {
var info = Ffmpeg.probe(req.url());
return new ProbeResponse(info.duration(), info.codec(), info.bitrate());
}
}
```
### Optimus service (gRPC)
```protobuf
service EncodeService {
rpc StartEncode(EncodeRequest) returns (EncodeResponse);
rpc GetStatus(StatusRequest) returns (stream StatusUpdate);
}
```
### Titus container deployment
```yaml
# titus job definition
applicationName: stratum-ffprobe
container:
image: registry/stratum/ffprobe:v42
resources:
cpu: 4
memoryMB: 8192
gpu: 0
env:
COSMOS_FUNCTION_NAME: ffprobe
```
### Event-driven trigger (Kafka)
```java
@KafkaListener(topics = "media.uploaded")
public void onUpload(MediaUploadedEvent event) {
workflowClient.start("encode_video_v3", Map.of(
"sourceUrl", event.getUrl(),
"movieId", event.getMovieId()
));
}
```
### Idempotency key (function level)
```java
@CosmosFunction(idempotencyKey = "${input.movieId}-${input.bitrate}")
public class EncodeFunction implements Function<EncodeReq, EncodeResp> { ... }
```
## 매 결정 기준
| 상황 | Approach |
|---|---|
| Long-running multi-step media job | Plato workflow |
| Simple stateless transform | Stratum function |
| External-facing API | Optimus service |
| Realtime / sub-100ms | NOT Cosmos (sync RPC service 따로) |
**기본값**: workflow for any multi-step media pipeline; functions for individual steps.
## 🔗 Graph
- 부모: [[Microservices]] · [[Workflow Orchestration]]
- 변형: [[AWS Step Functions]] · [[Temporal]] · [[Argo Workflows]]
- 응용: [[Netflix Encoding Pipeline]] · [[Conductor (Netflix)]]
- Adjacent: [[Titus (Netflix)]] · [[Spinnaker]] · [[Reloaded (Netflix)]]
## 🤖 LLM 활용
**언제**: workflow definition 생성, function template 생성, 운영 incident 매 root cause 분석.
**언제 X**: production workflow execution (deterministic 해야 함).
## ❌ 안티패턴
- **Stateful function**: scale 못 함, retry 깨짐.
- **Long sync chain in Optimus**: workflow 가야 할 것 매 sync call 로 묶음.
- **No idempotency**: retry 매 duplicate side-effect.
- **Workflow too granular**: orchestration overhead > work.
## 🧪 검증 / 중복
- Verified (Netflix Tech Blog 2020 *Rebuilding Netflix Video Processing Pipeline with Microservices*).
- 신뢰도 A.
## 🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — full content covering Optimus/Plato/Stratum |