Pub/Sub 推送 return 503 进行基本缩放
Pub/Sub push return 503 for basic scaling
我正在使用 Pub/Sub 推送订阅,确认截止时间设置为 10 分钟,push
端点托管在 AppEngine 中,使用 basic
缩放。
在我的日志中,我看到一些 Pub/Sub(应该传送到启动实例)推送请求失败并显示 503
错误状态和 Request was aborted after waiting too long to attempt to service your request.
日志消息。此请求的执行时间从 10 秒(对于大多数请求)到其中一些请求最多 30 秒不等。
根据这篇文章 https://cloud.google.com/appengine/docs/standard/python/how-instances-are-managed#instance_scaling Deadlines
HTTP 请求是 24 小时,请求不应在 10 秒内中止。
有没有办法避免这种异常?
这些失败的请求很可能在 Pending Request Queue 中超时,这意味着没有可用的实例来为它们提供服务。这通常发生在 PubSub 消息以突发方式传递并且 App Engine 无法快速扩展以应对它们时。
减轻这种情况的一种选择是将缩放选项切换为 automatic scaling in your app.yaml file. You can tweak the min_pending_latency
and max_pending_latency
to better fit your scenario. You can also specify min_idle_instances
to get idle instances that would be ready to handle extra load (make sure to also enable and handle warmup requests)
考虑到 PubSub 将自动重试传递失败的消息。它将根据您的系统行为调整交付率,如文档 here 所述。因此,您可能会在消息高峰期间遇到一些错误,同时生成新实例,但您的消息最终会被处理(只要您设置 max_instances
足以处理负载)。
我正在使用 Pub/Sub 推送订阅,确认截止时间设置为 10 分钟,push
端点托管在 AppEngine 中,使用 basic
缩放。
在我的日志中,我看到一些 Pub/Sub(应该传送到启动实例)推送请求失败并显示 503
错误状态和 Request was aborted after waiting too long to attempt to service your request.
日志消息。此请求的执行时间从 10 秒(对于大多数请求)到其中一些请求最多 30 秒不等。
根据这篇文章 https://cloud.google.com/appengine/docs/standard/python/how-instances-are-managed#instance_scaling Deadlines
HTTP 请求是 24 小时,请求不应在 10 秒内中止。
有没有办法避免这种异常?
这些失败的请求很可能在 Pending Request Queue 中超时,这意味着没有可用的实例来为它们提供服务。这通常发生在 PubSub 消息以突发方式传递并且 App Engine 无法快速扩展以应对它们时。
减轻这种情况的一种选择是将缩放选项切换为 automatic scaling in your app.yaml file. You can tweak the min_pending_latency
and max_pending_latency
to better fit your scenario. You can also specify min_idle_instances
to get idle instances that would be ready to handle extra load (make sure to also enable and handle warmup requests)
考虑到 PubSub 将自动重试传递失败的消息。它将根据您的系统行为调整交付率,如文档 here 所述。因此,您可能会在消息高峰期间遇到一些错误,同时生成新实例,但您的消息最终会被处理(只要您设置 max_instances
足以处理负载)。