You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Håkon Sagehaug <Ha...@bccs.uib.no> on 2009/10/09 13:02:09 UTC

Increase performance using axis 2 client stubs

hi all,

In our project we've got a web portal that uses web services, that we call
by generating stubs using axis2 lib, as the back bone. I'm looking for ways
to improve the performance in  the calling bit now I've stated reusing the
HttpClient object that is used, we have a Util class that wrappes the logic
of calliing  all the services so for now we're interacting with three, and
all uses the same HttpClient object. Should every call be inside a
syncronized block?like this

    synchronized(httpClient){
        call service
        }

Or is it a better way to do this?Could the http clients be in a pool managed
by tomcat in some way?

Also if there is any other tricks on how to increase performace on client
side axis2 calls, please say how

cheers, Håkon

-- 
Håkon Sagehaug, Scientific Programmer
Parallab, Bergen Center for Computational Science (BCCS)
UNIFOB AS (University of Bergen Research Company)

Re: Increase performance using axis 2 client stubs

Posted by mfr <fr...@gmail.com>.
Again apologies in advance if I've misunderstood.....

You talked of a util that encapsulates three WS client stub calls (all calls
on the same HttpClient object). 
This util executes in a web container thread triggered by a request to your
portal app. You want to speed up the execution of the util.

My observation/suggestion is that, assuming the WS calls don't *need* to be
consecutive, you can speed things up by making all of the WS calls
simultaneously.

As it stands, it sounds to me like all of the action happens in the single
web container thread allocated to the request. The util executes in this
thread, the util makes calls to each of the stubs it holds, also in this
single thread.

It's with multiple threads (and stubs), not a pool of connections, that you
can make the stub calls simultaneous.  (although pooling the
stubs/connections should certainly help performance too)

To do this your util must create the extra threads it needs, or take them
from a threadpool, or whatever. In any case it needs to call each stub in a
separate thread, not just in the single thread allocated to the request.

Regards,

Michael



Håkon Sagehaug wrote:
> 
> Hi
> 
> Thanks for the replys,
> 
> I could tell little more about my setup perhaps. I've got on
> eConfigurationContext that is shared between the stubs, each service has
> one
> stub "connecte" to it. Thw web app is running inside tomcat, so the util
> class that is responsible for calling managing the stubs, is I guess on
> instance per thread, if on erequest to the web app equals one thread.
> Hence
> one stub per service per thread.
> 
> One way to go is a pool of stunbs I guess shared by the web application.
> 
> 
> cheers, Håkon
> 2009/10/9 mfr <fr...@gmail.com>
> 
>>
>> From memory (apologies in advance if this is off the mark), I think it's
>> the
>> axis2 client stub that will serialize multiple calls - i.e. will finish
>> one
>> request/response before beginning another. So if you want to parallelize
>> the
>> calls, what's needed is multiple client stubs, and multiple threads to
>> run
>> them in.
>>
>> [I used java.util.concurrent.ThreadPoolExecutor, one stub object per
>> thread,
>> to do some basic load testing of a service.]
>>
>> Regards,
>>
>> Michael
> 
> 

-- 
View this message in context: http://www.nabble.com/Increase-performance-using-axis-2-client-stubs-tp25819232p25822510.html
Sent from the Axis - User mailing list archive at Nabble.com.


Re: Increase performance using axis 2 client stubs

Posted by Håkon Sagehaug <Ha...@bccs.uib.no>.
Hi

Thanks for the replys,

I could tell little more about my setup perhaps. I've got on
eConfigurationContext that is shared between the stubs, each service has one
stub "connecte" to it. Thw web app is running inside tomcat, so the util
class that is responsible for calling managing the stubs, is I guess on
instance per thread, if on erequest to the web app equals one thread. Hence
one stub per service per thread.

One way to go is a pool of stunbs I guess shared by the web application.


cheers, Håkon
2009/10/9 mfr <fr...@gmail.com>

