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

Azure client message receiver not thread safe ? #690

Closed
boly38 opened this issue May 9, 2016 · 3 comments
Closed

Azure client message receiver not thread safe ? #690

boly38 opened this issue May 9, 2016 · 3 comments

Comments

@boly38
Copy link

boly38 commented May 9, 2016

Hi all
When using azure java SDK ServiceBus client (version 0.9.3), sometime I receive no message when the queue (or topic) is not empty.
(I'm not 100% sure that this issue is the same as issue #644 so that's why I created this new issue).

I try to reproduce this behavior multiple times without success but I finally find a way to reproduce it by applying a parallel procedure.

I have created a dedicated project to reproduce the issue. feel free to clone, build, start and comment the following project : https://github.com/boly38/azurejavasdk-queue-test

This project main class demonstrates that sending and receiving messages on a azure bus queue works well in sequence but not in parallel.

#### test_client_sequence
(...)
ERROR COUNT=0
#### test_client_parallel
(...)
ERROR COUNT=5

Could you tell me if I'm wrong somewhere or else when do you plan to fix it ?
Maybe there is a more recent version than 0.9.3 but I am not able to find it on search.maven.org ?

@jianghaolu
Copy link
Contributor

Adding owner of the service bus library: @djrosanova

@boly38
Copy link
Author

boly38 commented May 12, 2016

Summary of discussion with Microsoft Azure support

In my case performance issue were due to "partitioning" feature.
I didn't reproduce the issue with a non partitioned entity.

Details about partitioned entities : https://azure.microsoft.com/en-us/documentation/articles/service-bus-partitioning/

Partitioned entities could be the reason why you are seeing the slow receive, 
because of the way partitioned entities work internally. 
When you call receive on a partitioned queue all fragments get queried for messages, 
then the first message that is obtained from any of the messaging stores is returned to the receiver. 
Service Bus caches the other messages and returns them when it receives additional receive requests 
but they also have a lock.
So when another thread tries to receive a message it could happen that it simply waits for the lock to timeout.
If you increase the inflow of messages this should not happen, or if you test with only one thread.

(That behavior is so strange for me: I have to wait a lock time for message that I have never heard about before.)

I asked about "batch mode":

does this flag set to true fix that (partitioning-related lock) behavior ?

Answer:

client side batching is currently not supported for HTTP, however the AMQP java based SDK should support this.

From my point of view, this information is enough to close this issue.
Regards

@alvadb
Copy link
Contributor

alvadb commented Jul 25, 2017

the service bus client library is not in this repo anymore, so if this is still an issue, it should go there:
https://github.com/azure/azure-service-bus-java

@alvadb alvadb closed this as completed Jul 25, 2017
@github-actions github-actions bot locked and limited conversation to collaborators Apr 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants