Apache Superset

[Superset/Helm] Chart 시각화 중 Timeout이 발생하는 경우

비번변경 2024. 3. 20. 22:29

현상

AWS EKS 클러스터에서 Helm으로 Superset을 설치해서 사용하고 있다. 그런데 Superset Dashboard에서 데이터 양이 많은 Chart를 조회하면 60초 정도 로드하다가 Timeout이 발생하면서 실패하는 현상이 발생하고 있다.

원인을 확인하고 현상을 해결해보자.

 

 

원인

다행히 비슷한 현상을 겪는 사용자가 많은지 Apache Superset FAQ 문서에 관련 내용이 정리되어 있었다.

공식 문서에 의하면 Superset 서비스 간 통신이 Gateway나 nginx 같은 Proxy 서버를 통해 이뤄지는 경우, 네트워크 서비스 관련 설정으로 인해 대시보드나 차트를 로드하는 중 504 Gateway Time-out과 같은 시간 초과가 발생할 수 있다고 한다.

긴 쿼리를 처리하는 Superset 서버가 응답을 제 시간에 받지 못하면, 웹 서버는 클라이언트에 504 상태 코드로 응답을 보낸다.

504 Gateway Timeo-out

이런 문제를 해결하기 위해 Superset은 클라이언트 측에서 timeout 제한을 설정하는데, 설정한 timeout(기본값은 60초) 내에 쿼리에 대한 응답이 돌아오지 않으면 504 상태 코드로 인한 에러를 피하기 위해 경고 메세지를 표시한다.

 

만약 클라이언트 측 timeout 설정을 조정하고 싶다면 superset_config.py에 아래와 같이 지정한다.

# timeout을 5분으로 지정
SUPERSET_WEBSERVER_TIMEOUT = 300

또한 네트워크 서비스의 timeout도 확인해보아야 한다.

 

 

해결

이 글에서는 Helm으로 Superset을 배포했고, nginx ingress를 활성화하여 사용 중이므로 values.yaml에 다음과 같이 지정하여 재배포를 수행했다.

 

1. SUPERSET_WEBSERVER_TIMEOUT 수정

configOverrides.extend_timeout.SUPERSET_WEBSERVER_TIMEOUT 설정을 지정한다. 이 글에서는 10분으로 지정하였다.

참고 : https://github.com/apache/superset/blob/master/helm/superset/values.yaml#L132

# -- A dictionary of overrides to append at the end of superset_config.py - the name does not matter
# WARNING: the order is not guaranteed
# Files can be passed as helm --set-file configOverrides.my-override=my-file.py
configOverrides
  extend_timeout: |
     # Extend timeout to allow long running queries.
     SUPERSET_WEBSERVER_TIMEOUT = 600

 

2. Ingress 설정 수정

nginx ingress 설정 중 timeout과 관련된 annotation을 아래과 같이 지정한다. 

참고 : https://github.com/apache/superset/blob/master/helm/superset/values.yaml#L207

ingress:
  enabled: true
  ingressClassName: ~
  annotations:
    # kubernetes.io/tls-acme: "true"
    ## Extend timeout to allow long running queries.
    nginx.ingress.kubernetes.io/proxy-connect-timeout: "600"
    nginx.ingress.kubernetes.io/proxy-read-timeout: "600"
    nginx.ingress.kubernetes.io/proxy-send-timeout: "600"

 

3. superset helm chart 재배포

helm upgrade --install values.yaml superset superset/superset --version 0.11.2

 

4. Chart 로드 확인

Chart가 정상적으로 로드되는지 확인한다.

 

 

참고 문서

https://superset.apache.org/docs/frequently-asked-questions/#why-are-my-queries-timing-out

 

 

728x90