Interview's MateData Engineer
Interview's Mate

Data Engineer

SQL · Spark · Lakehouse · Streaming

Visualizer

DSA Visualizer
All 32 lessons
Custom Playground
Try your own examples

Learning

System Design
31 architecture topics
SQL Learning
160 foundations → production topics
AI Engineering
160 LLM → backend topics
Data Science
160 Python → MLOps topics
Data Engineer
160 SQL → streaming topics
Docker
160 Docker learning topics
Kubernetes
160 K8s fundamentals → cloud
Java LearnSoon
Coming soon
Python Learn
Interview Q&A & internals
JavaScript Learn
Closures, async & DOM Q&A
Tech Learn
Search, practise & track Q&A
AI DSA Practice
Solve coding problems
Theme
Home
Data Engineer topics
Lesson 112/ 160
06. Data Transformation (dbt) & Workflow Orchestration

Apache Airflow Architecture (Webserver, Scheduler, Workers, Metadata DB, Executors)

Know how Airflow’s webserver, scheduler, workers, metadata DB, and executors cooperate.

IntermediateScheduler · Workers · Executors3 quiz questions
Practice Generative AI Q&A
In plain wordsDiagramTheoryStep by stepWhen to use itInterview cluesMistakes to avoidQuiz (3)Practice

In plain words

Scheduler serializes safe DAG definitions. Next, creates task instances by schedule and dependencies. Finally, metadata and logs drive UI, retries, and alerts.

Think of it like…

The scheduler is air traffic control, the metadata DB is the flight board, executors are the runway/aircraft dispatch system, and workers actually fly each task.

Where you’ve seen it

A LocalExecutor runs a handful of bounded tasks in one service; Celery distributes to persistent queues, KubernetesExecutor creates a pod per task, while scheduler heartbeat and DAG processing duration reveal control-plane health.

Words you’ll hear

Scheduler
The component that evaluates DAG schedules/dependencies and sends runnable task instances to an executor.
Workers
The Airflow runtime endpoint that submits tasks to local processes, Celery workers, Kubernetes pods, or other backends.
Executors
The state database that stores DAG/task state, runs, variables/connections metadata, and serialized graph information.
Operational boundary
Top-level DAG code that reads networks makes parsing slow, shared Celery workers can starve one pool, and a lost/contended metadata database stops coordination even if data stores remain healthy. Keep DAG parsing pure and fast, place scheduling/config data in versioned code, use pools/queues/resource constraints, monitor scheduler heartbeat and metadata DB, and select an executor matching isolation and elasticity needs.

Visual diagram

Loading interactive diagram

Theory & deep dive

Scheduler: the working mechanism

Airflow's scheduler parses DAG code and creates task instances from a metadata database, executors hand work to workers or processes, and the webserver/UI/API expose state and logs.

Scheduler serializes safe DAG definitions. Creates task instances by schedule and dependencies, then executor queues/runs in selected worker model; this exposes the state governed by Executors.

Apache Airflow Architecture in one concrete design

A LocalExecutor runs a handful of bounded tasks in one service; Celery distributes to persistent queues, KubernetesExecutor creates a pod per task, while scheduler heartbeat and DAG processing duration reveal control-plane health.

Key takeaway: Airflow's scheduler parses DAG code and creates task instances from a metadata database, executors hand work to workers or processes, and the webserver/UI/API expose state and logs

Apache Airflow Architecture: failure mode and production response

Top-level DAG code that reads networks makes parsing slow, shared Celery workers can starve one pool, and a lost/contended metadata database stops coordination even if data stores remain healthy.

Keep DAG parsing pure and fast, place scheduling/config data in versioned code, use pools/queues/resource constraints, monitor scheduler heartbeat and metadata DB, and select an executor matching isolation and elasticity needs. Track Scheduler heartbeat as "stale heartbeat means control-plane loss", and make DAG parse duration visible to the dataset owner.

Key takeaway: Keep DAG parsing pure and fast, place scheduling/config data in versioned code, use pools/queues/resource constraints, monitor scheduler heartbeat and metadata DB, and select an executor matching isolation and elasticity needs.

How it works, step by step

Step 1 of 4
Scheduler

1. Parse

Scheduler serializes safe DAG definitions. Airflow's scheduler parses DAG code and creates task instances from a metadata database, executors hand work to workers or processes, and the webserver/UI/API expose state and logs.

scheduler serializes safe DAG definitions
Key numbers at this step
Scheduler heartbeat
stale heartbeat means control-plane loss
Workers
The Airflow runtime endpoint that submits tasks to local processes, Celery workers, Kubernetes pods, or other backends.

When to use it & trade-offs

What it is

Airflow's scheduler parses DAG code and creates task instances from a metadata database, executors hand work to workers or processes, and the webserver/UI/API expose state and logs. A LocalExecutor runs a handful of bounded tasks in one service; Celery distributes to persistent queues, KubernetesExecutor creates a pod per task, while scheduler heartbeat and DAG processing duration reveal control-plane health.

Why it matters: Top-level DAG code that reads networks makes parsing slow, shared Celery workers can starve one pool, and a lost/contended metadata database stops coordination even if data stores remain healthy. Keep DAG parsing pure and fast, place scheduling/config data in versioned code, use pools/queues/resource constraints, monitor scheduler heartbeat and metadata DB, and select an executor matching isolation and elasticity needs.

