8 Replies Latest reply on Dec 31, 2011 9:44 AM by clebert.suconic

    ConsumerWindowSize for a topic

    zenzei2k

      First of all, sorry if it's a newbie question, but is not clear to me reading the manual. What's the difference of configuring the property ConsumerWindowSize for a topic with 0 or with -1?

       

      If i understand, in 'zero' mode there is no buffer so a network round trip to the server exists in each message, but what happend in -1 mode?

        • 1. Re: ConsumerWindowSize for a topic
          gaohoward

          -1 means unlimited buffer at client side. The server on request will deliver as many messages as possible to the client in one go.

          • 2. Re: ConsumerWindowSize for a topic
            zenzei2k

            Thanks Yong Hao Gao, so that means that the server will note wait for consumers ack for sending messages to them?

            • 3. Re: ConsumerWindowSize for a topic
              gaohoward

              That's not true. This has nothing to do with message acknowledgement.

              • 4. Re: ConsumerWindowSize for a topic
                zenzei2k

                I supposed it has nothing to do, but there is something I dont' understand quite well. According to the manual

                 

                Slow consumers takes significant time to process each message and it is desirable to prevent buffering messages on the client side so that they can be delivered to another consumer instead. ... To allow slow consumers, set the consumer-window-size to 0 (for no buffer at all) ... This would involve a network round trip for every message and reduce performance.

                 

                But in a topic all consumers receives all messages, so I don't understand if the ConsumerWindowSize has any effect here or not. What happens if ConsumerWindowSize is set to 0 in a topic? The server delivers one message and waits for the ack of the slow consumer to send another message but in the meanwhile sends subsequent messages to the fast cosumers?

                 

                Thanks in advance Yong Hao Gao!

                • 5. Re: ConsumerWindowSize for a topic
                  gaohoward

                  I think regarding this parameter, all consumers are equal, no matter it consumes from a queue or a topic. If a topic's consumer has it set to 0, it has same effect as on a queue's consumer, i.e. the consumer doesn't cache any messages. The server deliver messages to consumers independently, meaning the delivery of messages to one consumer doesn't block another.

                  • 6. Re: ConsumerWindowSize for a topic
                    clebert.suconic

                    This has nothing to do with ACK.

                     

                    You will receive another message as soon as you finished reading a message..

                     

                     

                    On that sense, say if you are using synchronous receiving:

                     

                     

                    // At this point the client will send a credit to the server, and the server will send a message to the client.

                    // you won't ever have messages buffering if you use consumer-window-size=0

                    message msg = consumer.receive(TIMEOUT);

                    • 7. Re: ConsumerWindowSize for a topic
                      zenzei2k

                      Hi Clebert, thanks. So the difference with consumer-windows-size values 0 or -1 are that in the first case (value 0) the consumer will receive one message at a time (cause there is no buffer), and in the case of value -1 the consumers will continue receiveing messages although they didn't read them, I'm right?

                       

                      Cause I'm trying to see if this could have something to do with the problem we talk at http://community.jboss.org/message/638463#638463 (i didn't know if you manage to read my last post in them)

                       

                      Besides, happy new year to you!

                      • 8. Re: ConsumerWindowSize for a topic
                        clebert.suconic

                        -1 means ... no flow control....

                         

                         

                        That would mean.. you better receive the client faster than you can produce, otherwise you would OME (out of memory exception) the client. this is documented.

                         

                         

                        If you need some buffering on the client, use a proper size.. like 1024 * 1024 (1 M bytes), so you only buffer up to the point you won't OME.