amdubovoi commented on PR #77490: URL: https://github.com/apache/airflow/pull/77490#issuecomment-7178580082
Thanks for the review. Here are the numbers on Postgres. The first two rows are the case you suggested: 5 Dag runs of one Dag, each with 1,000 task instances and 500 of them finished. The setup is the same as in the description, but in Breeze on Postgres instead of SQLite. Each Dag run gets one `task_instance_scheduling_decisions` call. The first two rows time the 5 Dag runs of one Dag together, as one scheduler loop examines them. Main and this PR alternated over 5 rounds. Each value is the median over the rounds of the median of 5 passes, with GC disabled while timing. Both sides made the same scheduling decisions in every case. A control query, `get_task_instances` of each run, moved by at most 2%. | Dag | Dag runs | Unfinished / finished per run | main | This PR | Speed-up | |---|---:|---|---:|---:|---:| | 50 groups × 20 tasks, 10 finished per chain | 5 | 500 / 500 | 429 ms | 308 ms | 1.4× | | 10 groups × 100 tasks, 50 finished per chain | 5 | 500 / 500 | 492 ms | 369 ms | 1.3× | | 10 × 10, 5 finished | 1 | 50 / 50 | 8.7 ms | 8.4 ms | 1.0× | | 30 × 34, 17 finished | 1 | 510 / 510 | 88 ms | 62 ms | 1.4× | | 100 × 80, 2 finished | 1 | 7,800 / 200 | 1.17 s | 1.02 s | 1.2× | | 100 × 80, 40 finished | 1 | 4,000 / 4,000 | 2.40 s | 0.55 s | 4.3× | | 100 × 80, 78 finished | 1 | 200 / 7,800 | 250 ms | 73 ms | 3.4× | | 200 × 100, 50 finished | 1 | 10,000 / 10,000 | 13.73 s | 1.43 s | 9.6× | | 9 mapped stages × 300, 5 finished | 1 | 1,200 / 1,500 | 403 ms | 246 ms | 1.6× | The results are close to the SQLite ones. The query count stays the same, because the scan that this PR removes runs in Python after the database returns the finished task instances. The gain grows with the number of schedulable task instances times the number of finished ones in a run. At 1,000 task instances per run it is about 1.4×, and between 8,000 and 20,000 it is 4× to 10×. I will replace the SQLite table in the description with these numbers. --- Drafted-by: Claude Code (Opus 5.5); reviewed by @amdubovoi before posting -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
