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

Optimize DefaultUserDestinationResolver.resolveDestination() [SPR-15602] #20161

Closed
spring-projects-issues opened this issue May 31, 2017 · 4 comments
Assignees
Labels
in: messaging Issues in messaging modules (jms, messaging) type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

Christoph Dreis opened SPR-15602 and commented

Hey,

I noticed in some of my stresstests that DefaultUserDestinationResolver.resolveDestination() was popping up quite often as a hot method and found some possible improvements.

The attached PR restructures the code of DefaultUserDestinationResolver.resolveDestination() or more correctly DefaultUserDestinationResolver.parse() in the following ways:

  • Allow parse() to be inlined by extracting the logic of parsing subscription messages and normal messages to dedicated private methods.
    • (Previous) DefaultUserDestinationResolver::parse (458 bytes) hot method too big
    • (After) DefaultUserDestinationResolver::parse (95 bytes) inline (hot)
  • Make the sourceDestination of a message part of the ParseResult in order to avoid getting it twice in the chain
  • Move the call to fetch the Principal of a Message only to the parts where it is needed
  • ...

Please find the results of the JMH benchmarks attached. In a nutshell, we can see no regression (on the contrary) for messages of type SUBSCRIBE/UNSUBSCRIBE/MESSAGE and almost doubled performance for HEARTBEAT messages.

Let me know what you think.

Cheers,
Christoph


Affects: 4.3.8

Attachments:

Referenced from: pull request #1439, and commits d3e3365, 0ef1623, 6aeb8ef

@spring-projects-issues
Copy link
Collaborator Author

Christoph Dreis commented

Thanks for accepting the PR. Is a backport to 4.3.x possible? Would be highly appreciated.

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

Sure, from my perspective. Rossen Stoyanchev, could you do that backport please?

@spring-projects-issues
Copy link
Collaborator Author

Rossen Stoyanchev commented

This is now in 4.3.x as well.

@spring-projects-issues
Copy link
Collaborator Author

Christoph Dreis commented

Thanks a lot! :)

@spring-projects-issues spring-projects-issues added in: messaging Issues in messaging modules (jms, messaging) type: enhancement A general enhancement labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 4.3.9 milestone Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: messaging Issues in messaging modules (jms, messaging) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants