CXF增加连接池大小而不更改http.maxConnections [英] CXF increase connection pool size without changing http.maxConnections
问题描述
我最近被要求将CXF配置为与旧版XFire服务相同的参数。
I have recently been asked to configure CXF to the same parameters as our older XFire service.
其中一个参数是 Keep-Alive:timeout = 60,max = 20
。
但是,我做了一些研究,看来CXF使用了引擎盖下的JVM HttpURLConnection
对象。 从我看到的内容,有一些尝试为它提供配置,但没有已被提交。
One of those parameters was Keep-Alive: timeout=60, max=20
.
However, I did some research and it appears that CXF uses the JVM HttpURLConnection
object under the hood. From what I see, there has been some attempts to provide configuration for it but nothing has been commited for now.
我不想更改 http.maxConnections
参数,因为它会影响所有服务器而不是CXF Web服务。
I would prefer not to change the http.maxConnections
parameter as it would impact all the server instead of the CXF web services only.
我发现这个 interresting forum thread 在谈论Daniel Kulp所说的地方:
I found this interresting forum thread talking about it where Daniel Kulp says:
顺便说一句:有一种方法可以控制连接池,但这是一个
SERVER端的东西。基本上,如果服务器发回一个标题:
BTW: there is a way to control the connection pooling, but it's a SERVER side thing. Basically, if the server sends back a header of:
Keep-Alive:timeout = 60,max = 5
然后Java客户端将尊重这些值。现在在CXF,
你可能需要编写一个拦截器来设置这些值。
我刚刚提交了trunk,将http配置扩展到
包括一个设置来控制配置文件。
then the Java client will respect those values. Right now in CXF, you would probably need to write an interceptor to set those values. I just made a commit to trunk that expands the http configuration to include a setting to control this from the config file.
我可以编写一个拦截器来修改标题来执行此操作。但是我的问题是:服务器将如何应对这种变化?如果服务器期望最多5个连接并且客户端执行更多会不会有问题?
I could write an interceptor that modify the headers to do so. However my question is: How will the server react to this kind of change? Would not that be a problem if the server expects 5 connections max and the client performs more ?
推荐答案
根据我读到的内容< a href =http://docs.oracle.com/javase/1.5.0/docs/guide/net/http-keepalive.html\"rel =nofollow>这里,keep-alive参数可以可以通过系统属性控制,也可以直接在HTTP标头中控制:
According to what I read here, the keep-alive parameters can be controller either by system properties or directly in the HTTP headers:
对HTTP keep-Alive的支持是透明完成的。但是,它可以 b 由系统属性 http.keepAlive控制,
http.maxConnections,以及由HTTP / 1.1指定请求和
响应标题。
The support for HTTP keep-Alive is done transparently. However, it can be controlled by system properties http.keepAlive, and http.maxConnections, as well as by HTTP/1.1 specified request and response headers.
这篇关于CXF增加连接池大小而不更改http.maxConnections的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!