activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alanprot <...@git.apache.org>
Subject [GitHub] activemq pull request #300: AMQ-7055 - Optimization on SequenceSet to preven...
Date Wed, 19 Sep 2018 19:22:22 GMT
GitHub user alanprot opened a pull request:

    https://github.com/apache/activemq/pull/300

    AMQ-7055 - Optimization on SequenceSet to prevent iterating through t…

    When the index file has a huge number of free pages and the broker is starting up (loading
the index) we end up in a O(n2) loop.
    
    This was causing the broker to use 100% cpu and not being able to start up even after
a long time (as i remember we had around 3 millions free page in this case)
    
    https://github.com/apache/activemq/blob/master/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/disk/page/PageFile.java#L428
    
    https://github.com/apache/activemq/blob/master/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/disk/util/SequenceSet.java#L118
    
    I noticed that almost all the free pages was being added to the end of the sequenceSet...
So for any free page the broker had to necessity iterate through  all the Set (and after doing
that for nothing add . the value to the tail).
    
    With this small change, the broker started up in less than 5 minutes.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/alanprot/activemq feature/SequenceSetOptimization

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/activemq/pull/300.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #300
    
----
commit 7377f7412597f5adea96d0802c050c86e86b5fa0
Author: Alan Protasio <alanprot@...>
Date:   2018-09-19T19:20:59Z

    AMQ-7055 - Optimization on SequenceSet to prevent iterating through the whole set when
a value bigger than the last value is added

----


---

Mime
View raw message