Skip to content

Performance problem with event publication lookup #1146

Closed
@Groax256

Description

@Groax256

I believe there is a problem with implementation of org.springframework.modulith.events.core.DefaultEventPublicationRegistry.PublicationsInProgress.getPublication
As soon as listeners cannot keep up with event processing, it creates runaway performance issue.
Because the more publications are in progress the more time it spends on searching a TargetEventPublication, slowing down subsequent events.

Example processing speed, application was restarted around 9:30 and as more events were created the performance quickly plummeted
Image

Hot spot when profiling application (other hot spots are also on getPublication but with different code paths):
Image
Event is a simple Record with 2 fields, id and timestamp

Image
Maybe there should be a Set/Map of events so the search is always O(1)?

I saw that 1.4 removed equals but the problem will still be the same because of current search algorithm complexity.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions