Skip to content

Commit

Permalink
Use a separate indis warmup executor service (#961)
Browse files Browse the repository at this point in the history
* Use a separate indis warmup executor service

* add setters for executors
  • Loading branch information
bohhyang authored Dec 22, 2023
1 parent f544643 commit 76fb4b6
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 3 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ and what APIs have changed, if applicable.

## [Unreleased]

## [29.49.1] - 2023-12-21
- Use a separate indis warmup executor service

## [29.49.0] - 2023-12-21
- Bump minor version due to internal LinkedIn tooling requirement. No functional changes.

Expand Down Expand Up @@ -5594,7 +5597,8 @@ patch operations can re-use these classes for generating patch messages.

## [0.14.1]

[Unreleased]: https://github.com/linkedin/rest.li/compare/v29.49.0...master
[Unreleased]: https://github.com/linkedin/rest.li/compare/v29.49.1...master
[29.49.1]: https://github.com/linkedin/rest.li/compare/v29.49.0...v29.49.1
[29.49.0]: https://github.com/linkedin/rest.li/compare/v29.48.9...v29.49.0
[29.48.9]: https://github.com/linkedin/rest.li/compare/v29.48.8...v29.48.9
[29.48.8]: https://github.com/linkedin/rest.li/compare/v29.48.7...v29.48.8
Expand Down
20 changes: 20 additions & 0 deletions d2/src/main/java/com/linkedin/d2/balancer/D2ClientBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,13 @@ public D2Client build()
executorsToShutDown.add(_config.startUpExecutorService);
}

if (_config.indisStartUpExecutorService == null)
{
_config.indisStartUpExecutorService =
Executors.newScheduledThreadPool(0, new NamedThreadFactory("INDIS D2 StartupOnlyExecutor"));
executorsToShutDown.add(_config.indisStartUpExecutorService);
}

if (_config._executorService == null)
{
LOG.warn("No executor service passed as argument. Pass it for " +
Expand Down Expand Up @@ -189,6 +196,7 @@ public D2Client build()
_config.sslSessionValidatorFactory,
_config.zkConnectionToUseForLB,
_config.startUpExecutorService,
_config.indisStartUpExecutorService,
_config.jmxManager,
_config.d2JmxManagerPrefix,
_config.zookeeperReadWindowMs,
Expand Down Expand Up @@ -533,6 +541,18 @@ public D2ClientBuilder setWarmUpConcurrentRequests(int warmUpConcurrentRequests)
return this;
}

public D2ClientBuilder setStartUpExecutorService(ScheduledExecutorService executorService)
{
_config.startUpExecutorService = executorService;
return this;
}

public D2ClientBuilder setIndisStartUpExecutorService(ScheduledExecutorService executorService)
{
_config.indisStartUpExecutorService = executorService;
return this;
}

public D2ClientBuilder setDownstreamServicesFetcher(DownstreamServicesFetcher downstreamServicesFetcher)
{
_config.downstreamServicesFetcher = downstreamServicesFetcher;
Expand Down
3 changes: 3 additions & 0 deletions d2/src/main/java/com/linkedin/d2/balancer/D2ClientConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ public class D2ClientConfig
public SslSessionValidatorFactory sslSessionValidatorFactory = null;
ZKPersistentConnection zkConnectionToUseForLB = null;
public ScheduledExecutorService startUpExecutorService = null;
public ScheduledExecutorService indisStartUpExecutorService = null;
public JmxManager jmxManager = new NoOpJmxManager();
public String d2JmxManagerPrefix = "UnknownPrefix";
boolean enableRelativeLoadBalancer = false;
Expand Down Expand Up @@ -185,6 +186,7 @@ public D2ClientConfig()
SslSessionValidatorFactory sslSessionValidatorFactory,
ZKPersistentConnection zkConnection,
ScheduledExecutorService startUpExecutorService,
ScheduledExecutorService indisStartUpExecutorService,
JmxManager jmxManager,
String d2JmxManagerPrefix,
int zookeeperReadWindowMs,
Expand Down Expand Up @@ -251,6 +253,7 @@ public D2ClientConfig()
this.sslSessionValidatorFactory = sslSessionValidatorFactory;
this.zkConnectionToUseForLB = zkConnection;
this.startUpExecutorService = startUpExecutorService;
this.indisStartUpExecutorService = indisStartUpExecutorService;
this.jmxManager = jmxManager;
this.d2JmxManagerPrefix = d2JmxManagerPrefix;
this.zookeeperReadWindowMs = zookeeperReadWindowMs;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public LoadBalancerWithFacilities create(D2ClientConfig config)

if (config.warmUp)
{
balancer = new WarmUpLoadBalancer(balancer, xdsLoadBalancer, config.startUpExecutorService, config.indisFsBasePath,
balancer = new WarmUpLoadBalancer(balancer, xdsLoadBalancer, config.indisStartUpExecutorService, config.indisFsBasePath,
config.d2ServicePath, config.indisDownstreamServicesFetcher, config.warmUpTimeoutSeconds,
config.warmUpConcurrentRequests, config.dualReadStateManager);
}
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version=29.49.0
version=29.49.1
group=com.linkedin.pegasus
org.gradle.configureondemand=true
org.gradle.parallel=true
Expand Down

0 comments on commit 76fb4b6

Please sign in to comment.