Uploaded image for project: 'Qpid'
  1. Qpid
  2. QPID-5748

[C++ broker] Make Queue::purgeExpired more efficient by calling AbsTime::now() just once

    XMLWordPrintableJSON

Details

    Description

      Queue::purgeExpired method (to remove messages from all queues with TTL expired) currently calls Message::hasExpired() method that calls AbsTime::now() i.e. ::clock_gettime for every individual message with TTL set.

      That system call is redundant to be called in that way. It is enough to call it once before traversing the very first queue and use the value as an argument.

      Proposing a patch (to review also, it's not ideal imho) for that I run a simple performance tests comparison that purged all messages sent there:

      • sending 100k transient messages to each of 300 queues: observed 10% performance improvement (improved purge took 740s and original purge took 807s on my virtual box)
      • sending 10k durable messages to each of 300 durable queues: observed almost no improvement (improved: 114.48s, original: 115.77s i.e. performance gain in 1.1%) - probably disk operations (common to both tests) kill the improvement; if the test won't purge the messages, (linear)store won't take into pla and improvement would be more visible, I guess

      Attachments

        1. QPID-5748.patch
          3 kB
          Pavel Moravec

        Activity

          People

            pmoravec Pavel Moravec
            pmoravec Pavel Moravec
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: