CXF increases connection pool size without changing http.maxConnections
I was recently prompted to configure CXF to the same settings as our older XFire service.
One of these parameters was Keep-Alive: timeout=60, max=20
. However, I've done some research and it looks like CXF is using the JVM object HttpURLConnection
under the hood. From what I can see , there have been attempts to tweak the config for it, but nothing has been done so far.
I would prefer not to change the setting http.maxConnections
, as that would only affect the server and not just the CXF web services.
I found this interesting forum thread talking about it where Daniel Culp says:
BTW: There is a way to control the pooling, but that's the SERVER side of the matter. Basically, if the server sends back a header:
Keep-Alive: timeout=60, max=5
then the Java client will respect these values. Right now in CXF, you probably need to write an interceptor to set these values. I just made a commit for the trunk that extends the http config to include an option to control this from the config file.
I could write an interceptor that would modify the headers to do this. However, my question is, how does the server react to such changes? Isn't it a problem if the server is expecting 5 max connections and the client is doing more?
source to share
As per what I've read here , the keep-alive parameters can be controlled either by system properties or directly in the HTTP headers:
HTTP keep-alive support is transparent. However, it can be controlled by the system properties http.keepAlive and http.maxConnections, as well as by HTTP / 1.1 specified request and response headers .
source to share