6 Replies Latest reply on Jan 9, 2013 8:31 AM by Rico Neubauer

    Performance optimization in TimedBuffer

    Rico Neubauer Novice

      theHi,

       

      While profiling our application, which makes excessive usage of HornetQ, org.hornetq.core.journal.impl.TimedBuffer's CheckTimer came to light, which does more Semaphore#acquire + #release than necessary.

      This is related to https://issues.jboss.org/browse/HORNETQ-354, but further develops it.

       

      Idea is that there is no need to acquire the semaphore, release it immediately, do a Thread.yield and re-enter the procedure for approximately the duration of "timeout".

      I will attach a proposed patch (towards master), which shows, how this can be improved to wait sleep and therefore free CPU for a duration of 80% of timout.

       

      This reduces CPU-load overhead of TimedBuffer in our application significantly; would love to hear your comments.

       

      BR

      Rico