Remove timeouts completely from ClientBuilder#110
Closed
Conversation
Contributor
|
👍 . @stevegury can you take a look? |
Member
|
Please provide a minimal description of the motivations behind this PR. |
**Problem** The loadbalancer uses internally 2 maps, one for the list of `ReactiveSocketFactory` it can use for creating a new `ReactiveSocket`, and one for the active `ReactiveSocket`. The link is made between the 2 maps through the `SocketAddress` of the associated remote server. This is kind of clunky and requires explicit knowledge of the `SocketAddress` (result type of `remote()`). Also, when we select a new factory to connect to or when we select the slowest ReactiveSocket to quick out, the sorting is made via the `sorted()` method on the java stream. The comparison function is actually unstable because a tcp socket can be closed while we do the sorting. **Solution** Use two queues, one for factories and one for ReactiveSocket. Selecting a factory is made using the "Power of 2 Choices" technique, and we also "age" the unselected factories by moving them at the end of the queue. The WeightedSocket now contains a reference to the associated factory, and closing it add back the factory to the factory queue. **Modification** Move the `WeightedSocket` class inside the `LoadBalancer`, no I created a proper constructor to `LoadBalancer` with javadoc explaining all parameters the algorithm requires. The `LatencySubscriber` inside the LoadBalancer treats some exceptions particularly: - `TimeoutException` latency is used for predicating the next latency - `TransportException` & `ClosedChannelException` removes the ReactiveSocket from the active list. `Publishers.onError` now also `cancel` the subscription. I created a StressTest file, which stress most of the part of the Client: - Adding/Removing new servers - High request concurrency - Dealing with failing/black-hole servers
024d3f7 to
0dbbc40
Compare
Contributor
|
@rdegnan I think we don't need this anymore, rite? |
Member
|
I've merged most of that in #112 and the remaining will be in another PR. |
Contributor
|
Ok I am closing this now. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.