OutOfMemoryError at WS call client side

View: New views
3 Messages — Rating Filter:   Alert me  

OutOfMemoryError at WS call client side

by Matthias.Gaiser :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

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.


Re: OutOfMemoryError at WS call client side

by Deepal Jayasinghe-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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



AW: OutOfMemoryError at WS call client side

by Matthias.Gaiser :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...]
Gesendet: Samstag, 7. November 2009 01:42
An: axis-user@...
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