Ayb
5월 1, 2025, 11:47오후
1
최근 사내 k8s 환경에 Airflow를 Helm을 이용하여 올렸는데
Scheduler와 Trigger의 메모리 점유율이 계속 우상향하고 있습니다.
현재 DAG도 9개에 Task도 대부분 GCP 호출로 이루어져 있습니다.
DAG는 Active 상태이지만 대부분 일배치이고, 2종만 2분, 30분 간격으로 수행되고 있습니다.
대부분의 시간에서 Running중인 DAG가 없는데 메모리만 점유율이 올라가고있는 상황입니다.
비슷한 경험이나 어떤 영역부터 점검해야 하는지 조언을 구하고 싶습니다.
감사합니다.
환경 :
Airflow 버전 : 2.7.3
Python 버전 : 3.8
Executor : CeleryKubernetesExecutor
DB : postgre, redis
GitSync 사용중
1개의 좋아요
DAG run이 그리 많지 않은 상황인데도 Scheduler랑 Trigger 부분에서 메모리 점유율이 우상향하는 것은 메모리 leak을 의심해볼 수 있는데요.
먼저, 어떤 컴포넌트가 실제로 메모리를 점유하고 있는지 확인하는 것이 우선일 것 같습니다.
Memray is a memory profiler for Python
위의 방법을 사용하여 실제로 메모리를 비정상적으로 점유하고 있는 부분을 파악해야합니다.
이를 통해 다음 두 가지를 확인해볼 수 있을 것 같습니다:
Airflow Scheduler / Trigger Python 프로세스 자체에서 메모리 사용량이 증가하고 있는지
혹은 K8s 레벨에서 컨테이너 전체 메모리 사용량이 증가하고 있는지
만약 프로세스 단에서 문제가 보인다면, 특정 모듈이나 Airflow 내부 loop부분을 의심해볼만 합니다. 반대로 컨테이너 레벨에서 문제가 보인다면, Python 이외의 다른 커널, buffer 등 os나 컨테이너 자원 부분을 의심해볼 수 있을 것 같습니다.
2번에서 문제가 발생한 경우는 아래에 해결? 책이 있긴합니다.
opened 12:24PM - 12 Sep 24 UTC
kind:bug
area:core
area:Triggerer
needs-triage
### Apache Airflow version
Other Airflow 2 version (please specify below)
### … If "Other Airflow 2 version" selected, which one?
2.8.3
### What happened?
We started to use deferrable operators and sensors from 2 weeks back. As part of it, we started using triggerer. The triggerer container memory is increasing steadily, even when no triggers are running.
<img width="951" alt="airflow-triggerer-memory-leak-2 8 3" src="https://github.com/user-attachments/assets/74342e88-74a8-4703-a753-6204ae58e268">
### What you think should happen instead?
Memory consumption of idle triggerer should be less and does not increase
### How to reproduce
Deploy triggerer in kubernetes with airflow version 2.8.3. Monitor for 24hrs
### Operating System
kubernetes
### Versions of Apache Airflow Providers
apache-airflow-providers-celery==3.6.1
apache-airflow-providers-common-io==1.4.0
apache-airflow-providers-common-sql==1.11.1
apache-airflow-providers-ftp==3.7.0
apache-airflow-providers-http==4.10.0
apache-airflow-providers-imap==3.5.0
apache-airflow-providers-smtp==1.8.0
apache-airflow-providers-sqlite==3.7.1
### Deployment
Other
### Deployment details
Airflow version: 2.8.3
Python version: 3.9.x
Database: Postgres 13
Kubernetes details:
Azure kubernetes service
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
k8s Server Version: v1.29.4
Dags are packaged as python packages and installed in the airflow base image. Airflow triggerer is deployed using our custom helm chart, which is just a modified version of official one.
### 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)
그리고 여기서 명확한 문제가 뚜렷하게 드러나지 않는다면, 그 다음으로는 DAG 파싱, GitSync 쪽을 점검해보는 것도 좋을 것 같습니다.
특히 GitSync를 사용 중이시고, DAG가 동적으로 생성되거나 parsing 주기가 짧게 설정되어 있다면, 이 부분이 메모리 증가에 영향을 줄 수 있습니다.
이런 방식으로 문제를 좁혀가면서 테스트를 해보시는 것이 좋을 것 같습니다.
1개의 좋아요