rbankar7 opened a new issue, #19943:
URL: https://github.com/apache/druid/issues/19943

   ### Description
   
   When `druid.emitter=composing` is configured, the composing emitter resolves 
its child emitters from the Guice injector on **every** emitted event instead 
of once at startup. Since Druid emits a metric per segment scanned, this runs 
tens of thousands of times per second on busy nodes, and each resolution takes 
a monitor lock.
   
   Lock profiling attributed the large majority of lock-contention samples to 
`LifecycleScope$1.get`.
   
   ### Root cause
   
   `ComposingEmitterModule#getEmitter` builds the child-emitter list with 
`Lists.transform(...)`, which returns a **lazy** Guava view. 
`ComposingEmitter.emit(Event)` iterates that list per event, so each iteration 
re-runs the transform and re-resolves every child via 
`injector.getInstance(...)`. For lifecycle-scoped bindings this goes through 
`LifecycleScope#get()`, which is `synchronized` and takes a monitor lock on 
every call — even though after startup it just returns a cached instance.
   
   ### Fix
   
   Resolve the child emitters eagerly, once, into a materialized 
`ImmutableList` at construction time, matching how `SwitchingEmitterModule` 
already builds its child-emitter lists. No behavior change.


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to