-
Notifications
You must be signed in to change notification settings - Fork 41
Open
Labels
enhancementNew feature or improved functionality.New feature or improved functionality.
Description
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).
Token id: 12 with time since start 5123ms
Token id: 4 with time since start 5122ms
Token id: 14 with time since start 5122ms
Token id: 26 with time since start 5122ms
Token id: 39 with time since start 5121ms
Token id: 16 with time since start 5100ms
Token id: 1 with time since start 5124ms
Token id: 7 with time since start 5100ms
Token id: 18 with time since start 5123ms
Token id: 30 with time since start 5112ms
ably-java/lib/src/main/java/io/ably/lib/rest/Auth.java
Lines 850 to 851 in b2e6b22
String tokenPath = "/keys/" + signedTokenRequest.keyName + "/requestToken"; return HttpHelpers.postSync(ably.http, tokenPath, null, null, new HttpUtils.JsonRequestBody(signedTokenRequest.asJsonElement().toString()), new HttpCore.ResponseHandler<TokenDetails>() { public class SyncHttpScheduler extends HttpScheduler {
Metadata
Metadata
Assignees
Labels
enhancementNew feature or improved functionality.New feature or improved functionality.