timothyjward opened a new pull request, #36:
URL: https://github.com/apache/aries-typedevent/pull/36

   Event delivery on the single delivery thread was dominated by flattening 
events to Maps, and by queue operations once that is cheap. Follow-up to #35.
   
   * Skip flattening events nobody monitors: `MonitorEventTask` flattened every 
event, even when history is disabled for the topic and no monitor stream is 
connected. `TypedEventMonitorImpl.isMonitored()` is checked first, at the same 
point as before, so behaviour is unchanged.
   * Cache the public fields of DTO events: the converter reflected over the 
event class, and threw a `NoSuchFieldException` per field, for every event. 
Fields are now cached per class in a `ClassValue` holding only JDK types, so 
event classes of other bundles are not kept alive. Classes with a `PREFIX_` 
constant, `_` or `$` in a field name, or duplicate field names still use the 
converter.
   * Queue the tasks for one event together: one `EventBatchTask` per event on 
a `LinkedTransferQueue`, instead of one queue operation per handler on a 
`LinkedBlockingQueue`. Delivery order per publishing thread is unchanged.
   
   Measured on JDK 17 with a small DTO and trivial handlers (about 10 to 15 
percent noise):
   
   * Default configuration (history on): delivery thread time per event 101 us 
to 17.6 us, throughput 9,900 to 60,300 events/s, median latency 101 us to 24 us.
   * History disabled, typed handlers only: 85 us to 0.33 us per event, 
throughput 11,700 to 1.16M events/s, median latency 83 us to 5.6 us.
   * An untyped handler or a filter still needs the flattened event, so only 
the field cache helps there (about 6x).
   
   Covered by `MonitorEventTaskTest`, `EventConverterDtoFieldsTest` (including 
a class loader release check), `EventBatchTaskTest` and a multi-publisher 
ordering test in `TypedEventBusImplTest`. `mvn clean verify` passes on JDK 17 
for the bus module.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to