간단하게 적어본 주요 airflow configuration 파라미터
airflow web에 hostname출력여부
expose_hostname= True
metrics 사용
statsd_on= True
custom xcom사용시
xcom_backend=plugins.airflow-plugin.custom_xcom.CustomXComBackendS3
- DagFileProcessManager관련(dag객체로 전환할 파일감지/제외)
## 300, 신규(또는 수정된)dag파일 scan주기
dag_dir_list_interval=120
기본적인 dag패치 loop주기(변경안된파일, 최근 수정된 파일은 list제외)
min_file_process_interval=30
- DagFileProcessorProcess 관련(리스트 대상단위로 python module로딩)
동시에 생성할 DagFileProcessorProcess개수(동시에 파싱할 dag파일개수)->scheduler 확장으로 가능
parsing_process=2
dag파일의 모듈로드 제한시간
dagbag_import_timeout=30.0
dag파일처리주기
dag_file_processor_timeout=50
- db connection pool
5,db connection pool max사이즈
sql_alchemy_pool_size=50
10,sql_alchemy_pool_size만큼 connection이 할당되면 이후 추가적은 connection은 이 개수만큼 반환됨
sql_alchemy_ma_overflow=50
pool idle주기
sql_alchemy_pool_recycle=1800
db에서 webserver로 dag상태 fetch주기(db read rate 최소주기보다 빠를수없다)
min_serialized_dag_fetch_interval=10
webserver에서 db로 dag상태 update주기(database write rate 최소주기보다 빠를 수 없다.)
min_serialized_dag_update_interval=30
스케줄러 loop당 생성할 최대 dagrun수
max_dagruns_to_create_per_loop=10
스케줄러가 task를 스케줄/queing할 수 있는 최대 dagrun개수
max_dagruns_per_loop_to_scheduler=20
-병렬처리
32, airflow 전체에서 동시실행가능한 task수
parallelism=256
16, dag하나당 동시실행가능한 task수
max_active_tasks_per_dag=128
32, dag하나당 동시실행가능한 dagrun수
max_active_runs_per_dag=32
128 default pool size
default_pool_task_slot_count=1024
worker한개가 감당한 task instances개수
worker_concurrency=16
주석처리되어있음 사용시
worker_concurrency=는 무시됨
worker_autoscale=16,12
참고
https://www.nextlytics.com/blog/how-to-scale-data-processing-tasks-with-apache-airflow-celery
Airflow wraps these settings into the parameters worker_concurrency and worker_autoscale. The latter enables each worker to start up additional CPU threads dynamically if the task queue is full and effectively overrides the former parameter. When tuning the different worker scaling dimensions, keep in mind that the number of actual CPU units available present a limit on how many tasks can be processed in parallel. Increasing the number of parallel tasks over the number of CPU cores will introduce context switching overhead in the lower layers of the operating system and hardware.
'airflow' 카테고리의 다른 글
custom xcom + taskflow + multi task return 케이스 (0) | 2024.04.14 |
---|---|
이슈)DagBag import timeout (airflow DagFile Processing) (0) | 2024.03.19 |
DAG ~ seems to be missing from DagBag (0) | 2024.03.13 |
airflow taskflow (0) | 2024.03.06 |