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

Least connected load balancing strategy #267

Merged
merged 4 commits into from
Jul 14, 2017

Conversation

lutovich
Copy link
Contributor

@lutovich lutovich commented Jul 11, 2017

This replaces the existing round-robin. It gives us better performance with clusters composed of different machine capacities. Lease connected load balancing strategy selects start index in round robin fashion to avoid always selecting same machine when cluster does not have any running transactions or all machines have same number of active connections.

It is possible to go back to previous round-robin load balancing strategy using an experimental config setting:

  {loadBalancingStrategy: 'round_robin'}

It will now track count of active (checked out of the pool) resources
per key. Where key is a server address in the driver. Counter is
incremented when resource is acquired from the pool and decremented
when resource is released back to the pool.

Also added JSDocs in the `Pool` class.
@lutovich lutovich force-pushed the 1.5-least-connected-lb branch from ec52f96 to 8378026 Compare July 11, 2017 16:14
This replaces the existing round-robin. It gives us better performance
with clusters composed of different machine capacities.
Lease connected load balancing strategy selects start index in
round-robin fashion to avoid always selecting same machine when cluster
does not have any running transactions or all machines have same number
of active connections.

It is possible to go back to previous round-robin load balancing
strategy using an experimental config setting:
```
  {loadBalancingStrategy: 'round_robin'}
```
@lutovich lutovich force-pushed the 1.5-least-connected-lb branch from 576d9b4 to c7281ce Compare July 11, 2017 21:59
const strategy = RoutingDriver._createLoadBalancingStrategy({loadBalancingStrategy: 'round_robin'}, new Pool());
expect(strategy instanceof RoundRobinLoadBalancingStrategy).toBeTruthy();
});

Copy link
Contributor

Choose a reason for hiding this comment

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

This is missing a test case for 'Unknown load balancing strategy

@lutovich
Copy link
Contributor Author

@praveenag test added

@lutovich lutovich merged commit bcf95d1 into neo4j:1.5 Jul 14, 2017
@lutovich lutovich deleted the 1.5-least-connected-lb branch July 14, 2017 08:40
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.

2 participants