Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When to use OSGi EventAdmin and when not?

I have a general question regarding the usage of the OSGi EventAdmin service. I'm currently using it in a setting where potentially thousands of events can be generated per second. My fear is that the EventAdmin service might be a bottleneck. Initial results I get from my profiler seem to support this. The questions I have are:

  1. Is there a general rule of thumb when to use the EventAdmin service?
  2. How do the sendEvent and postEvent methods differ in terms of performance?
  3. Is there a particular OSGi container which is known to have a low performing EventAdmin implementation?

Thanks in advance for your support!

Cheers, Georg

like image 407
BumbleGee Avatar asked Aug 10 '11 22:08

BumbleGee


1 Answers

Do you have more information about the bottleneck you see?

We have an update coming for the Event Admin spec (see RFC 157 in [1]) to aid some performance issues. But this is not completed spec work yet.

Send event is a synchronous send, so the calling thread blocks until all listeners have been notified. Most implementations use the callers thread. Post event does not block the caller. It queues the work for another thread to deliver the event. The current Event Admin spec requires ordering for async events, so this can cause delays if ordering is not required. RFC 157 provides the ability to not require this ordering.

I have no data on whether one implementation before better or worse than another.

[1] http://www.osgi.org/Download/File?url=/download/osgi-4.3-early-draft2.pdf

like image 197
BJ Hargrave Avatar answered Oct 21 '22 18:10

BJ Hargrave