From 76fb4b63f371513b567505faa1659e260c7bcb93 Mon Sep 17 00:00:00 2001 From: Bohan Yang Date: Thu, 21 Dec 2023 17:31:03 -0800 Subject: [PATCH] Use a separate indis warmup executor service (#961) * Use a separate indis warmup executor service * add setters for executors --- CHANGELOG.md | 6 +++++- .../linkedin/d2/balancer/D2ClientBuilder.java | 20 +++++++++++++++++++ .../linkedin/d2/balancer/D2ClientConfig.java | 3 +++ .../XdsLoadBalancerWithFacilitiesFactory.java | 2 +- gradle.properties | 2 +- 5 files changed, 30 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d5d930f168..b36b02e5f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. @@ -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 diff --git a/d2/src/main/java/com/linkedin/d2/balancer/D2ClientBuilder.java b/d2/src/main/java/com/linkedin/d2/balancer/D2ClientBuilder.java index ea4838c15c..d3183aea39 100644 --- a/d2/src/main/java/com/linkedin/d2/balancer/D2ClientBuilder.java +++ b/d2/src/main/java/com/linkedin/d2/balancer/D2ClientBuilder.java @@ -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 " + @@ -189,6 +196,7 @@ public D2Client build() _config.sslSessionValidatorFactory, _config.zkConnectionToUseForLB, _config.startUpExecutorService, + _config.indisStartUpExecutorService, _config.jmxManager, _config.d2JmxManagerPrefix, _config.zookeeperReadWindowMs, @@ -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; diff --git a/d2/src/main/java/com/linkedin/d2/balancer/D2ClientConfig.java b/d2/src/main/java/com/linkedin/d2/balancer/D2ClientConfig.java index 8f7fc44b52..ae14d92ee7 100644 --- a/d2/src/main/java/com/linkedin/d2/balancer/D2ClientConfig.java +++ b/d2/src/main/java/com/linkedin/d2/balancer/D2ClientConfig.java @@ -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; @@ -185,6 +186,7 @@ public D2ClientConfig() SslSessionValidatorFactory sslSessionValidatorFactory, ZKPersistentConnection zkConnection, ScheduledExecutorService startUpExecutorService, + ScheduledExecutorService indisStartUpExecutorService, JmxManager jmxManager, String d2JmxManagerPrefix, int zookeeperReadWindowMs, @@ -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; diff --git a/d2/src/main/java/com/linkedin/d2/xds/balancer/XdsLoadBalancerWithFacilitiesFactory.java b/d2/src/main/java/com/linkedin/d2/xds/balancer/XdsLoadBalancerWithFacilitiesFactory.java index a05fc1ef2a..d64e867e81 100644 --- a/d2/src/main/java/com/linkedin/d2/xds/balancer/XdsLoadBalancerWithFacilitiesFactory.java +++ b/d2/src/main/java/com/linkedin/d2/xds/balancer/XdsLoadBalancerWithFacilitiesFactory.java @@ -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); } diff --git a/gradle.properties b/gradle.properties index 8714af71e4..2e9ea961fb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -version=29.49.0 +version=29.49.1 group=com.linkedin.pegasus org.gradle.configureondemand=true org.gradle.parallel=true