gpt4 book ai didi

scala - akka http配置中的空闲超时和请求超时有什么区别?

转载 作者:行者123 更新时间:2023-12-02 04:34:39 24 4
gpt4 key购买 nike

我去了文档,发现了这些
# 空闲连接将自动关闭的时间。
# 设置为 infinite完全禁用空闲连接超时。
空闲超时 = 10 秒

# Defines the default time period within which the application has to
# produce an HttpResponse for any given HttpRequest it received.
# The timeout begins to run when the *end* of the request has been
# received, so even potentially long uploads can have a short timeout.
# Set to `infinite` to completely disable request timeout checking.
#
# If this setting is not `infinite` the HTTP server layer attaches a
# `Timeout-Access` header to the request, which enables programmatic
# customization of the timeout period and timeout response for each
# request individually.
request-timeout = 20 s

我有一个场景,我的服务器需要超过 10 秒来处理响应,但在发送 HTTPResponse 之前,客户端和服务器之间的 TCP 连接由于 而超时。空闲超时 .

虽然此时连接处于空闲状态,但请求仍在处理中。

我以为这是响应超时的责任?

在这种情况下,任何人都可以向我解释空闲超时和响应超时之间的区别吗?

最佳答案

文档有点困惑,我已经基于此运行了实验:

空闲超时:这是连接可以闲置的最长时间。它的行为与请求超时相同。例子 :

空闲超时 = 1 秒

应用程序已向第 3 方 API 发送请求并建立连接,但第 3 方未响应。然后你会得到一个超时异常。

“akka.stream.scaladsl.TcpIdleTimeoutException”

连接超时:500 毫秒。 它表示必须建立 Http 连接的最长时间(500 毫秒)。

关于scala - akka http配置中的空闲超时和请求超时有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44692435/

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