activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mvilleta <mvill...@cafsignalling.com>
Subject Question about listeners performance
Date Fri, 26 Apr 2013 14:15:00 GMT
Good Afternoon,

Thanks for all the sugestions. I applied the prefetchedSize property and I
set it to 1 (it's because I'm not interesting in prefetch any message). I
continue with the same problem. For simplify my case, I developed an small
example, and I took different snapshots that I attached to this message (and
the source too). My example make the following:

*Producer code - main class -*

ConnectionFactory connectionFactory = new
ActiveMQConnectionFactory(url+"?jms.prefetchPolicy.all=1");
Connection connection = connectionFactory.createConnection();
connection.start();
Session session = connection.createSession(false,Session.AUTO_ACKNOWLEDGE);
Destination destination = session.createQueue(subject);
MessageProducer producer = session.createProducer(destination);
while (true)
{
	Event evento = new Event("Event1");
	ObjectMessage msj = session.createObjectMessage(event);
	msj5.setJMSType(msj5.getClass().getSimpleName());
	msj5.setJMSReplyTo(destination);
	producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
	producer.send(msj5, DeliveryMode.NON_PERSISTENT, 5, 0);
	Thread.sleep(1000);
}


*Consumer code -main class-*

ConnectionFactory connectionFactory = new
ActiveMQConnectionFactory(url+"?jms.prefetchPolicy.all=1");
Connection connection = connectionFactory.createConnection();
session = connection.createSession(true, 0);
Destination destination = session.createQueue(subject);
MessageConsumer consumer = session.createConsumer(destination);
//This is my listener
Escuchador escuchador = new Escuchador();
consumer.setMessageListener(escuchador);
connection.start();


*Listener code*

public void onMessage(Message message)
{
    if (message instanceof ObjectMessage)
    {
       try
    	{
	   ObjectMessage msj = (ObjectMessage) message;
           Object obj = msj.getObject();
           if (obj instanceof Event)
           {
             Event event = (Event) obj;
             System.out.println("Event: " + event.toString());
           }
        }
    	catch (JMSException e)
   	{
      		System.out.println("Error at ObjectMessage");
    	}
    }
}

As you can see, I'm just creating a simple connection, session,
producer/consumer, and I'm sending message every time (as I made my hole
application). When I profiled this example, I noticed these results:

*Full memory graphic*
MemoriaEj1.png
<http://activemq.2283324.n4.nabble.com/file/n4666262/MemoriaEj1.png>  

*Eden space memory graphic*
MemoriaEj1Eden.png
<http://activemq.2283324.n4.nabble.com/file/n4666262/MemoriaEj1Eden.png>  

*Survivor space memory graphic*
MemoriaEj1Survivor.png
<http://activemq.2283324.n4.nabble.com/file/n4666262/MemoriaEj1Survivor.png>  

*Tenured space memory graphic*
MemoriaEj1Tenured.png
<http://activemq.2283324.n4.nabble.com/file/n4666262/MemoriaEj1Tenured.png>  

As you can see in the first graphic, the GC can't release all the memory and
he can't come back to the initial situation. In the last graphic, the
tenured memory is not release properly as well.

Does anybody know why occur that? I'm getting a little lost...

Thanks in advance

Regards



--
View this message in context: http://activemq.2283324.n4.nabble.com/Question-about-listeners-performance-tp4666024p4666262.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Mime
View raw message