5 Replies Latest reply on Nov 17, 2003 9:37 AM by computerrobot

    better performance - how to manage an asynchronous queue?

    darren hartford Expert

      Hi all!
      I have a scenario that is already up and running. I have a webpage that loads 1-20 CSV files at once that are then sent to a JMS queue and from the queue sent to an EJB that will clean/transform the CSV into a database.

      That's nice and all, but it tries to run all 20 at the same time!! How can I control how many are run at a time? Show how many are left to be done in the queue?

      I have google'd, gone through the pay-for docs, and my own trial and error and can't seem to find what should be a well-known performance improvement to a well-managed Messaging system.

      TIA!
      -D

        • 1. Re: better performance - how to manage an asynchronous queue
          Elias Ross Master


          Edit your jboss.xml file. Add to the end a container-configurations XML block. Set the maximum size to whatever you like:


          <enterprise-beans>
          </enterprise-beans>

          <container-configurations>
          <container-configuration>
          <container-name>Standard Message Driven Bean</container-name>
          <container-invoker-conf>
          DefaultJMSProvider
          StdJMSPool
          3
          1
          True
          </container-invoker-conf>
          </container-configuration>
          </container-configurations>


          • 2. Re: better performance - how to manage an asynchronous queue
            computerrobot Newbie

            Hi,
            Using JBoss 3.2.2RC4

            I have been trying to limit the maximum number of instances of MDB for a while now. I have looked through the forum and saw little variations of similar code that needs to be changed in jboss.xml. And none of them work for me. Changing standardjboss.xml works.

            I started with Adrian's simple example : http://www.jboss.org/modules/bb/index.html?module=bb&op=viewtopic&t= modifying it with your recommendations, this is what my jboss.xml looks like.
            ----
            <?xml version="1.0" encoding="UTF-8"?>
            <!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS//EN" "http://www.jboss.org/j2ee/dtd/jboss.dtd">

            <container-configurations>
            <container-configuration>
            <container-name>Standard Message Driven Bean</container-name>

            <container-invoker-conf>
            DefaultJMSProvider

            StdJMSPool

            3

            1

            True
            </container-invoker-conf>
            </container-configuration>
            </container-configurations>

            <enterprise-beans>
            <message-driven>
            <ejb-name>test/mdb</ejb-name>

            <destination-jndi-name>queue/testQueue</destination-jndi-name>
            </message-driven>
            </enterprise-beans>


            ---

            I also tried Adrian's solution after which my jboss.xml would look like this :
            ----
            <?xml version="1.0" encoding="UTF-8"?>
            <!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS//EN" "http://www.jboss.org/j2ee/dtd/jboss.dtd">

            <container-configurations>
            <container-configuration extends="Standard Message Driven Bean">
            <container-name>My Message Driven Bean</container-name>

            <container-invoker-conf>
            DefaultJMSProvider

            StdJMSPool

            1

            1

            true


            10


            queue/DLQ

            10

            0


            </container-invoker-conf>
            </container-configuration>
            </container-configurations>


            <enterprise-beans>
            <message-driven>
            <ejb-name>test/mdb</ejb-name>

            <destination-jndi-name>queue/testQueue</destination-jndi-name>
            </message-driven>
            </enterprise-beans>


            ---


            Could anyone tell why it doesn't work!

            • 3. Re: better performance - how to manage an asynchronous queue
              Elias Ross Master


              I set to 3 in jboss.xml, you may want to use 1.

              You should validate your jboss.xml against its DTD.

              http://www.jboss.org/j2ee/dtd/jboss.dtd

              The jboss.xml XML loader doesn't do any DTD validation, so if you cut and pasted something wrong, your configuration may be ignored. The container configuration goes at the end, BTW...

              • 4. Re: better performance - how to manage an asynchronous queue
                computerrobot Newbie

                I tried putting container configuration at the bottom, but no use. The xml does NOT validate against the DTD because DTD has no element for message-driver beans! It only expects session or entity. Here is my jboss.xml doc.

                -----
                <?xml version="1.0" encoding="UTF-8"?>
                <!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS//EN" "http://www.jboss.org/j2ee/dtd/jboss.dtd">

                <enterprise-beans>
                <message-driven>
                <ejb-name>test/mdb</ejb-name>

                <destination-jndi-name>queue/testQueue</destination-jndi-name>
                </message-driven>
                </enterprise-beans>

                <container-configurations>
                <container-configuration>
                <container-name>Standard Message Driven Bean</container-name>

                <container-invoker-conf>
                DefaultJMSProvider

                StdJMSPool

                3

                1

                True
                </container-invoker-conf>
                </container-configuration>
                </container-configurations>



                -----

                Thanks.

                • 5. Re: better performance - how to manage an asynchronous queue
                  computerrobot Newbie

                  By the way, the reason I think this is not working is :

                  Inside onMessage, I print out the hashcode and then do Thread.sleep(30000). As messages keep
                  getting posted on the queue, I keep seeing new hashCodes (it stops when 15 of them have been created).

                  Thanks