JobManagerTaskManagerTask SlotsParallelismExecution GraphDeployment Modes

Core Architecture

Flink's distributed runtime consists of a JobManager that orchestrates execution and TaskManagers that run the actual data processing. Understanding this architecture is key to tuning, debugging, and scaling Flink applications.

45 min read9 sections
01

JobManager

The JobManager is the brain of a Flink cluster. It receives jobs, transforms them into execution graphs, schedules tasks onto TaskManagers, coordinates checkpoints, and handles failure recovery. In production, you run it in high-availability mode with ZooKeeper or Kubernetes leader election.

🧠

The Air Traffic Controller

The JobManager is like an air traffic controller. It doesn't fly planes (process data) itself — it coordinates which planes land on which runways (which tasks run on which slots), monitors their progress, and reroutes traffic when something goes wrong. If the controller goes down, a standby takes over using the flight logs (checkpoint metadata).

JobManager Responsibilities

  • āœ…Receives job submissions and transforms the logical plan into a physical execution graph
  • āœ…Schedules tasks onto available TaskManager slots based on resource requirements
  • āœ…Coordinates distributed snapshots (checkpoints) across all tasks
  • āœ…Detects task failures and triggers recovery from the latest checkpoint
  • āœ…Manages savepoints — manual snapshots for upgrades and rescaling
  • āœ…Serves the Flink Web UI and REST API for monitoring and management
jobmanager-ha.yamlyaml
# High Availability Configuration (Kubernetes)
high-availability: kubernetes
high-availability.storageDir: s3://flink-ha/cluster-1
restart-strategy: exponential-delay
restart-strategy.exponential-delay.initial-backoff: 1s
restart-strategy.exponential-delay.max-backoff: 60s

# JobManager resources
jobmanager.memory.process.size: 4096m
jobmanager.memory.jvm-overhead.fraction: 0.1

# HA ensures:
# - Leader election via Kubernetes ConfigMaps
# - Checkpoint metadata persisted to S3
# - Standby JobManager takes over in seconds
# - Running tasks continue from last checkpoint

JobManager Components

Internally, the JobManager consists of three components: the Dispatcher (accepts jobs, launches JobMasters), the ResourceManager (manages TaskManager slots), and the JobMaster (one per job — manages execution, checkpointing, and recovery for that specific job).

1 / 9