【问题标题】:How to enable HTTP Pipelining with Spray-Can如何使用 Spray-Can 启用 HTTP 流水线
【发布时间】:2015-12-10 01:31:10
【问题描述】:

我在 spray-can 文档上读到它支持 HTTP 流水线。但是在任何地方都没有说明如何做到这一点的方法或示例。

【问题讨论】:

    标签: scala akka spray spray-client spray-can


    【解决方案1】:

    这是一个配置设置。有关 Spay 配置中的所有可用设置,请参阅 thisthis 文档。

    此设置将其打开:

    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
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-03-18
      • 2012-07-31
      • 2013-01-26
      • 2011-04-02
      • 1970-01-01
      • 2012-01-08
      • 2011-07-04
      • 1970-01-01
      相关资源
      最近更新 更多