Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARTEMIS-4923 reduce synchronization in ManagementServiceImpl #5087

Merged
merged 1 commit into from
Jul 23, 2024

Conversation

jbertram
Copy link
Contributor

@jbertram jbertram commented Jul 12, 2024

The ManagementService is used by the broker to register and unregister components for management as well as send notifications. When the broker is busy dealing with new sessions and auto-creating queues, addresses, etc. there is a lot of contention.

To reduce synchronization and improve the service overall this commit does the following:

  • Remove synchronized from most methods. In most cases it's completely unnecessary because the methods are already using a thread-safe data-structure (e.g. ConcurrentHashMap) or more specific synchronization is already in place (e.g. on mbeanServer).
  • Adds new & clarifies existing logging.
  • Synchronizes start & stop methods and adds gates via started.
  • Simplifies the sendNotification method by synchronizing once rather than twice and performing legitimacy checks sooner.
  • Removing an unnecessary overload of the registereQueue method.

To be clear, there are no tests included with this commit as there should be no semantic changes. Existing tests should be sufficient to identify any regressions.

@clebertsuconic
Copy link
Contributor

@jbertram can you fix conflicts please? there's a conflict with another PR merged from you.

I wasn't 100% sure how to fix it.. if you could do it please?

The `ManagementService` is used by the broker to register and
unregister components for management as well as send notifications.
When the broker is busy dealing with new sessions and auto-creating
queues, addresses, etc. there is a lot of contention.

To reduce synchronization and improve the service overall this commit
does the following:

 - Remove `synchronized` from most methods. In most cases it's
   completely unnecessary because the methods are already using a
   thread-safe data-structure (e.g. `ConcurrentHashMap`) or more
   specific synchronization is already in place (e.g. on
   `mbeanServer`).
 - Adds new & clarifies existing logging.
 - Synchronizes `start` & `stop` methods and adds gates via `started`.
 - Simplifies the `sendNotification` method by synchronizing once rather
   than twice and performing legitimacy checks sooner.
 - Removing an unnecessary overload of the `registereQueue` method.

To be clear, there are no tests included with this commit as there
should be no semantic changes. Existing tests should be sufficient to
identify any regressions.
@jbertram
Copy link
Contributor Author

@clebertsuconic, this should be ready to go.

@tabish121 tabish121 merged commit 10adca5 into apache:main Jul 23, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants