DynamoDB ProvisionedThroughputExceededException 원인과 대응
このコンテンツはまだ日本語訳がありません。
Issue
섹션 제목: “Issue”DynamoDB에서 데이터를 가져오는 처리를 하던 배치에서 아래와 같은 에러가 발생했고, 최종적으로 실패했다는 메시지가 슬랙 채널에 왔다.
{ ... "name": "ProvisionedThroughputExceededException", "ThrottlingReasons": [], "message": "The level of configured provisioned throughput for the table was exceeded. Consider increasing your provisioning level with the UpdateTable API", ...}Cause
섹션 제목: “Cause”ProvisionedThroughputExceededException은 DynamoDB에서 처리량 제한에 걸렸을 때 볼 수 있는 throttling 예외다.
로그를 확인해보니 배치에서 에러가 발생한 메소드를 찾을 수 있었고, 그 메소드에서는 총 3개의 테이블을 참조하고 있었다.
DynamoDB 테이블은 프로비전드(Provisioned) 모드와 온디맨드(On-Demand) 모드가 있는데 3개의 테이블 중 1개는 프로비전드 모드, 2개는 온디맨드 모드였다.
이번 에러에서는 아래의 에러 메시지를 보고 프로비전드 모드라고 판단했고, 따라서 손쉽게 어느 테이블에서 일어난 문제인지 찾을 수 있었다.
The level of configured provisioned throughput for the table was exceeded. Consider increasing your provisioning level with the UpdateTable API이 메시지는 configured provisioned throughput와 UpdateTable API를 직접 언급하므로, 프로비전드 모드에서 설정한 처리량을 초과한 상황으로 해석하는 것이라고 판단했다.
Resolution
섹션 제목: “Resolution”- 배치 처리에서 사용하는 프로비전드 모드 테이블의 인덱스 read capacity(RCU)를 미리 올리는 처리를 했다.
- 프로비전드 모드에서는 테이블과 인덱스의 capacity를 미리 지정하거나 조정할 수 있으므로, 그 기능을 이용해 DB 데이터를 가져오는 처리 전에 미리 조정했다.
Notes
섹션 제목: “Notes”1) 다시 볼 체크포인트
섹션 제목: “1) 다시 볼 체크포인트”- 예외 이름만 보지 말고
message와ThrottlingReasons를 같이 본다. configured provisioned throughput와UpdateTable API가 보이면 프로비전드 모드 처리량 초과를 먼저 의심한다.
2) 관련 지표 / 용어 / 주의점
섹션 제목: “2) 관련 지표 / 용어 / 주의점”ProvisionedThroughputExceededException은 throttling 상황에서 볼 수 있는 예외 이름이다.- 실제 진단은 예외 이름 하나보다
message,ThrottlingReasons, 영향받은 리소스를 같이 보는 편이 정확하다. - 프로비전드 모드에서는 테이블 자체뿐 아니라 GSI의 RCU/WCU 부족도 같은 계열 문제로 이어질 수 있다.
3) 참고 문서
섹션 제목: “3) 참고 문서”- AWS SDK / Botocore 예외 문서
https://docs.aws.amazon.com/botocore/latest/reference/services/dynamodb/client/exceptions/ProvisionedThroughputExceededException.html - 프로비저닝된 처리량 초과 https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/throttling-provisioned-capacity-exceeded-mitigation.html
- 온디맨드 최대 처리량 초과 https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/throttling-ondemand-capacity-exceeded-mitigation.html