11 Replies Latest reply: Jul 13, 2010 1:30 AM by Bijith Kumar RSS

    Frequency of ping packets

    Bijith Kumar Master

      Hi All,

       

      HornetQ server and client send a heart beat ping packets to each other periodically so that they can detect a connection failure when these packets are not received for connection-ttl and client-failure-check-period respectively. What is the frequency of these ping packets?

      I am asking this because, when I set conenction-ttl to 30 seconds, server closes the live client connection saying "Did not receive ping from.....".  So, I want to make sure I am not setting connection-ttl or client-failure-check-period less than the frequency of the ping messages

       

      Bijith

        • 1. Re: Frequency of ping packets
          Andy Taylor Master

          30 or 30000, i think its in milliseconds!

          • 2. Re: Frequency of ping packets
            Bijith Kumar Master

            Ofcourse It was set to 30000 in config file.

            • 3. Re: Frequency of ping packets
              Andy Taylor Master

              how long before the clients are timed out and can u post your config

              • 4. Re: Frequency of ping packets
                Bijith Kumar Master

                Client doesn't time out in my case. It is the server that closes client connection saying "didn't receive ping..."

                 

                My hornetq-jms.xml configuration is as given below

                 

                <configuration xmlns="urn:hornetq"
                               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                               xsi:schemaLocation="urn:hornetq /schema/hornetq-jms.xsd">

                 

                        <connection-factory name="NettyConnectionFactory">
                           <connectors>
                         <connector-ref connector-name="netty"/>
                           </connectors>
                                <entries>
                                        <entry name="/ConnectionFactory"/>
                                        <entry name="/XAConnectionFactory"/>
                                </entries>
                <block-on-durable-send>true</block-on-durable-send>
                <block-on-acknowledge>true</block-on-acknowledge>
                <connection-ttl>600000</connection-ttl>
                <call-timeout>180000</call-timeout>
                <client-failure-check-period>60000</client-failure-check-period>
                <block-on-non-durable-send>true</block-on-non-durable-send>
                <retry-interval>4000</retry-interval>
                <reconnect-attempts>5</reconnect-attempts>
                <confirmation-window-size>1000000</confirmation-window-size>
                        </connection-factory>

                 

                        <queue name="DLQ">
                                <entry name="/queue/DLQ"/>
                        </queue>
                        <queue name="ExpiryQueue">
                                <entry name="/queue/ExpiryQueue"/>
                        </queue>
                        <queue name="ExampleQueue">
                                <entry name="/queue/ExampleQueue"/>
                        </queue>
                        <topic name="ExampleTopic">
                                <entry name="/topic/ExampleTopic"/>
                        </topic>

                 

                </configuration>

                • 5. Re: Frequency of ping packets
                  Bijith Kumar Master

                  The config had <connection-ttl>30000</connection-ttl> when I hit the issue.

                  • 6. Re: Frequency of ping packets
                    Tim Fox Master

                    Bijith Kumar wrote:

                     

                    Hi All,

                     

                    HornetQ server and client send a heart beat ping packets to each other periodically so that they can detect a connection failure when these packets are not received for connection-ttl and client-failure-check-period respectively. What is the frequency of these ping packets?

                    I am asking this because, when I set conenction-ttl to 30 seconds, server closes the live client connection saying "Did not receive ping from.....".  So, I want to make sure I am not setting connection-ttl or client-failure-check-period less than the frequency of the ping messages

                     

                    Bijith

                    http://hornetq.sourceforge.net/docs/hornetq-2.1.1.Final/user-manual/en/html/connection-ttl.html

                     

                    The timeout is defined by connection-ttl

                     

                    The ping frequency is defined by client-failure-check-period

                     

                    If you set them to be the same, then of course, connection will be timed out.

                     

                    connection ttl should normally be much > client-failure-check-period

                    • 7. Re: Frequency of ping packets
                      Bijith Kumar Master

                      mm.. I am confused. What I understood from document is that

                      1. Every client sends ping packets periodically to server to let server know that client is alive

                      2. Server also sends ping mesages to all its clients periodically to let client know that Server is alive

                      3. If server doesn't receive ping packets from a client within connection-ttl time, server assumes that client is dead and cleans up its resources

                      4. If client doesn't receive ping packets from a server within client-failure-check-period time, client assumes that server is down and initiates automatic failover (if it is enabled) or throws Exception from Conenction so that ExceptionListener if any can handle failover

                      5. "connection ttl should normally be much > client-failure-check-period". This is true because otherwise clients wouldn't get a chance to failover and reconnect when connection to server fails.

                      6. "The ping frequency is defined by client-failure-check-period", I am confused here. The document is silent on this and my understanding of client-failure-check-period is as given in #4 above. i.e. my understanding is that both connection-ttl and client-failure-check-period are timeouts. One is at server side and other at client side. Could you please clarify?

                       

                      Your help is greatly appreciated

                      Bijith

                      • 8. Re: Frequency of ping packets
                        Tim Fox Master

                        1. Every client sends ping packets periodically to server to let server know that client is alive


                        Yes

                         


                        2. Server also sends ping mesages to all its clients periodically to let client know that Server is alive


                        No. Pings are sent to the client when the server receives a ping.

                         


                        3. If server doesn't receive ping packets from a client within connection-ttl time, server assumes that client is dead and cleans up its resources


                        Yes

                         


                        4. If client doesn't receive ping packets from a server within client-failure-check-period time, client assumes that server is down and initiates automatic failover (if it is enabled) or throws Exception from Conenction so that ExceptionListener if any can handle failover


                        Yes

                         


                        5. "connection ttl should normally be much > client-failure-check-period". This is true because otherwise clients wouldn't get a chance to failover and reconnect when connection to server fails.


                        No, this is so you don't get false connection clean ups. The client must send pings to the server faster than connection-ttl otherwise the server may erroneously think the client is dead.

                         


                        6. "The ping frequency is defined by client-failure-check-period",

                        It defines the client timeout but also defines the client ping frequency.

                        • 9. Re: Frequency of ping packets
                          Bijith Kumar Master

                          Tim, thank you for the clarification.

                           

                          Btw, if client-failure-check-period defines the client ping frequency as well, then what would be the frequency when client-failure-check-period is set to -1?

                           

                          From document:

                          "The default value for client failure check period is 30000ms,  i.e.             30 seconds. A value of -1 means the  client will never fail the             connection on the client side if no data is received from  the server. Typically this is             much lower than connection TTL to allow clients to reconnect  in case of transitory             failure."

                           

                          Thanks

                          Bijith

                          • 10. Re: Frequency of ping packets
                            Tim Fox Master

                             

                            Btw, if client-failure-check-period defines the client ping frequency as well, then what would be the frequency when client-failure-check-period is set to -1?


                            That disables pinging

                            • 11. Re: Frequency of ping packets
                              Bijith Kumar Master

                              Thanks Tim