vlad-vladov-ft opened a new issue, #76745: URL: https://github.com/apache/airflow/issues/76745
### Under which category would you file this issue? Airflow Core ### Apache Airflow version 3.4.0 ### What happened and how to reproduce it? ### Problem After upgrading from 3.3.2 to 3.4.0, we observed aggregate API-server CPU rise from approximately 0.05 to 0.96 cores. We have 3 replicas x 1 worker. In 3.4.0, [get_jobs_health()](https://github.com/apache/airflow/blob/619a787ac81e8b7c8a9102fc78e3f0b00625d04e/airflow-core/src/airflow/api/common/airflow_health.py#L54-L66) loads every matching Job with `end_date IS NULL`, then filters live instances in Python. The eager job_teams relationship adds select-in queries. Our database contained approximately 6.9k unfinished component jobs, mostly abandoned triggerers. A warm call to the unchanged deployed `get_airflow_health()` took 1.12 seconds wall time and 0.97 seconds CPU. The reporting implementation came from [#70416](https://github.com/apache/airflow/pull/70416). Later, [#73222](https://github.com/apache/airflow/pull/73222) stopped listing dead replicas but retained the same query. It also remains on [main at ce5104d](https://github.com/apache/airflow/blob/ce5104d35d1d396a3cedbdc868c8c8777ff45e58/airflow-core/src/airflow/api/common/airflow_health.py#L54-L66). ### Reproduction Use 3.4.0 metadata database with one live triggerer and thousands of stale triggerer rows with null end_date. Call /api/v2/monitor/health and inspect fetched rows and ORM work. ### What you think should happen instead? Could the current health response be computed without hydrating every unfinished historical Job on each request? Any optimization should preserve live-instance and bundle/team coverage, plus unhealthy/down status and the latest heartbeat when all instances are stale. ### Operating System _No response_ ### Deployment Official Apache Airflow Helm Chart ### Apache Airflow Provider(s) _No response_ ### Versions of Apache Airflow Providers _No response_ ### Official Helm Chart version 1.22.0 (latest released) ### Kubernetes Version Not Applicable ### Helm Chart configuration _No response_ ### Docker Image customizations _No response_ ### Anything else? _No response_ ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [x] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md) -- 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]
