【发布时间】:2015-12-10 01:31:10
【问题描述】:
我在 spray-can 文档上读到它支持 HTTP 流水线。但是在任何地方都没有说明如何做到这一点的方法或示例。
【问题讨论】:
标签: scala akka spray spray-client spray-can
我在 spray-can 文档上读到它支持 HTTP 流水线。但是在任何地方都没有说明如何做到这一点的方法或示例。
【问题讨论】:
标签: scala akka spray spray-client spray-can
这是一个配置设置。有关 Spay 配置中的所有可用设置,请参阅 this 或 this 文档。
此设置将其打开:
spray.can.host-connector.pipelining = off
而且这个必须大于 1 才能有效地启用它:
spray.can.server.pipelining-limit = 1
默认情况下管道是关闭的。
各项设置的相关说明:
# The maximum number of requests that are accepted (and dispatched to # the application) on one single connection before the first request # has to be completed. # Incoming requests that would cause the pipelining limit to be exceeded # are not read from the connections socket so as to build up "back-pressure" # to the client via TCP flow control. # A setting of 1 disables HTTP pipelining, since only one request per # connection can be "open" (i.e. being processed by the application) at any # time. Set to higher values to enable HTTP pipelining. # Set to 'disabled' for completely disabling pipelining limits # (not recommended on public-facing servers due to risk of DoS attacks). # This value must be > 0 and <= 128. pipelining-limit = 1 # If this setting is enabled, the `HttpHostConnector` pipelines requests # across connections, otherwise only one single request can be "open" # on a particular HTTP connection. pipelining = off
【讨论】: