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

Synchronization point in RegionBroker adding and removing producers and consumers

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 5.4.2, 5.5.0
    • 5.6.0
    • Broker
    • None
    • Patch Available

    Description

      Synchronization blocks were added to the RegionBroker as a result of AMQ-2821 (automatic removal of inactive destinations). I believe the author was trying to prevent adding and removing producers while the inactive destination removal process was running.

      This is a major performance bottle neck in use case scenarios where many clients are subscribing and unsubscribing simultaneously – specifically, in order to retrieve one and only one message from a queue using the STOMP protocol (without holding onto a prefetch message) you must subscribe, retrieve a message and then unsubscribe from the destination. This activity causes lots of adding and removing of producers and consumers.

      I'm still not entirely convinced that the destination removal process needs to be protected in that manner, but the attached patch uses a ReentrantReadWriteLock to continue to protect the destination removal process, while still allowing clients to add and remove producers and consumers concurrently when the destination process is not running.

      This patch also relates to AMQ-3070 (where the user was complaining about this same synchronization block).

      I'm attaching patches both for the trunk and for 5.4.2 (which is what I'm still using).

      There are other synchronization blocks further down in the code (inside AbstractRegion and Queue implementations), but in my particular use case, the 2-3x performance enhancement I get of this patch alone are enough to satisfy my immediate concerns.

      Attachments

        1. RegionBroker-542.patch
          5 kB
          Izzy Alanis
        2. RegionBroker-trunk.patch
          5 kB
          Izzy Alanis

        Activity

          People

            tabish Timothy A. Bish
            izzyalanis Izzy Alanis
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: