Skip to content
This repository has been archived by the owner on Oct 12, 2023. It is now read-only.

defer close the link! #244

Merged
merged 5 commits into from
Aug 13, 2021
Merged

defer close the link! #244

merged 5 commits into from
Aug 13, 2021

Conversation

serbrech
Copy link
Member

Servicebus allows a maximum of 5000 open sessions.
Because we don't close it after each calls, the sessions stay active until they reach an idle timeout and get closed by the remote peer.
if you have enough load, you will reach max sessions pretty quickly as this is called for each message disposition, lock renewal, or management operations.

A better optimization would be to keep a dediccated management session around to avoid opening and closing so many sessions (handshake overhead)

Copy link
Member

@richardpark-msft richardpark-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thank you for fixing that.

rpc.go Outdated Show resolved Hide resolved
@serbrech
Copy link
Member Author

erg, seems I changed some behavior.
got a nil pointer in my tests.

@serbrech
Copy link
Member Author

I just reverted to defer in the for loop.
drawback is that it will wait to exit the func to close the links created within the for loop, instead of closing them as soon as it can. I think thats ok, even if it's not perfect. Eventually, the whole link management part for RPC calls need to be re-designed to be cached/reused

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants