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

Load Balancing Group routing object #429

Merged
merged 6 commits into from
Jun 28, 2019

Conversation

mikkokar
Copy link
Contributor

Adds a LoadBalancingGroup routing object that balances load between other routing objects. Specifically it can load balance between HostProxy objects, and can be used with PathPrefixRouter to perform styx application routing. Currently, only Pow2 load balancing algorithm is supported.

@mikkokar mikkokar requested review from kvosper and dvlato June 11, 2019 07:08
Copy link
Contributor

@kvosper kvosper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you may need to rebase from master. I will continue reviewing after.

*
* @return a collection of all entries.
*/
Collection<Map.Entry<String, T>> entrySet();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we consider using com.hotels.styx.common.Pair instead of Map.Entry?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly. Can you think of any pros/cons using Pair vs Map.Entry?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Map.Entry does have a method setValue(V value) for mutating it (or throwing UnsupportedOperationException), which could give the illusion of mutability, however most Java programmers will be aware of the awkward way that the JCF handles immutable classes.

Otherwise, it doesn't really make a difference, so if Map.Entry is more convenient otherwise, I think we can put up with it.

import java.nio.charset.StandardCharsets.UTF_8
import java.util.concurrent.CompletableFuture

fun routingObjectDef(text: String) = YamlConfig(text).`as`((RoutingObjectDefinition::class.java))

data class RoutingContext(
internal data class RoutingObjectFactoryContext(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's probably not too clear from its usage (import com.hotels.styx.routing.RoutingObjectFactoryContext, etc.) that this is a test class with default values. Maybe we could choose a different name,

Add RoutingObjectAdapter for providing load balancing metric.
Add `entrySet` method to ObjectStore.
Add `whenFinished` action to ResponseEventListener.
Add functional test suite for LoadBalancingGroup.
LoadBalancingGroup: Add functional tests for sticky sessions and
origins restriction cookie.
Rename HttpHandlerFactory class to RoutingObjectFactory.
Kotlin: RoutingObjectFactoryContext.

Rename to Builtins.
Address code review comments.
Remove all safe calls from Kotlin tests.
@mikkokar mikkokar merged commit a1d1f31 into ExpediaGroup:master Jun 28, 2019
@mikkokar mikkokar deleted the application-router branch June 28, 2019 09:25
dvlato pushed a commit that referenced this pull request Jul 3, 2019
* Add LoadBalancingGroup routing object.
* Add RoutingObjectDecorator to provide a load balancing metric.
* Add `entrySet` method to ObjectStore.
* Add `whenFinished` action to ResponseEventListener.
* Rename HttpHandlerFactory class to RoutingObjectFactory.
* Remove safe calls from Kotlin tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants