You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by mvilleta <mv...@cafsignalling.com> on 2013/04/18 17:52:33 UTC
Question about listeners performance
Good Afternoon,
I'm a new user of JMS technology and particularly with ActiveMQ solution.
I'm having some problems with the performance of my application.
Specifically, i'm developing a 24x7 application. We are using
MessageListener for all consumers.
Doing performance and continuity tests I detected memory leaks in certain
ActiveMQ classes. After passing a profiler tool, I saw a large amount of
ObjectMessage and Message instances. Trying to improve my performance
problems, I decided to use "clearBody" and "clearProperties" methods, and I
after passing again the profiler tool, I noticed, that the memory leak grows
slower. Does it have any sense?.
We are not closing the session and the conexion instances because we reuse
them all the time.
Thank you in advance,
Regards
--
View this message in context: http://activemq.2283324.n4.nabble.com/Question-about-listeners-performance-tp4666024.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: Question about listeners performance
Posted by Christian Posta <ch...@gmail.com>.
how large is the heapdump? can you compress and attach?
On Tue, Apr 30, 2013 at 1:34 AM, mvilleta <mv...@cafsignalling.com>wrote:
> Does anyone have any suggestions for my problem?
>
> I'm sure I'm doing something wrong in my example, because I can't believe
> that the activemq standard configuration and this example (too simple)
> couldn't be sustainable in time.
>
> Thanks
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/Question-about-listeners-performance-tp4666024p4666441.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
--
*Christian Posta*
http://www.christianposta.com/blog
twitter: @christianposta
Re: Question about listeners performance
Posted by mvilleta <mv...@cafsignalling.com>.
Does anyone have any suggestions for my problem?
I'm sure I'm doing something wrong in my example, because I can't believe
that the activemq standard configuration and this example (too simple)
couldn't be sustainable in time.
Thanks
--
View this message in context: http://activemq.2283324.n4.nabble.com/Question-about-listeners-performance-tp4666024p4666441.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: Question about listeners performance
Posted by mvilleta <mv...@cafsignalling.com>.
I attach new screenshots from the same execution, after more than 2 hours.
Everything it's worst:
graphic.png
<http://activemq.2283324.n4.nabble.com/file/n4666330/graphic.png>
allObject.jpg
<http://activemq.2283324.n4.nabble.com/file/n4666330/allObject.jpg>
recordedObject.png
<http://activemq.2283324.n4.nabble.com/file/n4666330/recordedObject.png>
hotspots.png
<http://activemq.2283324.n4.nabble.com/file/n4666330/hotspots.png>
I hope it could give more information to my problem...
Thanks
--
View this message in context: http://activemq.2283324.n4.nabble.com/Question-about-listeners-performance-tp4666024p4666330.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: Question about listeners performance
Posted by mvilleta <mv...@cafsignalling.com>.
Hi,
I repeated the test again for attach snapshots with the living objects
during the execution. After run the example for 1 hour and I got again the
following performance graphic:
performance_graphic.jpg
<http://activemq.2283324.n4.nabble.com/file/n4666329/performance_graphic.jpg>
JProfiler tool, provides three different perspectives about object
allocations:
*All objects*:
all_object.jpg
<http://activemq.2283324.n4.nabble.com/file/n4666329/all_object.jpg>
*Recorded objects*:
recorded_objects.jpg
<http://activemq.2283324.n4.nabble.com/file/n4666329/recorded_objects.jpg>
*Allocation hot spots*:
hotspots.jpg
<http://activemq.2283324.n4.nabble.com/file/n4666329/hotspots.jpg>
As you can appreciate, appears "ActiveMQObjectMessage" and "MessageId"
references (in Recorded objects view), and "getObject" and
"createObjectMessage" (in allocation hot spots). When I step into each of
them (seeing his incomming and outcomming references) I allways achieve
"activeMQSession" object. This is which I don't understand if it's no
necessary to close the connection or session.
Any ideas?. I can't understand how this too simple example, works like that
...
Thanks
--
View this message in context: http://activemq.2283324.n4.nabble.com/Question-about-listeners-performance-tp4666024p4666329.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: Question about listeners performance
Posted by SuoNayi_Gmail <su...@gmail.com>.
Why not perform a heap memory analysis to see what objects are living in the
heap and whether they are reachable?
--
View this message in context: http://activemq.2283324.n4.nabble.com/Question-about-listeners-performance-tp4666024p4666317.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: Question about listeners performance
Posted by mvilleta <mv...@cafsignalling.com>.
Ok, so I'm still confusing with the results of my example. Independently the
moment which GC will appear, it should be released all the non-used
resources, including the resources of other GC generations. In my example,
the rate of messages consumed are enough, so all of them will be consumed.
For that I don't understand what resources are increasing, if when i consume
them should be released.
--
View this message in context: http://activemq.2283324.n4.nabble.com/Question-about-listeners-performance-tp4666024p4666316.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: Question about listeners performance
Posted by SuoNayi_Gmail <su...@gmail.com>.
Yes, you can not expect the exact time when JVM will perform the GC
operation, since your memory is low and the JVM may never perform GC...
--
View this message in context: http://activemq.2283324.n4.nabble.com/Question-about-listeners-performance-tp4666024p4666315.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: Question about listeners performance
Posted by mvilleta <mv...@cafsignalling.com>.
Both consumer and producer was executed from a main class that create two
instances of them (one per each). Then, I made a runnable jar file and I run
it from the JProfiler tool.
I had understood (reading the documentation) that non-persistence messages
are never allocated on the disk. Simply they reside into the memory until
some cosumer get them. If nobody takes this messages, I thought they reside
in the memory, but if someone takes them (as happend in my example) they
will be released by GC as an unused reference. Doesn't it work like this?
Thanks
Regards
--
View this message in context: http://activemq.2283324.n4.nabble.com/Question-about-listeners-performance-tp4666024p4666314.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: Question about listeners performance
Posted by SuoNayi_Gmail <su...@gmail.com>.
Are they(include the broker) all running on the same box?
If so non-persistent messages will occupy the heap memory before they are
flushed into the disk.
--
View this message in context: http://activemq.2283324.n4.nabble.com/Question-about-listeners-performance-tp4666024p4666313.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Question about listeners performance
Posted by mvilleta <mv...@cafsignalling.com>.
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.
Re:Question about listeners performance
Posted by SuoNayi <su...@163.com>.
Reusing the Jms resources such as sessions, producers is a good practice but not for consumers.
Reusing consumers can bring in message stuck problem and you can take a look at
http://activemq.apache.org/what-is-the-prefetch-limit-for.html
You can use activemq-pool to them handily.
At 2013-04-22 19:34:05,mvilleta <mv...@cafsignalling.com> wrote:
>Thanks for your answers,
>
>I continue having the same problem. Reading the API specifications of
>"close" method for MessageConsumer and MessageProducer, I noticed that it
>specifies the following:
>
>"Since a provider may allocate some resources on behalf of a MessageProducer
>outside the JVM, clients should close them when they are not needed. Relying
>on garbage collection to eventually reclaim these resources may not be
>timely enough."
>
>At all my application, I'm never close the sessions of my producers and
>consumers. Could it be a performance problem for the application?.
>
>SouNayi, have you ever closed any session at your 24x7 application
>eventually, on that case, how can I do it without stop the service?.
>
>Thanks in advance
>
>Regards
>
>
>
>--
>View this message in context: http://activemq.2283324.n4.nabble.com/Question-about-listeners-performance-tp4666024p4666108.html
>Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Question about listeners performance
Posted by mvilleta <mv...@cafsignalling.com>.
Thanks for your answers,
I continue having the same problem. Reading the API specifications of
"close" method for MessageConsumer and MessageProducer, I noticed that it
specifies the following:
"Since a provider may allocate some resources on behalf of a MessageProducer
outside the JVM, clients should close them when they are not needed. Relying
on garbage collection to eventually reclaim these resources may not be
timely enough."
At all my application, I'm never close the sessions of my producers and
consumers. Could it be a performance problem for the application?.
SouNayi, have you ever closed any session at your 24x7 application
eventually, on that case, how can I do it without stop the service?.
Thanks in advance
Regards
--
View this message in context: http://activemq.2283324.n4.nabble.com/Question-about-listeners-performance-tp4666024p4666108.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re:Question about listeners performance
Posted by SuoNayi <su...@163.com>.
I would say you can profile any other java application and the profiler will give you the suspect classes that may leak memory in.
As messages come and go, there are many instances in the heap and this seems reasonable.
If your application leaks memory I will possibly believe.
We have run ActiveMQ 5.5 in production for years(7 X 24) and it has been working well.
At 2013-04-19 00:01:12,mvilleta <mv...@cafsignalling.com> wrote:
>Good Afternoon,
>
>I'm a new user of JMS technology and particularly with ActiveMQ solution.
>I'm having some problems with the performance of my application.
>Specifically, i'm developing a 24x7 application. We are using
>MessageListener for all consumers.
>
>Doing performance and continuity tests I detected memory leaks in certain
>ActiveMQ classes. After passing a profiler tool, I saw a large amount of
>ObjectMessage and Message instances. Trying to improve my performance
>problems, I decided to use "clearBody" and "clearProperties" methods, and I
>after passing again the profiler tool, I noticed, that the memory leak grows
>slower. Does it have any sense?.
>
>We are not closing the session and the conexion instances because we reuse
>them all the time.
>
>Thank you in advance,
>
>Regards
>
>
>
>--
>View this message in context: http://activemq.2283324.n4.nabble.com/Question-about-listeners-performance-tp4666024.html
>Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: Question about listeners performance
Posted by mvilleta <mv...@cafsignalling.com>.
Good morning,
I'm using the following configurations:
- I'm running my application in a VMWare Virtual Machine: Single CPU, 2GB
RAM, 20GB of local disk. SO: Win7 (32bits)
- Java SE 1.6.35 with standar configuration
- ActiveMQ 5.5.1 without any tunning modification. Specifically, i'm using
producers with non-persistence delivery mode (just with queues), and
asynchronous consumers. Both consumers and producers, use different sessions
from the same connection.
I'm running directly my application, that it's configured as a OS service,
and I'm attaching JProfiler 7.2.2 profiling tool.
I'm specially interesting in know if i should do something with my sessions,
because i'm not closing them (actually, I can't do it, because it should
work 24x7).
Thanks
Regards
--
View this message in context: http://activemq.2283324.n4.nabble.com/Question-about-listeners-performance-tp4666024p4666045.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: Question about listeners performance
Posted by Christian Posta <ch...@gmail.com>.
For any reasonable level of help, you'll need to post your entire config
for the broker, producer/consumer settings (how are you running the load
test), JVM settings, hardware, OS, shared disk/local disk specs, command
line, etc, etc.
On Thu, Apr 18, 2013 at 8:52 AM, mvilleta <mv...@cafsignalling.com>wrote:
> Good Afternoon,
>
> I'm a new user of JMS technology and particularly with ActiveMQ solution.
> I'm having some problems with the performance of my application.
> Specifically, i'm developing a 24x7 application. We are using
> MessageListener for all consumers.
>
> Doing performance and continuity tests I detected memory leaks in certain
> ActiveMQ classes. After passing a profiler tool, I saw a large amount of
> ObjectMessage and Message instances. Trying to improve my performance
> problems, I decided to use "clearBody" and "clearProperties" methods, and I
> after passing again the profiler tool, I noticed, that the memory leak
> grows
> slower. Does it have any sense?.
>
> We are not closing the session and the conexion instances because we reuse
> them all the time.
>
> Thank you in advance,
>
> Regards
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/Question-about-listeners-performance-tp4666024.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
--
*Christian Posta*
http://www.christianposta.com/blog
twitter: @christianposta