8 Replies Latest reply on Jul 27, 2006 12:57 PM by DENNIS CREEDEN

    Problem with large strings

    DENNIS CREEDEN Newbie


      Hi,

      I am trying to send a TextMessage with a string of up to 500K. The message eventually gets through but the memory requirements (over 60M) and performance (10 seconds or more) are very bad.

      Can JBoss Messaging handle strings this large? If so, how?

      Thanks for your help,

      Dennis

        • 1. Re: Problem with large strings
          Tim Fox Master

          This is strange.

          Are you talking about the memory on the client or the server?

          How are you measuring the memory? Are you measuring the memory before sending and comparfing it to the value after sending?

          Is the message persistent?

          Are you using a database? If so, which one?

          What version of messaging are you using?

          What version of AS are you using (if any)?

          • 2. Re: Problem with large strings
            Tim Fox Master

            I have tried sending a text message with 500K characters of text from one consumer to the server and receiving it again.

            For a non persistent message, my send takes about 68 milliseconds, and the receive takes about 10ms.

            For a persistent message it takes 78 milliseconds for the send and 10 again for the receive.

            I am using MySQL 5.0, server and consumer producer on same box in different VMs.

            • 3. Re: Problem with large strings
              Tim Fox Master

              With the same setup I can send/receive a 50MB message in about 2 seconds.

              • 4. Re: Problem with large strings
                DENNIS CREEDEN Newbie

                Hello Tim,

                Thanks for the quick response. Your results sound very encouageing. I didn't bother you with the details since I thought you would experience the same problem.

                I am using:
                JBoss_4_0_4_GA
                JBoss Messaging 1.0.1.CR3
                Windows XP Professional

                Everything is on one JBoss server.

                I have an EJB that is virtually identical to the messaging stateless EJB in the examples that come with JBoss Messaging. The EJB has a sendRequest method that puts a TextMessage in a queue named requestQueue and a getResponse method that retrieves TextMessages from a queue named responseQueue.

                A MDB is listening on the requestQueue queue. It processes the request and puts the results into a TextMessage and sends it to the responseQueue queue. The EJB then retrieves the TextMessage from the responseQueue.

                My queues are configured in the destinations-service.xml as follows:


                <mbean code="org.jboss.jms.server.destination.Queue"
                name="jboss.messaging.destination:service=Queue,name=requestQueue"
                xmbean-dd="xmdesc/Queue-xmbean.xml">
                <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer
                750000
                20000
                20000


                <mbean code="org.jboss.jms.server.destination.Queue"
                name="jboss.messaging.destination:service=Queue,name=responseQueue"
                xmbean-dd="xmdesc/Queue-xmbean.xml">
                <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer
                750000
                20000
                20000


                The server log is:

                09:24:35,828 INFO [Queue] Queue[/queue/requestQueue] started, fullSize=750000, pageSize=20000, downCacheSize=20000
                09:24:35,828 INFO [Queue] Queue[/queue/responseQueue] started, fullSize=750000, pageSize=20000, downCacheSize=20000



                I am running the application in debug mode in Eclipse. I am using a memory monitor in Eclipse to track memory usage.

                The program uses about 80M of memory. When I process the first large string (about 380k), memory climbs to about 150M and I start getting these messages in the server log:

                09:42:56,343 WARN [SimpleMemoryManager] Less than 25% of total available memory free

                The next time I process the same request memory grows to about 360M and I get more of the above messages. The more requests I send (one at a time) the more the memory grows.

                Response times are about 30 to 35 seconds.

                Any clue?

                Thanks,

                Dennis

                • 5. Re: Problem with large strings
                  Tim Fox Master

                  Forget eclipse.

                  Just start a jboss 4.0.4 installation with jboss messaging from the command line, then write a very simple jms application that just sends a and receives a big message, run it from the command line and tell me what happens.

                  • 6. Re: Problem with large strings
                    DENNIS CREEDEN Newbie

                    Hi Tim,

                    Could you send me the code you are using for testing?

                    Thanks,

                    Dennis

                    • 7. Re: Problem with large strings
                      Tim Fox Master

                       

                      Connection conn = cf.createConnection();
                      
                       conn.start();
                      
                       Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
                      
                       MessageProducer prod = sess.createProducer(queue);
                      
                       prod.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
                      
                       StringBuffer sb = new StringBuffer();
                       for (int i = 0; i < 50 * 1024 * 1024; i++)
                       {
                       sb.append("X");
                       }
                       String s = sb.toString();
                      
                       TextMessage tm1 = sess.createTextMessage(s);
                      
                       long start = System.currentTimeMillis();
                       log.info("Sending message");
                       prod.send(tm1);
                       log.info("Sent message");
                       long end = System.currentTimeMillis();
                      
                       log.info("Send took " + (end-start) + " ms");
                      
                       MessageConsumer cons = sess.createConsumer(queue);
                      
                       start = System.currentTimeMillis();
                       log.info("Receiving message");
                       TextMessage tm2 = (TextMessage)cons.receive(1000);
                       log.info("Received message");
                       end = System.currentTimeMillis();
                      
                       log.info("Receive took " + (end-start) + " ms");
                      
                       assertEquals(tm1.getText(), tm2.getText());
                      
                       conn.close();
                      


                      • 8. Re: Problem with large strings
                        DENNIS CREEDEN Newbie


                        Hi Tim,

                        Stupidity hurts. I am in debug mode and was outputing the 400K string to the console. That is what killed it.

                        Now the messaging takes 16 milliseconds.

                        Sorry about that.

                        Thanks,

                        Dennis