# Twitch Interview Guide

Source: https://www.techinterview.org/post/3233459925/twitch-interview/
Updated: 2026-07-05 · techinterview.org

## Twitch Interview Guide 2026: Live Streaming Infrastructure, Real-Time Chat, and Creator Platform Engineering

Twitch (Amazon subsidiary) is the world's leading live streaming platform for gaming, IRL, and esports. Engineering at Twitch means solving unique problems: sub-second latency video delivery, millions of concurrent chat messages, creator monetization, and real-time interactive experiences. This guide covers SWE interviews at SDE I–III.

## The Twitch Interview Process

- **Recruiter screen** (30 min) — background, streaming/gaming interest

- **Technical phone screen** (1 hour) — 1–2 LeetCode-style problems

- **Virtual onsite** (4–5 rounds):

  2× coding (medium-hard; graph/real-time problems common)

  - 1× system design (video delivery, chat, clips, or recommendations)

  - 1× Amazon leadership principles (Twitch is Amazon subsidiary)

  - 1× hiring manager / team-specific discussion

**Amazon LPs**: Twitch uses Amazon's 14 Leadership Principles in behavioral interviews. Prepare STAR stories for: Customer Obsession, Ownership, Bias for Action, Disagree and Commit, and Deliver Results.

## Core Algorithms: Video and Real-Time Systems

### HLS Adaptive Bitrate Streaming


```
from dataclasses import dataclass
from typing import List, Optional
import math

@dataclass
class StreamVariant:
    bitrate: int      # bits per second
    resolution: str   # "1080p60", "720p60", "480p", "360p", "160p"
    codec: str        # "h264", "av1"
    segment_url_template: str

class HLSManifestGenerator:
    """
    HLS (HTTP Live Streaming) adaptive bitrate manifest generation.
    Twitch transcodes every live stream into multiple quality variants.

    Broadcaster streams at source quality (e.g., 1080p60 at 8Mbps).
    Twitch transcodes to: 1080p60, 720p60, 480p, 360p, 160p.
    Viewer's player auto-selects based on measured bandwidth.

    Twitch-specific challenges:
    - Live edge latency: goal is <3 seconds (vs. YouTube's 10+s)
    - Segment duration: 2-second segments for low latency (vs. 6s standard)
    - Partners get priority transcoding; affiliates may wait in queue
    - Low Latency HLS (LL-HLS): delivers partial segments for <1s glass-to-glass latency
    """

    def generate_master_playlist(
        self,
        stream_id: str,
        available_variants: List[StreamVariant]
    ) -> str:
        """
        Generate HLS master playlist (m3u8 format).
        Client downloads this first, then fetches variant playlist for chosen quality.
        """
        lines = [
            "#EXTM3U",
            "#EXT-X-VERSION:6",
            f"# Twitch live stream: {stream_id}",
            "",
        ]

        for variant in available_variants:
            res_parts = variant.resolution.replace('p60', '').replace('p', '').split('p')
            height = int(res_parts[0]) if res_parts[0].isdigit() else 360
            width = int(height * 16 / 9)

            fps = 60 if '60' in variant.resolution else 30

            lines.append(
                f"#EXT-X-STREAM-INF:"
                f"BANDWIDTH={variant.bitrate},"
                f"RESOLUTION={width}x{height},"
                f"FRAME-RATE={fps},"
                f"CODECS=\"avc1.640028,mp4a.40.2\""
            )
            lines.append(
                f"https://video.twitch.tv/v1/{stream_id}/"
                f"{variant.resolution}/index.m3u8"
            )
            lines.append("")

        return "\n".join(lines)

    def select_optimal_variant(
        self,
        available_variants: List[StreamVariant],
        measured_bandwidth_bps: float,
        safety_factor: float = 0.8
    ) -> StreamVariant:
        """
        ABR logic: select highest quality variant that fits measured bandwidth.
        Safety factor (0.8) means: use at most 80% of measured bandwidth.
        """
        effective_bandwidth = measured_bandwidth_bps * safety_factor
        best = available_variants[0]  # worst quality as fallback

        for variant in sorted(available_variants, key=lambda v: v.bitrate):
            if variant.bitrate <= effective_bandwidth:
                best = variant

        return best


class ChatMessageProcessor:
    """
    Real-time chat processing for Twitch streams.
    Popular channels: 50,000+ messages/minute during hype moments.

    Challenges:
    1. Fan-out: one message ? delivered to all viewers of stream
    2. Moderation: filter banned words, links, spam in <50ms
    3. Rate limiting: slow mode, sub-only mode, follower-only mode
    """

    def __init__(self):
        self.message_timestamps = {}  # user_id -> last message time
        self.banned_words = {'spam', 'scam'}

    def process_message(
        self,
        user_id: int,
        username: str,
        content: str,
        channel_id: int,
        is_subscriber: bool,
        slow_mode_seconds: int = 0,
        sub_only_mode: bool = False
    ) -> dict:
        """
        Process and validate a chat message.
        Returns: {allowed: bool, content: str, badges: list, reason: str}
        """
        import time

        # Sub-only mode check
        if sub_only_mode and not is_subscriber:
            return {'allowed': False, 'reason': 'sub_only_mode'}

        # Slow mode rate limiting
        if slow_mode_seconds > 0:
            last_msg_time = self.message_timestamps.get(user_id, 0)
            if time.time() - last_msg_time < slow_mode_seconds:
                return {'allowed': False, 'reason': 'slow_mode'}

        # Moderation: filter banned words
        lowered = content.lower()
        if any(bad in lowered for bad in self.banned_words):
            return {'allowed': False, 'reason': 'banned_word'}

        # Passed all checks: record timestamp and assemble badges
        self.message_timestamps[user_id] = time.time()

        badges = []
        if is_subscriber:
            badges.append('subscriber')

        return {
            'allowed': True,
            'content': content,
            'badges': badges,
            'reason': '',
        }

    def parse_emotes(self, content: str) -> list:
        """Extract Twitch global emote positions from message text."""
        known_emotes = {'PogChamp', 'KEKW', 'LUL', 'TriHard', 'Kreygasm',
                        'monkaS', 'PepeLaugh', 'Sadge', 'Pog', '4Head'}
        found = []
        words = content.split()
        pos = 0
        for word in words:
            if word in known_emotes:
                found.append({'code': word, 'start': pos, 'end': pos + len(word)})
            pos += len(word) + 1
        return found
```


