Airflow를 세팅하고 CPU를 보면 아무것도 하지 않고 있는데, CPU를 40~50% 정도 점유하는 경우가 있습니다.
하지만 이는 몇 가지 옵션만 변경한다면 쉽게 CPU 점유율을 낮출 수 있습니다. 또한 운영상에 큰 지장이 없습니다.
저의 경우 GCP 위에서 docker를 통해서 airflow를 운영하고 있으며, 옵션은 worker,scheduler,webserver 이렇게 3개의 컨테이너에 적용하였습니다. 모두 동일하게 적용하였습니다.
1
2
3
4
5
6
7
8
9
10
11
|
# The scheduler constantly tries to trigger new tasks (look at the
# scheduler section in the docs for more information). This defines
# how often the scheduler should run (in seconds).
scheduler_heartbeat_sec = 60
# after how much time (seconds) a new DAGs should be picked up from the filesystem
min_file_process_interval =60
# The scheduler can run multiple threads in parallel to schedule dags.
# This defines how many threads will run.
max_threads = 1
|
cs |
위의 3개의 옵션을 변경하였고 기존의 값의 경우 다음과 같습니다.
1
2
3
|
scheduler_heartbeat_sec = 5
min_file_process_interval = 0
max_threads = 2
|
cs |
위의 옵션을 변경하고 docker 컨테이너를 재시작하였을 때 바로 CPU가 하락 함을 볼 수 있습니다.
참고
https://blog.nolanemirot.com/2017/07/13/high-cpu-usage-with-airflow/
High CPU on Airflow
I’ve noticed that the CPU is constantly pretty high on airflow. Looking at the processes, I noticed that the scheduler is using all my CPU. You can reduce the amount used using this two varia…
blog.nolanemirot.com
https://stackoverflow.com/questions/42419834/airbnb-airflow-using-all-system-resources
Airbnb Airflow using all system resources
We've set up Airbnb/Apache Airflow for our ETL using LocalExecutor, and as we've started building more complex DAGs, we've noticed that Airflow has starting using up incredible amounts of system
stackoverflow.com
'Data pipeline > Airflow' 카테고리의 다른 글
[Airflow] oracle connection 등록 후 python으로 부르기 (0) | 2023.07.20 |
---|---|
[Airflow] 스케줄 시간 (Crontab) Query 파싱 (0) | 2023.05.03 |
docker기반 Airflow 2.0 설치 (2) | 2021.02.23 |
airflow dag의 task를 실행하고 동작하지 않는 현상 (0) | 2020.11.03 |
Airflow 실패여부 slack알람으로 받기 (python) (0) | 2019.12.04 |