>
> From memory (apologies in advance if this is off the mark), I think it's
> the
> axis2 client stub that will serialize multiple calls - i.e. will finish one
> request/response before beginning another. So if you want to parallelize
> the
> calls, what's needed is multiple client stubs, and multiple threads to run
> them in.
>
> [I used java.util.concurrent.ThreadPoolExecutor, one stub object per
> thread,
> to do some basic load testing of a service.]
>
> Regards,
>
> Michael
>
>
>
> Håkon Sagehaug wrote:
> >
> > Hi
> >
> > One more thing I create the HttpClient object like this
> >
> > MultiThreadedHttpConnectionManager conMrg = new
> > MultiThreadedHttpConnectionManager();
> >
> >         conMrg.getParams().setDefaultMaxConnectionsPerHost(10);
> >         httpClient = new HttpClient(conMrg);
> >
> >
> > cheers, Håkon
> > 2009/10/9 Håkon Sagehaug <Ha...@bccs.uib.no>
> >
> >> hi all,
> >>
> >> In our project we've got a web portal that uses web services, that we
> >> call
> >> by generating stubs using axis2 lib, as the back bone. I'm looking for
> >> ways
> >> to improve the performance in  the calling bit now I've stated reusing
> >> the
> >> HttpClient object that is used, we have a Util class that wrappes the
> >> logic
> >> of calliing  all the services so for now we're interacting with three,
> >> and
> >> all uses the same HttpClient object. Should every call be inside a
> >> syncronized block?like this
> >>
> >>     synchronized(httpClient){
> >>         call service
> >>         }
> >>
> >> Or is it a better way to do this?Could the http clients be in a pool
> >> managed by tomcat in some way?
> >>
> >> Also if there is any other tricks on how to increase performace on
> client
> >> side axis2 calls, please say how
> >>
> >> cheers, Håkon
> >>
> >> --
> >> Håkon Sagehaug, Scientific Programmer
> >> Parallab, Bergen Center for Computational Science (BCCS)
> >> UNIFOB AS (University of Bergen Research Company)
> >>
> >
> >
> >
> > --
> > Håkon Sagehaug, Scientific Programmer
> > Parallab, Bergen Center for Computational Science (BCCS)
> > UNIFOB AS (University of Bergen Research Company)
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Increase-performance-using-axis-2-client-stubs-tp25819232p25819536.html
> Sent from the Axis - User mailing list archive at Nabble.com.
>
>


-- 
Håkon Sagehaug, Scientific Programmer
Parallab, Bergen Center for Computational Science (BCCS)
UNIFOB AS (University of Bergen Research Company)

Re: Increase performance using axis 2 client stubs

Posted by mfr <fr...@gmail.com>.
>From memory (apologies in advance if this is off the mark), I think it's the
axis2 client stub that will serialize multiple calls - i.e. will finish one
request/response before beginning another. So if you want to parallelize the
calls, what's needed is multiple client stubs, and multiple threads to run
them in.

[I used java.util.concurrent.ThreadPoolExecutor, one stub object per thread,
to do some basic load testing of a service.]

Regards,

Michael



Håkon Sagehaug wrote:
> 
> Hi
> 
> One more thing I create the HttpClient object like this
> 
> MultiThreadedHttpConnectionManager conMrg = new
> MultiThreadedHttpConnectionManager();
> 
>         conMrg.getParams().setDefaultMaxConnectionsPerHost(10);
>         httpClient = new HttpClient(conMrg);
> 
> 
> cheers, Håkon
> 2009/10/9 Håkon Sagehaug <Ha...@bccs.uib.no>
> 
>> hi all,
>>
>> In our project we've got a web portal that uses web services, that we
>> call
>> by generating stubs using axis2 lib, as the back bone. I'm looking for
>> ways
>> to improve the performance in  the calling bit now I've stated reusing
>> the
>> HttpClient object that is used, we have a Util class that wrappes the
>> logic
>> of calliing  all the services so for now we're interacting with three,
>> and
>> all uses the same HttpClient object. Should every call be inside a
>> syncronized block?like this
>>
>>     synchronized(httpClient){
>>         call service
>>         }
>>
>> Or is it a better way to do this?Could the http clients be in a pool
>> managed by tomcat in some way?
>>
>> Also if there is any other tricks on how to increase performace on client
>> side axis2 calls, please say how
>>
>> cheers, Håkon
>>
>> --
>> Håkon Sagehaug, Scientific Programmer
>> Parallab, Bergen Center for Computational Science (BCCS)
>> UNIFOB AS (University of Bergen Research Company)
>>
> 
> 
> 
> -- 
> Håkon Sagehaug, Scientific Programmer
> Parallab, Bergen Center for Computational Science (BCCS)
> UNIFOB AS (University of Bergen Research Company)
> 
> 

