The bursts are quick enough to avoid the keep-alive timeout. I usually make 2 
requests per second for 3 or 4 seconds. The big problem here is that this 
service runs over SSL, so I have to create a new SSL connection for each 
request. This gets pretty expensive when the network is slow.

Unfortunately, I cannot try my webapp on Jetty. It would be too difficult to 
port it from Tomcat. But, I was able to create a test service that I can run in 
jetty. It seems that if I run the service non-secured, the Keep-Alive works. If 
I run the service over SSL, I get one connection per call.

In both cases, the KeepAliveParameters were ignored. They were not set in the 
headers. Perhaps this parameter is only valid for cxf-2.2?

John 


-----Original Message-----
From: Eoghan Glynn [mailto:[email protected]] 
Sent: Friday, April 03, 2009 4:48 AM
To: [email protected]
Subject: Re: CXF server not honoring Keep-Alive

Hi John,

AFAIK  the effect of setting HonorKeepAlive is only to suppress the
inclusion of Connection:close in the headers. So that much is indeed
occurring , given the response headers you're seeing..

The result should be that instead of EOF & connection closure being
used to terminate the response stream, the response would either be
chunked or include an explicit Content-Length header. This would allow
the client-side HttpURLConnection to reuse the connection if it so
desires. Again, you're seeing a Content-Length headers in the
response. All good so far.

On the client side, HttpUrlConnection by default only keeps 5
connections alive, for only 5 seconds each. Are your invocations
sufficiently bursty to avoid the kept-alive connections timing out?

Now I notice the KeepAliveParameters, which would be used to over-ride
the HttpUrlConnection max & timeout defaults, aren't actually being
propagated back to the client in a Keep-Alive header. I wonder if this
header is being striped out for some reason by Tomcat. Can you try
deploying your <jaxws:server> to a bare JVM, as opposed to Tomcat,
just to see if this header is properly set when Jetty provides the
HTTP listener?

Cheers,
Eoghan


2009/4/2 John Hite <[email protected]>:
> I've tried following the documentation to make the server honor keep-alive 
> requests but I cannot get it to work. Here's my setup.
>
> cxf-2.1.4
>
> cxf-servlet.xml
>
> <beans ...>
>            <jaxws:server id="MyService"
>                        serviceClass="com.example.soap.MyService"
>                        address="/MyService ">
>                        <jaxws:serviceBean>
>                                    <bean class="com.example.soap.MyService" />
>                        </jaxws:serviceBean>
>            </jaxws:server>
>
>            <http-conf:destination 
> name="{http://www.example.com/MyService}MyServicePort.http-destination"; >
>                        <http-conf:server HonorKeepAlive="true" 
> KeepAliveParameters="timeout=60, max=10;" />
>            </http-conf:destination>
> </beans>
>
> My WSDL Service definition
>
> <wsdl:definitions targetNamespace=" http://www.example.com/MyService"; ...>
> <wsdl:service name="MyService">
> <wsdl:port binding="tns:MyServiceSoapBinding" name="MyServicePort">
> <soap:address location="https://localhost/services/MyService"; />
>            </wsdl:port>
> </wsdl:service>
> </wsdl:definitions>
>
> My client sends the following HTTP headers
>
> Accept=[*], Connection=[Keep-Alive]
>
> I get a response from the server with these headers
>
> content-type=[text/xml;charset=UTF-8], Date=[Thu, 02 Apr 2009 22:14:23 GMT], 
> Content-Length=[5750], Server=[Apache-Coyote/1.1]
>
>
> I get 1 new connection every time I call a SOAP method.  I'm using 
> JaxWsProxyFactoryBean to setup my client and I only create 1 instance of the 
> client. Am I missing something? I want to keep my connection for a longer 
> period of time since the client often makes SOAP requests in large batches.
>
> Thanks,
> John
>

Reply via email to