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

RoundRobinLoadBalancer default Executor with unbounded queue #1937

Merged
merged 1 commit into from
Nov 4, 2021

Conversation

chemicL
Copy link
Contributor

@chemicL chemicL commented Nov 4, 2021

Motivation:

The default Executor used by RoundRobinLoadBalancer for health
checking uses a single Thread combined with a SynchronousQueue.
If multiple health checks are executed simultaneously, that can lead to
task rejections and health checks failing. The proper implementation can
still use a single thread, but should queue scheduled tasks.

Modification:

Default RoundRobinLoadBalancerFactory.SharedExecutor uses
a single-threaded, unbounded ThreadPoolExecutor to schedule health checks.

Result:

Health checks can be safely rescheduled using the default executor used
by RoundRobinLoadBalancer.

Motivation:

The default `Executor` used by `RoundRobinLoadBalancer` for health
checking uses a single `Thread` combined with a `SynchronousQueue`.
If multiple health checks are executed simultaneously, that can lead to
task rejections and health checks failing. The proper implementation can
still use a single thread, but should queue scheduled tasks.

Modification:

Default `RoundRobinLoadBalancerFactory.SharedExecutor` uses
a single-threaded, unbounded `ThreadPoolExecutor` to schedule health checks.

Result:

Health checks can be safely rescheduled using the default executor used
by `RoundRobinLoadBalancer`.
@idelpivnitskiy
Copy link
Member

Verified locally, it fixes the issue. We will add tests in a follow-up

@idelpivnitskiy idelpivnitskiy merged commit e08b956 into apple:main Nov 4, 2021
idelpivnitskiy pushed a commit that referenced this pull request Nov 4, 2021
Motivation:

The default `Executor` used by `RoundRobinLoadBalancer` for health
checking uses a single `Thread` combined with a `SynchronousQueue`.
If multiple health checks are executed simultaneously, that can lead to
task rejections and health checks failing. The proper implementation can
still use a single thread, but should queue scheduled tasks.

Modification:

Default `RoundRobinLoadBalancerFactory.SharedExecutor` uses
a single-threaded, unbounded `ThreadPoolExecutor` to schedule health checks.

Result:

Health checks can be safely rescheduled using the default executor used
by `RoundRobinLoadBalancer`.
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