-
Notifications
You must be signed in to change notification settings - Fork 40
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
Use of singleton SyncHttpScheduler limits concurrency of requestToken calls #1001
Comments
@zknill let me check on this and get back to you |
Can you provide some information for further clarification
|
As per internal discussion =>
|
That's not always true. It's legitimate, although not recommended, for a server to generate tokens and forward them to clients, in which case the server will be generating tokens at a high rate. |
I thought only server is recommended to have access for ROOT |
Server can also use
In such a case, there shouldn't be an issue with generating tokens in multithreading environment. |
Calls to
requestToken
are sync in the SDK, and use a singleton executor in the SyncHttpScheduler. This means that requests will queue behind each other.If you have 50 threads creating tokens, the executor can only do 1 thread worth of throughput.
Also related, adding more threads creating tokens means that all threads end up taking longer (not just the later threads taking linearly longer).
ably-java/lib/src/main/java/io/ably/lib/rest/Auth.java
Lines 850 to 851 in b2e6b22
ably-java/lib/src/main/java/io/ably/lib/http/SyncHttpScheduler.java
Line 8 in b2e6b22
┆Issue is synchronized with this Jira Task by Unito
The text was updated successfully, but these errors were encountered: