You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by hn488 <h....@accenture.com> on 2015/09/01 10:21:36 UTC

Idle connection timeout (keep-alive timeout)

It looks like the CXF web service client always shuts down an http connection
after 10 seconds of inactivity. How can I increase the keepalive timeout? (A
.net based client connecting to the same service has a much longer timeout.)

The behaviour is observed even with only one client and one request.
Platform: win2012r2, java 1.8.0_45, cxf 3.1.2.



--
View this message in context: http://cxf.547215.n5.nabble.com/Idle-connection-timeout-keep-alive-timeout-tp5760627.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Idle connection timeout (keep-alive timeout)

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi,
thanks for asking the question here (as opposed to in JIRA)

Perhaps the defaults in Java and Windows specific URL client libraries 
are different.

Can you please experiment with adding an Apache HttpClient based 
cxf-rt-transports-http-hc dependency, and setting a "use.async.conduit" 
property, example:

WebClient wc = ...
WebClient.getConfig(wc).getRequestContext().put("use.async.conduit");
wc.get();

or do an async GET call and do not even set that property.

other than that I'm not sure what else can be done.
See
http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html 
(the 'client' element part). It says the connection is expected to be 
kept alive if the server honors it and is closed otherwise (I'm 
presuming this is where a 10 secs default is used).
You can experiment with these properties,

WebClient.getConfig(wc).getHttpConduit().getClient()

perhaps another thing to try is to check if the timeout depends on which 
HTTP verb is used, ex, GET vs POST. If some difference is observed then 
perhaps that can point to some of HTTPUrlConnection code that can be 
bypassed by setting some properties, etc...

Please experiment and let us know...

Sergey

On 01/09/15 09:21, hn488 wrote:
> It looks like the CXF web service client always shuts down an http connection
> after 10 seconds of inactivity. How can I increase the keepalive timeout? (A
> .net based client connecting to the same service has a much longer timeout.)
>
> The behaviour is observed even with only one client and one request.
> Platform: win2012r2, java 1.8.0_45, cxf 3.1.2.
>
>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/Idle-connection-timeout-keep-alive-timeout-tp5760627.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>