Uploaded image for project: 'ActiveMQ Classic'
  1. ActiveMQ Classic
  2. AMQ-7132

ActiveMQ reads lots of index pages upon startup (after a graceful or ungraceful shutdown)

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 5.15.8
    • 5.16.0
    • KahaDB
    • None

    Description

      Hi.

      We noticed that ActiveMQ reads lots of pages in the index file when is starting up to recover the destinations statistics:

      https://github.com/apache/activemq/blob/master/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/KahaDBStore.java#L819

      Nowadays, in order to do that, activemq traverse the storedDestination.locationIndex to get the messageCount and totalMessageSize of each destination. For destinations with lots of messages this process can take a while making the startup process take long time.

      In a case of a master-slave broker, this prevent the broker to fast failover and does not meet what is stated on http://activemq.apache.org/shared-file-system-master-slave.html.

      If you have a SAN or shared file system it can be used to provide high availability such that if a broker is killed, another broker can take over immediately. 

      One solution for this is keep track of the destination statistics summary in the index file and doing so, we dont need to read all the locationIndex on the start up.

      The code change proposed is backward compatible but need a bump on the kahadb version. If this information is not in the index, the broker will fall back to the current implementation, which means that the first time people upgrade to the new version, it will still have to read the locationIndex, but subsequent restarts will be fast.

      This change should have a negligible performance impact during normal activemq operation, as this change introduce a few more bytes of data to the index and this information will be on checkpoints. Also, this new information is synchronized with the locationIndex as they are update at the same transaction.

      Attachments

        1. output.tgz
          4 kB
          Alan Protasio

        Activity

          People

            cshannon Christopher L. Shannon
            alanprot Alan Protasio
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: