7 Replies Latest reply on Jun 22, 2009 11:02 AM by Clebert Suconic

    Pre-calculate flow control credits for large messages

    Tim Fox Master

      When delivering large messages there is code that pre-calculates flow control credits - can you remind me why this is necessary?

        • 1. Re: Pre-calculate flow control credits for large messages
          Tim Fox Master

          Also, can you remind me how pendingLargeMessagesCounter can ever be > 1

          • 2. Re: Pre-calculate flow control credits for large messages
            Tim Fox Master

            Can you also explain this comment:

            // We are supposed to finish largeMessageDeliverer, or use all the possible credits before we return this
            // method.
            // If we play the commands on a different order than how they were generated on the live node, we will
            // eventually still be running this largeMessage before the next message come, what would reject messages
            // from the cluster

            thx

            • 3. Re: Pre-calculate flow control credits for large messages
              Clebert Suconic Master

               

              "timfox" wrote:
              When delivering large messages there is code that pre-calculates flow control credits - can you remind me why this is necessary?


              That is something you requested.

              As we send packets to the client, the client may be sending credits back to the server. You were concerned about the ServerConsumer overusing the channel and hence you requested to take credits in advance.


              Also, can you remind me how pendingLargeMessagesCounter can ever be > 1


              I think it could be replaced by an AtomicBoolean. But I would need to make a few tests.



              Can you also explain this comment:

              // We are supposed to finish largeMessageDeliverer, or use all the possible credits before we return this
              // method.
              // If we play the commands on a different order than how they were generated on the live node, we will
              // eventually still be running this largeMessage before the next message come, what would reject messages
              // from the cluster


              I have simplified the comment as:

              // We need to deliver the largeMessage on backup also, exactly as done on the live node.
              // In case of failure the same packets will be available for resume sending.






              • 4. Re: Pre-calculate flow control credits for large messages
                Tim Fox Master

                Sure, I remember we discussed this I just wanted you to remind me why this is necessary.. explain the reasoning behind it...

                If you could that would be great.

                • 5. Re: Pre-calculate flow control credits for large messages
                  Clebert Suconic Master

                  From what I remember, you could have a situation where:

                  - The server would never give a break on sending packets to the client. as the credits would be coming back from the client.


                  - Because The client will then send credits back to the server, as the server is sending packets to the client.

                  Maybe that would overuse the channel.

                  I believe this was an issue with the old pinger model. I'm not sure if it would still be the case after your changes on the Pinger.

                  • 6. Re: Pre-calculate flow control credits for large messages
                    Tim Fox Master

                    Yes, I understand that credits might arrive as deliveries are in occurrence, but that doesn't explain why you pre-calculate them in advance.

                    I need to understand that right now because of simplifications I am making for replication.

                    Also I don't understand what you mean by "overuse the channel", and I don't see what relation this has to pinger changes.

                    So to clarify I'm just asking what the purpose of precalculating credits in advance. Please advise.

                    • 7. Re: Pre-calculate flow control credits for large messages
                      Clebert Suconic Master

                      If I preCalculate, the deliverLargeMessage will give up earlier even if you had already received credits during the deliverMessage Process.

                      - before the ping changes, if you kept the channel used for a long time you would miss pings and pongs eventually, and that *was* a problem before.

                      We would be sending packets to the client, as the client is sending credits back, and the old ping code would not work.

                      Maybe we don' t need to preCalculate any more. The only thing I would be concerned is on the repplication. I don' t know if the replication credit would create any problems with synchronizing live and backup. I would need to evaluate it and test it.