【发布时间】:2015-01-15 12:04:23
【问题描述】:
我们目前正在将一个 tomcat 应用程序移植到一个 spray/scala 应用程序。
我们的旧应用程序有这样的设置:
<Connector port="8082" protocol="HTTP/1.1"
maxThreads="1000"
maxConnections="10000"
processorCache="500"
connectionTimeout="20000"
URIEncoding="UTF-8"
redirectPort="8443" />
在新的应用程序中,我们希望在 spray 中设置 maxThreads/maxConnections 的等效项。
我看到了 spray reference.conf 文件(如下),我想知道这些是否确实是要更改的正确设置?
还是我应该配置正在执行 runRoute 的参与者?
还是两者都有?
我确实发现低“max-connections = 4”默认值有点奇怪,如果这确实是服务器连接限制的话。
host-connector {
# The maximum number of parallel connections that an `HttpHostConnector`
# is allowed to establish to a host. Must be greater than zero.
max-connections = 4
# The maximum number of times an `HttpHostConnector` attempts to repeat
# failed requests (if the request can be safely retried) before
# giving up and returning an error.
max-retries = 5
# Configures redirection following.
# If set to zero redirection responses will not be followed, i.e. they'll be returned to the user as is.
# If set to a value > zero redirection responses will be followed up to the given number of times.
# If the redirection chain is longer than the configured value the first redirection response that is
# is not followed anymore is returned to the user as is.
max-redirects = 0
# 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
# The time after which an idle `HttpHostConnector` (without open
# connections) will automatically terminate itself.
# Set to `infinite` to completely disable idle timeouts.
idle-timeout = 30 s
# Modify to tweak client settings for this host-connector only.
client = ${spray.can.client}
}
【问题讨论】: