I find an performance problem in ActiveMQ4.2-SNAPSHOT when 
i subscribe an topic and consume 500000 messages,the problem
is that the memory of CPU is  consumed increasely all long until
the  free heap of JVM's memory  is  zone. The client code like this:
                         if (message instanceof TextMessage) {
                                txtMsg = (TextMessage) message;
                                String msg = txtMsg.getText();
                                .....
                        }
I test this code by  JProfiler which is a tool of testing performance ,and
find the cause is the method of txtMsg.getText() ,its implement method is 
the org.apache.activemq.command.ActiveMQTextMessage.getText(),the code of
this method is :
package org.apache.activemq.command;
public class ActiveMQTextMessage extends ActiveMQMessage implements
TextMessage {
.......
 public String getText() throws JMSException {
        if (text == null && getContent() != null) {
            try {
                ByteSequence bodyAsBytes = getContent();
                if (bodyAsBytes != null) {
                    InputStream is = new ByteArrayInputStream(bodyAsBytes);
                    if( isCompressed() ) {
                        is = new InflaterInputStream(is);
                    }
                    DataInputStream dataIn = new DataInputStream(is);
                    text = MarshallingSupport.readUTF8(dataIn);
                    dataIn.close();
                    setContent(null);
                }
            } catch (IOException ioe) {
                throw JMSExceptionSupport.create(ioe);
            }
        }
        return text;
    }
......
}
In this code ,the instance  " is " is not closed ,i think must invoke
the method   in.close() to release the memory of JVM.I  suggest 
modify the method  ActiveMQTextMessage.getText().
-- 
View this message in context: 
http://www.nabble.com/Performance-problem-in-ActiveMQ4.2-SNAPSHOT-tf3973867s2354.html#a11280202
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply via email to