High CPU and database load caused by Airflow 3 dag-processor and scheduler #53177
Apache Airflow version3.0.2 If "Other Airflow 2 version" selected, which one?No response What happened?Yesterday I upgraded my small home setup (Raspberry Pi, 2 dags, 3 tasks) to Airflow 3. In comparison to Airflow 2.9.0 the CPU load has increased dramatically:
A few minutes later I also stopped the scheduler and database CPU load went down too. What you think should happen instead?Airflow 3 should cause the same or lower CPU load to Airflow 2. How to reproduceMy docker-compose setup uses this The docker-compose services: airflow-db:
container_name: airflow-db
build:
context: ./dockerfiles/airflow-postgres
dockerfile: Dockerfile
restart: unless-stopped
ports:
- "5001:5432"
volumes:
- af_pgdata:/var/lib/postgresql/data
environment:
POSTGRES_DB: airflowdb
POSTGRES_USER: airflowu
POSTGRES_PASSWORD: xxxxxxx
airflow-api-server:
container_name: airflow-api-server
build:
context: ./dockerfiles/airflow
dockerfile: Dockerfile
depends_on:
- airflow-db
restart: unless-stopped
env_file: ./dockerfiles/airflow/.env
ports:
- "5000:8080"
user: "1000:0"
volumes:
- /home/admin/airflow/dags:/opt/airflow/dags
- /home/admin/airflow/logs:/opt/airflow/logs
command: bash -c "airflow db migrate && airflow api-server"
healthcheck:
test: ["CMD", "curl", "--fail", "http://localhost:8080/api/v2/version"]
interval: 30s
timeout: 10s
retries: 5
start_period: 30s
airflow-dag-processor:
container_name: airflow-dag-processor
build:
context: ./dockerfiles/airflow
dockerfile: Dockerfile
depends_on:
- airflow-db
- airflow-api-server
restart: unless-stopped
env_file: ./dockerfiles/airflow/.env
user: "1000:0"
volumes:
- /home/admin/airflow/dags:/opt/airflow/dags
- /home/admin/airflow/logs:/opt/airflow/logs
command: bash -c "airflow dag-processor"
healthcheck:
test: ["CMD-SHELL", 'airflow jobs check --job-type DagProcessorJob']
interval: 30s
timeout: 20s
retries: 5
start_period: 30s
airflow-scheduler:
container_name: airflow-scheduler
build:
context: ./dockerfiles/airflow
dockerfile: Dockerfile
depends_on:
- airflow-db
- airflow-api-server
- airflow-dag-processor
restart: unless-stopped
env_file: ./dockerfiles/airflow/.env
user: "1000:0"
volumes:
- /home/admin/airflow/dags:/opt/airflow/dags
- /home/admin/airflow/logs:/opt/airflow/logs
command: bash -c "airflow scheduler"
healthcheck:
test: ["CMD", "curl", "--fail", "http://localhost:8974/health"]
interval: 30s
timeout: 10s
retries: 5
start_period: 30sOperating SystemDebian GNU/Linux 12 (bookworm) Versions of Apache Airflow ProvidersNo response DeploymentOfficial Apache Airflow Helm Chart Deployment detailsNo response Anything else?No response Are you willing to submit PR?
Code of Conduct
|
Replies: 2 comments 12 replies
This is by no means guaranteed or expected. The characteristics of Airflow 3 should be different, but "lower" CPU usage in all scenarios is not guaranteed. I think - in order for this one to be actionable, you need to provide a LOT more information. Airflow has never been targetted for Raspbery PI environment, and while it **might ** work there, there might be many reasons why some resources (not necesarily CPU) will not be enough. It could for example mean that you started to run out of memory and this caused CPU usage while some processes are being swapped out. Or accidentally you might have started using (depend how you build it) Amd images and emulation kicked in (that would certainly explain extremely high CPU usage). So in order to be able to help you with your problem you need to do a lot more investigation - there is absolutely no way we can help you with that little information that you provided. You could do a lot of investigation:
For now - this is an interesting discussion, so I convert it to a discussion, but if you provide more evidences and details we might turn it into a real issue. |


Looks like Airflow 3.0.5 finally fixed it
I did not check wheter
airflow jobs check --job-type DagProcessorJobstill causes high CPU load, but I'm happy again regardless.