## System Design: Twitch Live Video Pipeline

Common question: *"Design Twitch's live video delivery infrastructure."*


```
"""
Twitch Video Pipeline:

Broadcaster (OBS/Streamlabs)
    | RTMP stream at 6-8 Mbps
[Ingest Servers] (Twitch Edge PoPs globally)
  - 100+ ingest locations for low-latency upload
  - Primary + backup ingest for reliability
    |
[Transcoding Farm] (AWS EC2 GPU instances)
  - FFmpeg + NVENC GPU encoding
  - 5 quality variants in parallel
  - 2-second segment duration for low latency
    |
[Origin Storage] (S3 + origin servers)
  - Segments stored with TTL (live: keep last 5 min; VOD: 60 days)
    |
[CDN] (AWS CloudFront + Twitch's own PoPs)
  - Popular streams: pre-positioned to edge nodes
  - Unpopular streams: origin pull
  - ~60% of traffic served from CDN edge
    |
[Viewer] via HLS (HTTP, works through firewalls)

Latency budget:
  Broadcaster ? ingest: ~200ms (geographic proximity)
  Ingest ? transcoding: ~500ms
  Transcoding ? CDN: ~1.5-2 seconds (segment duration)
  CDN ? viewer: ~100ms (cached at edge)
  HLS player buffer: 3-6 seconds (low latency mode)
  Total: ~4-8 seconds end-to-end (vs YouTube's 15-30s)

Low Latency HLS (LL-HLS):
  Partial segments delivered before completion
  Target: <2 second latency (for watch parties, live events)
"""
```


## Amazon Leadership Principles at Twitch

Since Twitch is Amazon-owned, behavioral interviews follow Amazon's LP framework. Most critical for engineers:

- **Customer Obsession**: "Tell me about a time you went beyond what was asked to serve the customer."

- **Ownership**: "Describe a time you took responsibility for something outside your direct job."

- **Dive Deep**: "Tell me about a time you used data to challenge an assumption."

- **Deliver Results**: "Describe your most challenging project and how you delivered it."

