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 Yuvraj Waswani <Yu...@tavant.com> on 2003/09/09 15:17:05 UTC

RE: Out of Memory

Hi,

I am also facing serious performance issues with Axis. Currently, my
webservices are hosted through WebLogic based web service framework, and it
is behaving sanely. Whereas with Axis, I am getting JVM crashes and Out of
Memory Errors. 

Wanted to confirm whether the below mentioned way of changing Message.java
and SoapPart.java in axis source helped solve the problem?
Anybody has any clues or pointers towards performance issues of Axis?

Thanks.

-----Original Message-----
From: Benedick Mark Chan [mailto:bmchan@ntsp.nec.co.jp]
Sent: Saturday, August 30, 2003 4:21 PM
To: axis-user@ws.apache.org
Subject: Re: Out of Memory


Hello,

I'm sorry about my previous question with regards to the 500 internal server
error, I have already fixed to problem - I wasn't able to jar my classes
properly..

I have followed Sebastien's suggestion. But, still, it generates a broken
pipe and an out of memory exception. =(

For additional information, here's my service's code. Please help me.


public Vector returnVector ()
{
    Vector v = new Vector ();
    for (int i=0; i < 1000000; i++)
    {
        v.add("Vector");
    }
    System.out.println ("Done processing 1 million vector elements");
    return v;
}


Thanks.



----- Original Message -----
From: "Benedick Mark Chan" <bm...@ntsp.nec.co.jp>
To: <ax...@ws.apache.org>
Cc: <Se...@MKMV.com>
Sent: Wednesday, July 30, 2003 6:28 PM
Subject: Re: Out of Memory


> Hello Sebastien,
>
> Thanks for your reply.
>
> I have tried modifying the axis source code particularly Message.java and
> SOAPPart.java, but I got a 500 Internal Server Error.
>
> Do you have any solution with regards to this problem? Any help will be
> greatly appreciated.
>
> Best regards,
>
> Benedick
>
> ----- Original Message -----
> From: "Astie, Sebastien" <Se...@MKMV.com>
> To: <ax...@ws.apache.org>
> Sent: Friday, August 29, 2003 1:57 AM
> Subject: RE: Out of Memory
>
>
> > I had a similar problem and I solved the problem by modifying
> org.apache.axis.Message and org.apache.axis.SoapPart
> >
> > I hope it will solve your problem.
> >
> >
> > What I have done is :
> >
> > modify the method writeTo in SoapPart :
> >
> >  /**
> >      * Write the contents to the specified writer.
> >      */
> >     public void writeTo(Writer writer) throws IOException {
> >
> >         if ( currentForm == FORM_FAULT ) {
> >             AxisFault env = (AxisFault)currentMessage;
> >             try {
> >                 env.output(new SerializationContextImpl(writer,
> getMessage().getMessageContext()));
> >             } catch (Exception e) {
> >                 log.error(Messages.getMessage("exception00"), e);
> >                 throw env;
> >             }
> >             return;
> >         } else if ( currentForm == FORM_SOAPENVELOPE ) {
> >
> >
> >             SOAPEnvelope env = (SOAPEnvelope)currentMessage;
> >             try {
> >                 env.output(new SerializationContextImpl(writer,
> getMessage().getMessageContext()));
> >             } catch (Exception e) {
> >                 throw AxisFault.makeFault(e);
> >             }
> >             return;
> >         } else {
> >             writer.write(this.getAsString());
> >         }
> >
> >
> > then in Message :
> >
> > add a constant :
> >
> >     /**
> >      * This is the buffer size used to output xml contents.
> >      */
> >     public static int DEFAULT_OUTPUT_BUFF_SIZE = 1000000;
> >
> >
> > modify method getContentType
> >
> > public String getContentType(SOAPConstants sc) throws AxisFault {
> >
> >         int sendType = Attachments.SEND_TYPE_NOTSET;
> >         if ((msgContext != null) && (msgContext.getService() != null)) {
> >             sendType = msgContext.getService().getSendType();
> >         }
> >
> >         /*
> >             if (sendType != Attachments.SEND_TYPE_NONE) {
> >             //Force serialization if it hasn't happend it.
> >             //Rick Rineholt fix this later.
> >             mSOAPPart.getAsBytes();
> >         } */
> >
> >         String ret = sc.getContentType();
> >         if (mAttachments != null && 0 !=
> mAttachments.getAttachmentCount()) {
> >             ret = mAttachments.getContentType();
> >         }
> >         return ret;
> >     }
> >
> >
> >
> > modify method writeTo:
> >
> > public void writeTo(java.io.OutputStream os) throws SOAPException,
> IOException {
> >          //Do it the old fashion way.
> >         if (mAttachments == null || 0 ==
> mAttachments.getAttachmentCount()) {
> >             try {
> >                 Writer writer = new OutputStreamWriter(os,"UTF-8");
> >                 // writer = new BufferedWriter(writer);
> >                 writer = new BufferedWriter(writer,
> DEFAULT_OUTPUT_BUFF_SIZE);
> >                 mSOAPPart.writeTo(writer);
> >                 writer.flush();
> >             } catch (java.io.IOException e) {
> >                 log.error(Messages.getMessage("javaIOException00"), e);
> >             }
> >         } else {
> >             try {
> >                 mAttachments.writeContentToStream(os);
> >             } catch (java.lang.Exception e) {
> >                 log.error(Messages.getMessage("exception00"), e);
> >             }
> >         }
> >     }
> >
> >
> >
> > -----Original Message-----
> > From: Ekbote, Niranjan [mailto:NEkbote@doubleclick.net]
> > Sent: Thursday, August 28, 2003 10:17 AM
> > To: 'axis-user@ws.apache.org'
> > Subject: RE: Out of Memory
> >
> >
> > I am not sure if Axis supports streaming. I think that could solve your
> > problem.
> >
> > Thanks!
> >
> > -- Niranjan.
> >
> >
> > -----Original Message-----
> > From: Benedick Mark Chan [mailto:bmchan@ntsp.nec.co.jp]
> > Sent: Thursday, August 28, 2003 1:08 PM
> > To: axis-user@ws.apache.org
> > Subject: Re: Out of Memory
> >
> >
> > Hello David,
> >
> > Thanks for your reply.
> >
> > I have tried increasing my heap  size dramatically, but still it doesn't
> > work.
> >
> > Is this a limitation of axis? If so, then I guess chopping to several
> small
> > chucks will be my last resort. =(
> >
> > Thanks.
> >
> > -Benedick
> >
> > ----- Original Message -----
> > From: "David You" <Da...@hds.com>
> > To: <ax...@ws.apache.org>
> > Sent: Friday, August 29, 2003 1:03 AM
> > Subject: RE: Out of Memory
> >
> >
> > > 1. Are you sure WS is good solution for you?
> > > 2. If you are sure, try to config VM with more heap size.
> > > 3. still doesn't work? Try to chop it in several small chunk.
> > >
> > > David
> > >
> > > -----Original Message-----
> > > From: Benedick Mark Chan [mailto:bmchan@ntsp.nec.co.jp]
> > > Sent: Thursday, August 28, 2003 9:48 AM
> > > To: axis-user@ws.apache.org
> > > Subject: Out of Memory
> > >
> > >
> > > Hello guys,
> > >
> > > I would like to ask a question with regards to the memory usage of
> axis...
> > >
> > > I have tried populating 6 million strings to a vector, and return the
> > vector
> > > to the client. The server has successfully populated the vector with 6
> > > million
> > > strings, but when the server send the vector to the client, the server
> > > throws an
> > > out of memory exception. Is there any way to solve this problem?
Please
> > help
> > > me.
> > >
> > > Thanks.
> > >
> > > Sincerely Yours,
> > >
> > > Benedick
> > >
> >
>
>

Re: Out of Memory

Posted by Soma Shekar <so...@nextlinx.com>.
in the start up of the server provide  this option and try it out
-Xms64m -Xmx312m -XX:MaxPermSize=128m

if your are using tomcat ,in catalina.bat set CATALINA_OPTS
= -Xms64m -Xmx312m -XX:MaxPermSize=128m

hope this will be helpfull

Rgds
Soma Shekar
http://www.nextlinx.com

"The future doesn't belong to the fainthearted; it belongs to the brave."
--- Ronald Reagan

----- Original Message -----
From: "Yuvraj Waswani" <Yu...@tavant.com>
To: <ax...@ws.apache.org>
Sent: Tuesday, September 09, 2003 6:47 PM
Subject: RE: Out of Memory


> Hi,
>
> I am also facing serious performance issues with Axis. Currently, my
> webservices are hosted through WebLogic based web service framework, and
it
> is behaving sanely. Whereas with Axis, I am getting JVM crashes and Out of
> Memory Errors.
>
> Wanted to confirm whether the below mentioned way of changing Message.java
> and SoapPart.java in axis source helped solve the problem?
> Anybody has any clues or pointers towards performance issues of Axis?
>
> Thanks.
>
> -----Original Message-----
> From: Benedick Mark Chan [mailto:bmchan@ntsp.nec.co.jp]
> Sent: Saturday, August 30, 2003 4:21 PM
> To: axis-user@ws.apache.org
> Subject: Re: Out of Memory
>
>
> Hello,
>
> I'm sorry about my previous question with regards to the 500 internal
server
> error, I have already fixed to problem - I wasn't able to jar my classes
> properly..
>
> I have followed Sebastien's suggestion. But, still, it generates a broken
> pipe and an out of memory exception. =(
>
> For additional information, here's my service's code. Please help me.
>
>
> public Vector returnVector ()
> {
>     Vector v = new Vector ();
>     for (int i=0; i < 1000000; i++)
>     {
>         v.add("Vector");
>     }
>     System.out.println ("Done processing 1 million vector elements");
>     return v;
> }
>
>
> Thanks.
>
>
>
> ----- Original Message -----
> From: "Benedick Mark Chan" <bm...@ntsp.nec.co.jp>
> To: <ax...@ws.apache.org>
> Cc: <Se...@MKMV.com>
> Sent: Wednesday, July 30, 2003 6:28 PM
> Subject: Re: Out of Memory
>
>
> > Hello Sebastien,
> >
> > Thanks for your reply.
> >
> > I have tried modifying the axis source code particularly Message.java
and
> > SOAPPart.java, but I got a 500 Internal Server Error.
> >
> > Do you have any solution with regards to this problem? Any help will be
> > greatly appreciated.
> >
> > Best regards,
> >
> > Benedick
> >
> > ----- Original Message -----
> > From: "Astie, Sebastien" <Se...@MKMV.com>
> > To: <ax...@ws.apache.org>
> > Sent: Friday, August 29, 2003 1:57 AM
> > Subject: RE: Out of Memory
> >
> >
> > > I had a similar problem and I solved the problem by modifying
> > org.apache.axis.Message and org.apache.axis.SoapPart
> > >
> > > I hope it will solve your problem.
> > >
> > >
> > > What I have done is :
> > >
> > > modify the method writeTo in SoapPart :
> > >
> > >  /**
> > >      * Write the contents to the specified writer.
> > >      */
> > >     public void writeTo(Writer writer) throws IOException {
> > >
> > >         if ( currentForm == FORM_FAULT ) {
> > >             AxisFault env = (AxisFault)currentMessage;
> > >             try {
> > >                 env.output(new SerializationContextImpl(writer,
> > getMessage().getMessageContext()));
> > >             } catch (Exception e) {
> > >                 log.error(Messages.getMessage("exception00"), e);
> > >                 throw env;
> > >             }
> > >             return;
> > >         } else if ( currentForm == FORM_SOAPENVELOPE ) {
> > >
> > >
> > >             SOAPEnvelope env = (SOAPEnvelope)currentMessage;
> > >             try {
> > >                 env.output(new SerializationContextImpl(writer,
> > getMessage().getMessageContext()));
> > >             } catch (Exception e) {
> > >                 throw AxisFault.makeFault(e);
> > >             }
> > >             return;
> > >         } else {
> > >             writer.write(this.getAsString());
> > >         }
> > >
> > >
> > > then in Message :
> > >
> > > add a constant :
> > >
> > >     /**
> > >      * This is the buffer size used to output xml contents.
> > >      */
> > >     public static int DEFAULT_OUTPUT_BUFF_SIZE = 1000000;
> > >
> > >
> > > modify method getContentType
> > >
> > > public String getContentType(SOAPConstants sc) throws AxisFault {
> > >
> > >         int sendType = Attachments.SEND_TYPE_NOTSET;
> > >         if ((msgContext != null) && (msgContext.getService() != null))
{
> > >             sendType = msgContext.getService().getSendType();
> > >         }
> > >
> > >         /*
> > >             if (sendType != Attachments.SEND_TYPE_NONE) {
> > >             //Force serialization if it hasn't happend it.
> > >             //Rick Rineholt fix this later.
> > >             mSOAPPart.getAsBytes();
> > >         } */
> > >
> > >         String ret = sc.getContentType();
> > >         if (mAttachments != null && 0 !=
> > mAttachments.getAttachmentCount()) {
> > >             ret = mAttachments.getContentType();
> > >         }
> > >         return ret;
> > >     }
> > >
> > >
> > >
> > > modify method writeTo:
> > >
> > > public void writeTo(java.io.OutputStream os) throws SOAPException,
> > IOException {
> > >          //Do it the old fashion way.
> > >         if (mAttachments == null || 0 ==
> > mAttachments.getAttachmentCount()) {
> > >             try {
> > >                 Writer writer = new OutputStreamWriter(os,"UTF-8");
> > >                 // writer = new BufferedWriter(writer);
> > >                 writer = new BufferedWriter(writer,
> > DEFAULT_OUTPUT_BUFF_SIZE);
> > >                 mSOAPPart.writeTo(writer);
> > >                 writer.flush();
> > >             } catch (java.io.IOException e) {
> > >                 log.error(Messages.getMessage("javaIOException00"),
e);
> > >             }
> > >         } else {
> > >             try {
> > >                 mAttachments.writeContentToStream(os);
> > >             } catch (java.lang.Exception e) {
> > >                 log.error(Messages.getMessage("exception00"), e);
> > >             }
> > >         }
> > >     }
> > >
> > >
> > >
> > > -----Original Message-----
> > > From: Ekbote, Niranjan [mailto:NEkbote@doubleclick.net]
> > > Sent: Thursday, August 28, 2003 10:17 AM
> > > To: 'axis-user@ws.apache.org'
> > > Subject: RE: Out of Memory
> > >
> > >
> > > I am not sure if Axis supports streaming. I think that could solve
your
> > > problem.
> > >
> > > Thanks!
> > >
> > > -- Niranjan.
> > >
> > >
> > > -----Original Message-----
> > > From: Benedick Mark Chan [mailto:bmchan@ntsp.nec.co.jp]
> > > Sent: Thursday, August 28, 2003 1:08 PM
> > > To: axis-user@ws.apache.org
> > > Subject: Re: Out of Memory
> > >
> > >
> > > Hello David,
> > >
> > > Thanks for your reply.
> > >
> > > I have tried increasing my heap  size dramatically, but still it
doesn't
> > > work.
> > >
> > > Is this a limitation of axis? If so, then I guess chopping to several
> > small
> > > chucks will be my last resort. =(
> > >
> > > Thanks.
> > >
> > > -Benedick
> > >
> > > ----- Original Message -----
> > > From: "David You" <Da...@hds.com>
> > > To: <ax...@ws.apache.org>
> > > Sent: Friday, August 29, 2003 1:03 AM
> > > Subject: RE: Out of Memory
> > >
> > >
> > > > 1. Are you sure WS is good solution for you?
> > > > 2. If you are sure, try to config VM with more heap size.
> > > > 3. still doesn't work? Try to chop it in several small chunk.
> > > >
> > > > David
> > > >
> > > > -----Original Message-----
> > > > From: Benedick Mark Chan [mailto:bmchan@ntsp.nec.co.jp]
> > > > Sent: Thursday, August 28, 2003 9:48 AM
> > > > To: axis-user@ws.apache.org
> > > > Subject: Out of Memory
> > > >
> > > >
> > > > Hello guys,
> > > >
> > > > I would like to ask a question with regards to the memory usage of
> > axis...
> > > >
> > > > I have tried populating 6 million strings to a vector, and return
the
> > > vector
> > > > to the client. The server has successfully populated the vector with
6
> > > > million
> > > > strings, but when the server send the vector to the client, the
server
> > > > throws an
> > > > out of memory exception. Is there any way to solve this problem?
> Please
> > > help
> > > > me.
> > > >
> > > > Thanks.
> > > >
> > > > Sincerely Yours,
> > > >
> > > > Benedick
> > > >
> > >
> >
> >