Google Cloud Platform:相同问题的不同HTTP错误。

huangapple go评论57阅读模式
英文:

Google cloud platform: http different http error for the same problem

问题

我正在使用Cloud Run,并且我已经检查到当请求被拒绝因为没有足够的实例可用时,Cloud Run会返回两种不同的HTTP错误代码。

错误信息是“请求已中止,因为没有可用的实例”。

随机地,它会返回HTTP错误 500 或HTTP 429(这是我预期的情况)。

GCP返回不同错误的原因是什么?

是否有可能分析原因?

是否有任何配置可以更改它?

问候

英文:

I'm working with Cloud Run and I've checked that when the request is rejected because there are not enough instances available Cloud run is returning two different HTTP error codes.

The error is "The request was aborted because there was no available instance".

Randomly it is returning Http error 500 or HTTP 429 (this is what I expect).

is there any reason why GCP is returning different errors?

is it possible to analyze the reason?

is there any config to change it?

Regards

答案1

得分: 1

429 和 500 应该是相同的待处理队列超时问题,当最大克隆设置为较低值时,快速扩展无法在请求激增时扩展应用服务器池。在这种情况下,一小部分请求可能会循环遍历所有可用的应用服务器,然后在最后一次尝试时附加 10 秒钟,然后被中止,并返回 429/500。

这里的 429 和 500 都是待处理队列超时后中止的请求。当请求被中止时,系统将检查当前的 unassigned_max_clones 是否为 0。如果为 0,则返回 429;否则,返回 500。

500 实质上与原始的 429 相同,其中一些是由于待处理队列超时而被中止,之后一些是由队列纪律丢弃的。(代码当前是否为 429 或 500 取决于应用程序服务状态中的一个数字,这可能会令人困惑)。

你还可以查看此 Cloud Run 故障排除文档

"由于没有可用实例而中止请求" 可能是 HTTP 429 或 HTTP 500。

  • 你将收到 HTTP 429:没有可用的容器实例

> 当资源由于用户配置的最大实例数而无法扩展时

  • 你将收到 HTTP 500:Cloud Run 无法管理流量速率

> 当资源由于流量而本质上无法扩展时

英文:

The 429 and 500 should be the same pending queue timeout issue when max clone is set to a low value, and rapid scaling cannot expand appserver pool when a spike of requests come in. In this case a small part of requests can loop over all available appservers, and then be appended for 10seconds at the last attempt, and aborted, and reply with 429/500.

Both 429 and 500 here are aborted requests after pending queue timeout.when a request is aborted, the system will check if current unassigned_max_clones is 0 or not. If it is 0, 429 is returned; otherwise, 500 is returned .

500s are essentially the same as original 429s, some are aborted by pending queue timeout, after that some are dropped by queue discipline. (whether the code is 429 or 500 currently depends on a number in app's serving state, which may be confusing)

You can also check this cloud run troubleshooting documentation

The request was aborted because there was no available instance is either HTTP 429 or HTTP 500

  • You will receive HTTP 429: No available container instances

>When the resource is unable to scale due to the user-configured max_instances

  • You will receive HTTP 500: Cloud Run couldn't manage the rate of traffic

>When the resource is unable to scale intrinsically due to the traffic

huangapple
  • 本文由 发表于 2023年6月12日 17:45:44
  • 转载请务必保留本文链接:https://go.coder-hub.com/76455410.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定