Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JMSPublishFilters save memory allocations and CPU cycles by caching null values for non-existant properties #147

Merged
merged 3 commits into from
May 14, 2024

Conversation

eolivelli
Copy link
Collaborator

@eolivelli eolivelli commented May 14, 2024

There are two places in which we use Map.computeIfAbsent in the JMSPublishFilters code path.
The problem with computeIfAbsent is that null values are not cached and so the broker ends up in scanning the whole list of properties in case of a selector that refers to a properties that is not set on the message.

Motification:

  • cache a dummy sentinel value in order to not redo the search every time
  • eagerly pre-cache as a Map all the properties of the Message in case the Message is to be processed by more than 1 Subcription

@eolivelli eolivelli merged commit 2c2e512 into master May 14, 2024
1 of 3 checks passed
@eolivelli eolivelli deleted the cache-metadata branch May 14, 2024 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant