Commit 29dd99d
authored
Bound the scheduler's deserialized Dag cache (#71704)
The scheduler kept every Dag version it deserialized in a mapping that never
evicted, so a long-running scheduler grew with the number of versions it had
ever seen until it was restarted or OOM killed. Deployments that redeploy Dags
frequently accumulate versions fastest and hit this soonest.
A least-recently-used cap is the only thing that bounds this outright. An idle
timeout would not: the scheduler re-checks an entry on each lookup, which
re-arms its expiry, so a timeout reclaims a version only once its runs finish
and it stops being requested, leaving memory a function of the concurrently
active set rather than a fixed ceiling.
Deliberately not configurable here, so the fix stays small enough to
cherry-pick. Cache activity currently reports under the existing
api_server.dag_bag.* metrics; a scheduler-specific namespace, along with
configuration, follows separately.
closes: #690011 parent 14ab725 commit 29dd99d
3 files changed
Lines changed: 24 additions & 2 deletions
File tree
- airflow-core
- newsfragments
- src/airflow/jobs
- tests/unit/jobs
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
158 | 170 | | |
159 | 171 | | |
160 | 172 | | |
| |||
370 | 382 | | |
371 | 383 | | |
372 | 384 | | |
373 | | - | |
| 385 | + | |
374 | 386 | | |
375 | 387 | | |
376 | 388 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
| 67 | + | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| |||
414 | 414 | | |
415 | 415 | | |
416 | 416 | | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
417 | 426 | | |
418 | 427 | | |
419 | 428 | | |
| |||
0 commit comments