gpt4 book ai didi

rest - 在什么情况下 REST API 应该返回 HTTP Status 503

转载 作者:行者123 更新时间:2023-12-05 04:11:40 26 4
gpt4 key购买 nike

标准说:

10.5.4 503 服务不可用。由于服务器临时过载或维护,服务器当前无法处理请求。言下之意,这是一种暂时的情况,会在一段时间后得到缓解。

编号:https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html

如果服务器在数据库访问级别存在锁争用,服务器是否应该在这种情况下返回 503。或者 503 状态意味着:

  • 网络过载
  • DOS 类型情况
  • 最大负载平衡
  • 明确的维护窗口。

还有哪些情况下返回 HTTP 状态 503 是有意义的。

非常感谢任何详细的说明。

最佳答案

The updated spec , 供引用。

If the server is having lock contension at the database access level, should the server return 503 in such cases

请记住,在 REST 模型中,HTTP 状态代码不是用来描述服务中的问题;他们反而描述了文档存储中的类似条件。

503 是文档存储说“我太忙了,稍后再试”的方式。

What other circumstances it makes sense to return HTTP status 503.

背压。来自 Martin Thompson

Applying back pressure is one effective technique for coping with sustained high-load, such that maximum throughput can be delivered without degrading system performance for the already accepted requests and transactions.

When we need to support synchronous protocols like REST then use back pressure, signalled by our full incoming queue at the gateway, to send a meaningful “server busy” message such as the HTTP 503 status code

关于rest - 在什么情况下 REST API 应该返回 HTTP Status 503,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42317792/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com