When to reach for it

  • Know how Airflow’s webserver, scheduler, workers, metadata DB, and executors cooperate.
  • Choose Scheduler because it provides this capability: The component that evaluates DAG schedules/dependencies and sends runnable task instances to an executor.
  • Keep evidence for Scheduler heartbeat at "stale heartbeat means control-plane loss" so the last production stage-Record/serve - metadata and logs drive UI, retries, and alerts-remains testable.

When to avoid or be careful

  • Top-level DAG code that reads networks makes parsing slow, shared Celery workers can starve one pool, and a lost/contended metadata database stops coordination even if data stores remain healthy.
  • Do not conflate Workers with Scheduler. The second concept contributes different behavior: The Airflow runtime endpoint that submits tasks to local processes, Celery workers, Kubernetes pods, or other backends.
  • Release only after this guardrail is in place: Keep DAG parsing pure and fast, place scheduling/config data in versioned code, use pools/queues/resource constraints, monitor scheduler heartbeat and metadata DB, and select an executor matching isolation and elasticity needs.

Scheduler / Workers / Executors - roles, limits, and operating cost

Scheduler
Best for: The component that evaluates DAG schedules/dependencies and sends runnable task instances to an executor.

Strengths: The component that evaluates DAG schedules/dependencies and sends runnable task instances to an executor. Airflow's scheduler parses DAG code and creates task instances from a metadata database, executors hand work to workers or processes, and the webserver/UI/API expose state and logs.

Watch out: Top-level DAG code that reads networks makes parsing slow, shared Celery workers can starve one pool, and a lost/contended metadata database stops coordination even if data stores remain healthy.

Workers
Best for: The Airflow runtime endpoint that submits tasks to local processes, Celery workers, Kubernetes pods, or other backends.

Strengths: The Airflow runtime endpoint that submits tasks to local processes, Celery workers, Kubernetes pods, or other backends. In this workflow it supports: Dispatch - executor queues/runs in selected worker model.

Watch out: The operating cost is real: code must not do per-file network or heavy data work.

Executors
Best for: The state database that stores DAG/task state, runs, variables/connections metadata, and serialized graph information.

Strengths: The state database that stores DAG/task state, runs, variables/connections metadata, and serialized graph information. Its output can be checked with Pool slots.

Watch out: Operating guardrail: Keep DAG parsing pure and fast, place scheduling/config data in versioned code, use pools/queues/resource constraints, monitor scheduler heartbeat and metadata DB, and select an executor matching isolation and elasticity needs.

Interview signals & numbers to know

When this topic comes up

  • “Where is the failure boundary for Scheduler, and how would Scheduler heartbeat reveal it?”
  • “Why is Workers distinct from this behavior: the state database that stores DAG/task state, runs, variables/connections metadata, and serialized graph information?”
  • Production clue: Top-level DAG code that reads networks makes parsing slow, shared Celery workers can starve one pool, and a lost/contended metadata database stops coordination even if data stores remain healthy.
  • Design probe: Keep DAG parsing pure and fast, place scheduling/config data in versioned code, use pools/queues/resource constraints, monitor scheduler heartbeat and metadata DB, and select an executor matching isolation and elasticity needs.

Benchmarks & rules of thumb

Scheduler heartbeat -
stale heartbeat means control-plane loss
DAG parse duration -
code must not do per-file network or heavy data work
Pool slots -
concurrency capacity and queue fairness per resource

Common mistakes & follow-ups

Common interview mistakes

  • Top-level DAG code that reads networks makes parsing slow, shared Celery workers can starve one pool, and a lost/contended metadata database stops coordination even if data stores remain healthy.
  • Reporting success from a job exit code without checking Scheduler heartbeat and DAG parse duration.
  • Treating this example as complete without replay, rollback, or access boundaries: A LocalExecutor runs a handful of bounded tasks in one service; Celery distributes to persistent queues, KubernetesExecutor creates a pod per task, while scheduler heartbeat and DAG processing duration reveal control-plane health.

Likely interviewer follow-ups

  • How would you prove this contract instead of only checking that the command ran: The component that evaluates DAG schedules/dependencies and sends runnable task instances to an executor.
  • What does the recovery plan do when this occurs? Top-level DAG code that reads networks makes parsing slow, shared Celery workers can starve one pool, and a lost/contended metadata database stops coordination even if data stores remain healthy.
  • When is Scheduler insufficient for DAG parse duration, and what does adding Workers cost in Scheduler heartbeat?
Interview tip: Lead with the data path and failure boundary: Airflow's scheduler parses DAG code and creates task instances from a metadata database, executors hand work to workers or processes, and the webserver/UI/API expose state and logs. Then make the answer operational: Keep DAG parsing pure and fast, place scheduling/config data in versioned code, use pools/queues/resource constraints, monitor scheduler heartbeat and metadata DB, and select an executor matching isolation and elasticity needs.

Knowledge check

Loading quiz

Put it into practice

Practice related interview Q&A

Apply Apache Airflow Architecture (Webserver, Scheduler, Workers, Metadata DB, Executors) with data engineer interview Q&A and hands-on practice.

Open Data Engineer Q&A →Machine Learning Q&A
Previous topic
Workflow Orchestration Concepts (DAGs, Dependencies, Backfills, Idempotency)
Next topic
Writing Airflow DAGs (Operators, Sensors, Hooks, TaskFlow API @task)