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 Ma...@t-systems.com on 2009/11/06 18:42:40 UTC

OutOfMemoryError at WS call client side

Dear Axis users,

 

I currently have a memory problem when using Axis2. I implement a client
for web service calls in a generic way, so that I can use my client for
different types of services. My code to call the service generally looks
like this:

 

ServiceClient sender = new ServiceClient(confContext, null);

setHeadersAndOptions(sender); //engaging modules and setting endpoint,
etc.

MessageContext reqMctx = createPayload(sender); //creating the request
MessageContext

OperationClient oc = sender.createClient(ServiceClient.ANON_OUT_IN_OP);

oc.addMessageContext(reqMctx);

oc.execute(true);

 

Through analyzing the heapdump I saw that inside the AxisConfiguration,
a lot of AxisService instances are stored in a HashMap, around 10.000 in
my case. I am using my AxisConfiguration as a static object for all
calls since the Configuration does not change. Is it not a good idea to
handle it thias way?

 

I am thankful for any advise.

 

Matthias.


AW: OutOfMemoryError at WS call client side

Posted by Ma...@t-systems.com.
Hi,

I like to share the solution I have so far.

I am involved in implementing a middleware which has to perform lots of web service calls, also in parallel. This means we cannot just share a service client for all our requests.

I've found through debugging axis2 code that calling serviceClient.cleanup(), after I performed my web service call, removes the generated anonymous AxisService from the AxisConfiguration. I am assuming that this will prevent the OutOfMemoryError, but I could not verify it in tests yet.
Can someone confirm that using the serviceClient this way is a good idea?

Thank you,
Matthias.

-----Ursprüngliche Nachricht-----
Von: Deepal jayasinghe [mailto:deepalk@gmail.com] 
Gesendet: Samstag, 7. November 2009 01:42
An: axis-user@ws.apache.org
Betreff: Re: OutOfMemoryError at WS call client side

Hi,
This is one of the common problem most of the users usually face. The
reason behind this is whenever you create a serviceClient, it creates an
AxisService and added to AxisConfiguration. In order to overcome this
issues, create one service client and reuse that.

Thanks,
Deepal
>
> Dear Axis users,
>
>  
>
> I currently have a memory problem when using Axis2. I implement a
> client for web service calls in a generic way, so that I can use my
> client for different types of services. My code to call the service
> generally looks like this:
>
>  
>
> ServiceClient sender = *new* ServiceClient(/confContext/, *null*);
>
> setHeadersAndOptions(sender); //engaging modules and setting endpoint,
> etc.
>
> MessageContext reqMctx = createPayload(sender); //creating the request
> MessageContext
>
> OperationClient oc = sender.createClient(ServiceClient./ANON_OUT_IN_OP/);
>
> oc.addMessageContext(reqMctx);
>
> oc.execute(*true*);
>
>  
>
> Through analyzing the heapdump I saw that inside the
> AxisConfiguration, a lot of AxisService instances are stored in a
> HashMap, around 10.000 in my case. I am using my AxisConfiguration as
> a static object for all calls since the Configuration does not change.
> Is it not a good idea to handle it thias way?
>
>  
>
> I am thankful for any advise.
>
>  
>
> Matthias.
>


-- 
Thank you!


http://blogs.deepal.org
http://deepal.org



Re: OutOfMemoryError at WS call client side

Posted by Deepal jayasinghe <de...@gmail.com>.
Hi,
This is one of the common problem most of the users usually face. The
reason behind this is whenever you create a serviceClient, it creates an
AxisService and added to AxisConfiguration. In order to overcome this
issues, create one service client and reuse that.

Thanks,
Deepal
>
> Dear Axis users,
>
>  
>
> I currently have a memory problem when using Axis2. I implement a
> client for web service calls in a generic way, so that I can use my
> client for different types of services. My code to call the service
> generally looks like this:
>
>  
>
> ServiceClient sender = *new* ServiceClient(/confContext/, *null*);
>
> setHeadersAndOptions(sender); //engaging modules and setting endpoint,
> etc.
>
> MessageContext reqMctx = createPayload(sender); //creating the request
> MessageContext
>
> OperationClient oc = sender.createClient(ServiceClient./ANON_OUT_IN_OP/);
>
> oc.addMessageContext(reqMctx);
>
> oc.execute(*true*);
>
>  
>
> Through analyzing the heapdump I saw that inside the
> AxisConfiguration, a lot of AxisService instances are stored in a
> HashMap, around 10.000 in my case. I am using my AxisConfiguration as
> a static object for all calls since the Configuration does not change.
> Is it not a good idea to handle it thias way?
>
>  
>
> I am thankful for any advise.
>
>  
>
> Matthias.
>


-- 
Thank you!


http://blogs.deepal.org
http://deepal.org