-- 
View this message in context: http://www.nabble.com/Increase-performance-using-axis-2-client-stubs-tp25819232p25819536.html
Sent from the Axis - User mailing list archive at Nabble.com.


Re: Increase performance using axis 2 client stubs

Posted by Håkon Sagehaug <Ha...@bccs.uib.no>.
Hi

One more thing I create the HttpClient object like this

MultiThreadedHttpConnectionManager conMrg = new
MultiThreadedHttpConnectionManager();

        conMrg.getParams().setDefaultMaxConnectionsPerHost(10);
        httpClient = new HttpClient(conMrg);


cheers, Håkon
2009/10/9 Håkon Sagehaug <Ha...@bccs.uib.no>

> hi all,
>
> In our project we've got a web portal that uses web services, that we call
> by generating stubs using axis2 lib, as the back bone. I'm looking for ways
> to improve the performance in  the calling bit now I've stated reusing the
> HttpClient object that is used, we have a Util class that wrappes the logic
> of calliing  all the services so for now we're interacting with three, and
> all uses the same HttpClient object. Should every call be inside a
> syncronized block?like this
>
>     synchronized(httpClient){
>         call service
>         }
>
> Or is it a better way to do this?Could the http clients be in a pool
> managed by tomcat in some way?
>
> Also if there is any other tricks on how to increase performace on client
> side axis2 calls, please say how
>
> cheers, Håkon
>
> --
> Håkon Sagehaug, Scientific Programmer
> Parallab, Bergen Center for Computational Science (BCCS)
> UNIFOB AS (University of Bergen Research Company)
>



-- 
Håkon Sagehaug, Scientific Programmer
Parallab, Bergen Center for Computational Science (BCCS)
UNIFOB AS (University of Bergen Research Company)

RE: Increase performance using axis 2 client stubs

Posted by Paul French <pa...@kirona.com>.
Here is some code we use. Basically it uses commons pooling and creates a
pool of stubs. The expensive operation of creating the axis2 configuration
etc is only done once.
 
It would be simple to wrap it as a proxy of your stub interface and put the
attached code in the proxy and so the implementation details hidden from the
caller.
 
Hope it helps.
 
P

  _____  

From: hakon.sagehaug@googlemail.com [mailto:hakon.sagehaug@googlemail.com]
On Behalf Of Håkon Sagehaug
Sent: 09 October 2009 12:02
To: axis-user@ws.apache.org
Subject: Increase performance using axis 2 client stubs


hi all,

In our project we've got a web portal that uses web services, that we call
by generating stubs using axis2 lib, as the back bone. I'm looking for ways
to improve the performance in  the calling bit now I've stated reusing the
HttpClient object that is used, we have a Util class that wrappes the logic
of calliing  all the services so for now we're interacting with three, and
all uses the same HttpClient object. Should every call be inside a
syncronized block?like this

    synchronized(httpClient){
        call service
        }

Or is it a better way to do this?Could the http clients be in a pool managed
by tomcat in some way? 

Also if there is any other tricks on how to increase performace on client
side axis2 calls, please say how

cheers, Håkon

-- 
Håkon Sagehaug, Scientific Programmer
Parallab, Bergen Center for Computational Science (BCCS)
UNIFOB AS (University of Bergen Research Company)