Use the STAR format (Situation, Task, Action, Result) with specific metrics.

## Compensation (SDE I–III, US, 2025 data)

| Level | Title | Base | Total Comp |
| --- | --- | --- | --- |
| SDE I | Junior SWE | $145–175K | $190–240K |
| SDE II | SWE | $175–215K | $260–360K |
| SDE III | Senior SWE | $215–260K | $360–500K |

Twitch employees receive Amazon RSUs. Vest quarterly over 4 years. Amazon stock is large-cap and stable; refreshes depend on performance reviews.

## Interview Tips

- **Watch Twitch**: Know the product — clips, raids, channel point redemptions, Hype Train — as a viewer

- **Video streaming fundamentals**: RTMP, HLS, DASH, adaptive bitrate, CDN design

- **Prepare Amazon LPs**: Have 2–3 STAR stories ready for each of the 14 Leadership Principles

- **Real-time systems**: WebSocket scaling, fan-out at millions of connections, pub/sub patterns

- **LeetCode**: Medium-hard, Amazon-style; trees, graphs, and DP are frequently tested

*Practice problems: LeetCode 642 (Design Search Autocomplete System), 460 (LFU Cache), 362 (Design Hit Counter), 1472 (Design Browser History).*

## Related System Design Interview Questions

Practice these system design problems that appear in Twitch  interviews:

- [System Design: YouTube / Video Streaming Platform](https://www.techinterview.org/post/3233461351/system-design-video-streaming-platform/)

- [Design a CDN (Content Delivery Network)](https://www.techinterview.org/post/3233460054/design-a-cdn-content-delivery-network/)

- [System Design: Chat System (WhatsApp / Messenger Scale)](https://www.techinterview.org/post/3233461461/system-design-chat-system/)

- [System Design: Notification System (Push, Email, SMS)](https://www.techinterview.org/post/3233460452/system-design-notification-system/)

- [System Design: Video Conferencing](https://www.techinterview.org/post/3233460400/system-design-video-conferencing/)

- [React Interview Questions](https://www.techinterview.org/post/3233460399/react-interview-questions/)

## Related Company Interview Guides

- [Stripe Interview Guide 2026: Process, Bug Bash Round, and Payment Systems](https://www.techinterview.org/post/3233460268/stripe-interview-guide-2026-process-bug-bash-round-and-payment-systems/)

- [Twitch Interview Guide](https://www.techinterview.org/post/3233459925/twitch-interview/)

- [LinkedIn Interview Guide 2026: Social Graph Engineering, Feed Ranking, and Professional Network Scale](https://www.techinterview.org/post/3233460278/linkedin-interview-guide-2026-social-graph-engineering-feed-ranking-and-professional-network-scale/)

- [Scale AI Interview Guide 2026: Data Infrastructure, RLHF Pipelines, and ML Engineering](https://www.techinterview.org/post/3233460275/scale-ai-interview-guide-2026-data-infrastructure-rlhf-pipelines-and-ml-engineering/)

- [Anthropic Interview Guide 2026: Process, Questions, and AI Safety](https://www.techinterview.org/post/3233460267/anthropic-interview-guide-2026-process-questions-and-ai-safety/)

- [Netflix Interview Guide 2026: Streaming Architecture, Recommendation Systems, and Engineering Excellence](/post/3233460274/netflix-interview-guide-2026-streaming-architecture-recommendation-systems-and-engineering-excellence/)

- [System Design: Notification System (Push, Email, SMS)](/post/3233460452/system-design-notification-system/)

- [System Design: Live Streaming Platform (Twitch)](/post/3233460515/system-design-live-streaming/)

*Explore all our [company interview guides](https://www.techinterview.org/category/company-guides/) covering FAANG, startups, and high-growth tech companies.*

Twitch is the leading live streaming platform. Review HLS, adaptive bitrate, chat scale, and VOD storage in [Live Video Streaming System Low-Level Design](https://www.techinterview.org/post/3233466997/lld-live-streaming/).

Twitch has gaming leaderboards. Review Redis sorted sets, time-bucketed leaderboards, and anti-cheat in [Gaming Leaderboard System Low-Level Design](https://www.techinterview.org/post/3233467021/lld-gaming-leaderboard/).
