Re: CXF Asynchronous call unsual delay

2016-01-20 Thread virajn
Found the problem. As Daniel stated my project loads
"org.apache.cxf.transport.http.URLConnectionHTTPConduit" instead of
"org.apache.cxf.transport.http.asyncclient.AsyncHTTPConduit" because class
path issue. Resolved it and working correctly. Following forum entry helped
to identify the issue.
http://stackoverflow.com/questions/24277043/verifying-cxf-httpasyncclient-use-of-use-async-http-conduit-contextual-property/24278430#24278430
 



--
View this message in context: 
http://cxf.547215.n5.nabble.com/CXF-Asynchronous-call-unsual-delay-tp5764706p5764935.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: CXF Asynchronous call unsual delay

2016-01-17 Thread virajn
How to increase the HTTPUrlConnection thread pool in JDK ? 
I have already increased tomcat thread pool and http thread priority ( set
to top priority). Also I have set set "keep.alive=true"
"http.maxConnections=200" in the JDK system properties. But the problem
still there. I have "cxf-rt-transports-http-hc-3.0.4.jar" in my classpath
also but with all these configuration problem is still there. When I stop
tests for few seconds and restart it, then at the beginning problem goes
away but after few minutes it comes again. Also i have increased
"org.apache.cxf.transport.http.async.MAX_CONNECTIONS" and
"org.apache.cxf.transport.http.async.usePolicy" property is set to
"ASYNC_ONLY". Is there a thread pool for async response handle ? if there is
how to increase it ?



--
View this message in context: 
http://cxf.547215.n5.nabble.com/CXF-Asynchronous-call-unsual-delay-tp5764706p5764828.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: CXF Asynchronous call unsual delay

2016-01-14 Thread Daniel Kulp

> On Jan 14, 2016, at 4:54 AM, virajn  wrote:
> 
> I have cxf web service and i'm using Asynchronous method calls. I'm using
> Callback approach ( using javax.xml.ws.AsyncHandler -
> http://cxf.apache.org/docs/developing-a-consumer.html ) to get the response
> as follows
> 
> Future asyncResponse = myWebService.testMethodAsync(param, new
> MyAsyncHandler());
> 
> This method works fine and I get the correct response. 
> 
> My problem is the performance. I measured the time taken just for above line
> and my application showing around 2000ms just for above line ( I did the
> test using jmeter). My application is deployed in tomcat and stated unusual
> delay happens after jmeter start nearly 50 threads. At the beginning of the
> test delay is under 5ms. But after few minutes it suddenly reach to near
> 1000ms then vary between approximately 900ms to 2000ms for 97% of the
> requests. 
> 
> I did the same test using standalone java cxf async client instead web
> application, but in that test above line always return under 5ms. Therefore
> I'm suspecting, in my web application there might be problem with thread
> scheduling ( because my web application do lot of other things while running
> the test and i can not stop these services without making drastic changes)
> OR is there any other problem here ? May be running out of thread pool used
> by cxf async client ?


Likely the thread pool.   By default, we use the HTTPUrlConnection in the JDK 
which is synchronous.   Thus, we dispatch the requests on background threads.  
The default pool is 25 threads so #26 has to wait for one of the other requests 
to finish.   

You have three options:

1) You can reconfigure the thread pool to be larger.   That really would just 
delay the problem further and suck up more resources though.

2) You could use the normal synchronous calls and then configure your web 
server to have a bigger thread pool for dispatches.   Since it’s ending up 
synchronous anyway, this may be easier.

3) Switch to using CXF’s async based transport.  Pretty much just add 
cxf-rt-transports-http-hc and the async client deps and it should work.   This 
uses the Apache HTTP AsyncClient instead of the JDK provide URLCOnnection which 
should allow true async waiting without he problems with blocked threads on the 
thread pool.



-- 
Daniel Kulp
dk...@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com