Apache Airflow Architecture (Webserver, Scheduler, Workers, Metadata DB, Executors)
Know how Airflow’s webserver, scheduler, workers, metadata DB, and executors cooperate.
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
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.
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.
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.
How it works, step by step
Step 1 of 41. 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 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
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.
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.
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?
Knowledge check
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.