cloudstack/framework
Suresh Kumar Anaparti 9e8855a6f5
Add async job event bus publisher (#12971)
* Async event bus publishing in AsyncJobManagerImpl to reduce API thread contention

publishOnEventBus() was calling _messageBus.publish() synchronously on the
request thread, which blocks on MessageBusBase$Gate (an exclusive mutex).
JFR analysis showed this causing up to 107ms waits on Jetty request threads,
contributing to 502 errors from the upstream load balancer.

Move event bus publishing to a dedicated single-threaded executor so API
request threads are no longer blocked by Gate contention. Event ordering
is preserved by the single-threaded executor.

* Wrap async event bus publish in ManagedContextRunnable for DB connection safety

The sole subscriber (ApiServer.handleAsyncJobPublishEvent) performs DAO reads
(getUserIncludingRemoved, getAccount, findById) inside its callback.
Without ManagedContextRunnable, the EventBus thread would not have proper
TransactionLegacy lifecycle management, risking DB connection leaks.

* logger fix

* review comments

* review changes

---------

Co-authored-by: Aaron Chung <aaron_chung@apple.com>
2026-07-06 07:54:34 -03:00
..
agent-lb Updating pom.xml version numbers for release 4.22.2.0-SNAPSHOT 2026-05-18 17:17:25 +05:30
ca Updating pom.xml version numbers for release 4.22.2.0-SNAPSHOT 2026-05-18 17:17:25 +05:30
cluster Updating pom.xml version numbers for release 4.22.2.0-SNAPSHOT 2026-05-18 17:17:25 +05:30
config Updating pom.xml version numbers for release 4.22.2.0-SNAPSHOT 2026-05-18 17:17:25 +05:30
db Merge release branch 4.20 to 4.22 2026-05-22 08:31:35 -03:00
direct-download Updating pom.xml version numbers for release 4.22.2.0-SNAPSHOT 2026-05-18 17:17:25 +05:30
events Updating pom.xml version numbers for release 4.22.2.0-SNAPSHOT 2026-05-18 17:17:25 +05:30
extensions Updating pom.xml version numbers for release 4.22.2.0-SNAPSHOT 2026-05-18 17:17:25 +05:30
ipc Updating pom.xml version numbers for release 4.22.2.0-SNAPSHOT 2026-05-18 17:17:25 +05:30
jobs Add async job event bus publisher (#12971) 2026-07-06 07:54:34 -03:00
managed-context Updating pom.xml version numbers for release 4.22.2.0-SNAPSHOT 2026-05-18 17:17:25 +05:30
quota Updating pom.xml version numbers for release 4.22.2.0-SNAPSHOT 2026-05-18 17:17:25 +05:30
rest Updating pom.xml version numbers for release 4.22.2.0-SNAPSHOT 2026-05-18 17:17:25 +05:30
security Updating pom.xml version numbers for release 4.22.2.0-SNAPSHOT 2026-05-18 17:17:25 +05:30
spring framework/spring: throw RuntimeException when fail to start or load a module (#13186) 2026-06-22 08:22:27 +02:00
pom.xml Updating pom.xml version numbers for release 4.22.2.0-SNAPSHOT 2026-05-18 17:17:25 +05:30