在使用 AWS Glue 时,如何防止 ThrottlingException(节流异常)或超出 Rate 错误?

1 分钟阅读
0

当我调用 AWS Glue API 时,我收到一条 ThrottlingException 错误消息,表明我的 Rate 已超过。

简短描述

当您发出 AWS Glue API 请求时,您可能会收到类似于以下内容之一的错误:

  • "Error Code: ThrottlingException; Request ID: 07512ede-123f-49c8-8933-1298742297b9; Proxy: null)" } }{ "taskSubmitFailedEventDetails": { "resourceType": "glue", "resource": "startJobRun.sync", "error": "Glue.AWSGlueException", "cause": "Rate exceeded (Service: AWSGlue; Status Code: 400;"
  • "TaskSubmitFailed": {"resourceType": "glue", "resource": "startJobRun.sync", "error": "Glue.AWSGlueException", "cause": "Rate exceeded (Service: AWSGlue; Status Code: 400; Error Code: ThrottlingException; Request ID: 70ea5ab7-2bb8-4a47-b957-799ef46c129e; Proxy: null)" }"
  • "botocore.exceptions.ClientError: An error occurred (ThrottlingException) when calling the GetCrawler operation (reached max retries: 4): Rate exceeded cause": "Rate exceeded (Service: AWSGlue; Status Code: 400; Error Code: ThrottlingException; Request ID: 70ea5ab7-2bb8-4a47-b957-799ef46c129e; Proxy: null)"

AWS Glue API 请求在每个区域的基础上针对 AWS 账户进行限制,以帮助提高服务性能。有关更多信息,请参阅 AWS Glue 端点和配额

解决方法

请遵循以下最佳做法来缓解 ThrottlingException 或超出 Rate 错误:

  • 减少 API 调用的频率。
  • 错开 API 调用之间的间隔,这样它们就不会同时运行。
  • 使用返回多个值的 API。例如,GetPartitions 支持一个 API 调用对 1000 个值的调用。同样,GetTables 支持一个 API 调用对 100 个参数的调用。
  • 在进行 API 调用时实施错误重试和指数回退
  • 使用 AWS CloudTrail 控制台,检查在给定的时间段内发送了哪些 API 调用以及发送了多少 API 调用。

如果您已经尝试了这些故障排除步骤,但仍然收到 Rate 超过错误,那么请求增加服务配额

**注意:**在提交增加配额的请求之前,请确定导致错误的 API 调用和调用率。


相关信息

常见错误

AWS 官方
AWS 官方已更新 1 年前