You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by "Brendan Maguire (brmaguir)" <br...@cisco.com> on 2007/12/18 18:44:40 UTC

Set duration Keep-Alive connection is used for

Hi,
 
How do I set the amount of time for which the Keep-Alive connection will
be reused for?
 
The situation is the client makes a request to the server. It then waits
for a certain amount of time (about 10 seconds) before making the next
request. The second request is made over a different port even though
the Keep-Alive connection setting is set in cxf.xml.
 
But when the second request is made inside about 4 seconds of the
previous request the same port will be used.
 
I tried setting the ConnectionTimeout and ReceiveTimeout variables in
cxf.xml to 60000 each but this made no difference.
 
I can't find the setting anywhere for this. Any ideas?
 
Cheers,
Brendan
 
 	
Brendan Maguire
Software Engineer
Unified Communications

brmaguir@cisco.com
Phone :+353 91 384676


Cisco Systems, Inc.
Block 10
Galway Technology Park
Parkmore
Galway
Ireland
Ireland
www.cisco.com/global/UK/

 	
 	
This e-mail may contain confidential and privileged material for the
sole use of the intended recipient. Any review, use, distribution or
disclosure by others is strictly prohibited. If you are not the intended
recipient (or authorized to receive for the recipient), please contact
the sender by reply e-mail and delete all copies of this message.	
 


 

RE: Set duration Keep-Alive connection is used for

Posted by "Tully, Gary" <Ga...@iona.com>.
Hi Brendan,

CXF uses HTTPURlConnection from the jdk which looks after keepalive on
the client side.

The keepalive value for a given connection is taken from the http
Keep-Alive header if present but defaults to 5 seconds if absent.

I don't see anywhere that the keep-alive values are set by the CXF http
(server side) destination. It should be configurable I think.

This is CXF to CXF communications, right?


You could try setting the headers from your server implementation:

Setting the HTTP header values in your response:
  "Connection keep-alive" and "Keep-Alive max=20" 

The client should respect the 20 as a 20 second keepalive timeout.

If in JAXWS mode, use the
javax.xml.ws.handler.MessageContext.HTTP_RESPONSE_HEADERS to set the
header values.

Hope this helps,
Gary.

> -----Original Message-----
> From: Brendan Maguire (brmaguir) [mailto:brmaguir@cisco.com] 
> Sent: 18 December 2007 17:45
> To: cxf-dev@incubator.apache.org
> Subject: Set duration Keep-Alive connection is used for
> 
> Hi,
>  
> How do I set the amount of time for which the Keep-Alive 
> connection will be reused for?
>  
> The situation is the client makes a request to the server. It 
> then waits for a certain amount of time (about 10 seconds) 
> before making the next request. The second request is made 
> over a different port even though the Keep-Alive connection 
> setting is set in cxf.xml.
>  
> But when the second request is made inside about 4 seconds of 
> the previous request the same port will be used.
>  
> I tried setting the ConnectionTimeout and ReceiveTimeout 
> variables in cxf.xml to 60000 each but this made no difference.
>  
> I can't find the setting anywhere for this. Any ideas?
>  
> Cheers,
> Brendan
>  
>  
> <http://www.cisco.com/global/EMEA/brand/signature/default/spac
> er.gif> 	
> Brendan Maguire
> Software Engineer
> Unified Communications
> 
> brmaguir@cisco.com
> Phone :+353 91 384676
> 
> 
> Cisco Systems, Inc.
> Block 10
> Galway Technology Park
> Parkmore
> Galway
> Ireland
> Ireland
> www.cisco.com/global/UK/
> 
>  	
>  
> <http://www.cisco.com/global/EMEA/brand/signature/default/foot
> erHead.gif> 	
> This e-mail may contain confidential and privileged material 
> for the sole use of the intended recipient. Any review, use, 
> distribution or disclosure by others is strictly prohibited. 
> If you are not the intended recipient (or authorized to 
> receive for the recipient), please contact the sender by 
> reply e-mail and delete all copies of this message.	
>  
> <http://www.cisco.com/global/EMEA/brand/signature/default/footer.gif> 
> 
> 
>  
> 

----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland