Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
[Service Bus] Allow 0 prefetch and dynamically use batch size to request link credits #17546
[Service Bus] Allow 0 prefetch and dynamically use batch size to request link credits #17546
Changes from 21 commits
fd1843a
deadef5
945f1c8
98d07dd
ef52f71
36c4302
1a5c4c4
d43457e
34c70ce
e7aa8bc
152e193
65cdcf6
c4a14f0
41d08ab
124baab
5743dcb
8986b2f
39bac24
5572e15
530e258
aee463c
bafc0e4
037cbbc
3774d66
09fca43
fe7ee04
59aee7b
8ea5ba6
24e3421
de311a8
29085d3
4c837b5
3c23542
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of the calls into Proton-j Reactor is done via ReactorDispatcher because of thread safety,
As commented here ..
https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/ReactorDispatcher.java#L22
Would this be okay to call this api directly ? @srnagar Would this be okay here ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be tested for thread-safety. If proton-j doesn't support adding credits in a thread-safe manner we might add incorrect number of credits to the link and can potentially result in data loss if the SB mode is RECEIVE_AND_DELETE
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I simply put it into a synchronized block. The performance overhead should be minimal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed back to addCredits()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is removed because the publish( ) method requests the upstream (link processor) with its own request count (the reactor prefetch). With publish(), the
SynchronousMessageSubscriber
can't pass its own request count to link processor. The request is used to adjust link credits when prefetch = 0 (default value).Updated to still remove publish() from this place and updated the async client's receiveMessages() to publish and autoConnect. So the user can subscribe it more than once. For
SynchronousMessageSubscriber
, I use an internal API to avoid the publish() side effect.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just like we have
addCreditsInstantly
, adding locally , DoesgetCredits
return from local? And if it is returning from remote, there could be short time when there is diff in local v/s remote .Should there is equivalent
getCreditsInstantly
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getCredits() should return from local. I don't see a log for traffic of getCredits.