CXF increase connection pool size without changing

2019-05-14 00:17发布

I have recently been asked to configure CXF to the same parameters as our older XFire service.

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.

I would prefer not to change the http.maxConnections parameter as it would impact all the server instead of the CXF web services only.

I found this interresting forum thread talking about it where Daniel Kulp says:

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

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.

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 ?

1条回答
冷血范
2楼-- · 2019-05-14 01:03

According to what I read here, the keep-alive parameters can be controller either by system properties or directly in the HTTP headers:

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.

查看更多
登录 后发表回答