6 Replies Latest reply on Oct 11, 2012 10:30 AM by clebert.suconic

    Latency issues for multiple consumers




      I am using Spring3.1 in standalone env.


      I have intergrated into with HornetQ ver 2.2.14


      I have simple Hornetq Topic which is configured via spring jms template.


      After warming up with more then 10,000 messages I am getting a huge latency problem.


      If for instance I have two consumers(which doing exactly the same):


      The first consumer getting the topic message in a reasonable time

      The second consumer get the same message within huge latency.


      here are some logs:


      before topic dispatch:


      012-10-10 13:53:25,485...[DEBUG] speedTest4.


      after retrieving the messages:


      Consumer 1 - 2012-10-10 13:53:25,487 ... [INFO] speedTest5

      Consumer 2 - 2012-10-10 13:53:31,647... [INFO] speedTest5


      The latency of consumer 2 is redicioules.


      We are despert with this.


      what could be the problem?



        • 1. Re: Latency issues for multiple consumers

          its probably a Spring issue, if you can provide us an example that isnt using Sprring we may be able to help.

          • 2. Re: Latency issues for multiple consumers

            Yes but our platform is Spring.


            Are you sure there is nothing else I could check out?

            • 3. Re: Latency issues for multiple consumers

              99 times out of 100 these issues are usually spring related, there is nothing obvious i can see. Try running without Spring, if you get the same issues then we can take a look, or provide a self contained test/project that we can easily run

              • 4. Re: Latency issues for multiple consumers

                As far as I remember JMSTemplate is doing some things in a DB-like manager. i.e. by creating components every time what will make your client do round trips as opposed to asynchronous communication: Result would be latency increase!


                you should create a consumer and receive regularly..   if you also create a consumer and close it every time, you will increase the latency.


                Maybe there are caches done on JMS Template. this would decrease the latency as the consumers are reused?





                You can of course still use JMS Template from spring if you like.. but we can't be blamed for something done wront at the JMS Template. I remember having issues with JMS Template since my old days of JBoss Messaging. It's probably a generic issue that's not only associated with HornetQ.

                • 5. Re: Latency issues for multiple consumers

                  Hi Suconic,


                  The wierd thing here is that if I execute a single execution the latency is 0 ms only when I load test I get those latency problems. more over it doesnt happen with all consumers.

                  I am using the jms template cache mechanisem.

                  • 6. Re: Latency issues for multiple consumers

                    In any syste you measure, you need to measure after a steady state. There's a lot going on on the JVM, plus opening connections at the first messages.



                    Anyway: as far as I remember, the JMSTemplate has a cache for Connection but not for consumers. I may be wrong though.



                    Try this:



                    - send thousands of messages, and start measuring after a few minutes of sustainable load.

                    - Do the same test without JMSTemplate



                    They you may get a more accurate figure.