summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config-proxy/src/main/java/com/yahoo/vespa/config/proxy/filedistribution/FileDistributionAndUrlDownload.java19
-rw-r--r--flags/src/main/java/com/yahoo/vespa/flags/Flags.java7
2 files changed, 25 insertions, 1 deletions
diff --git a/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/filedistribution/FileDistributionAndUrlDownload.java b/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/filedistribution/FileDistributionAndUrlDownload.java
index f2f52dca9fa..3e7f7418ce2 100644
--- a/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/filedistribution/FileDistributionAndUrlDownload.java
+++ b/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/filedistribution/FileDistributionAndUrlDownload.java
@@ -4,13 +4,18 @@ package com.yahoo.vespa.config.proxy.filedistribution;
import com.yahoo.concurrent.DaemonThreadFactory;
import com.yahoo.config.subscription.ConfigSourceSet;
import com.yahoo.jrt.Supervisor;
+import com.yahoo.vespa.config.ConnectionPool;
import com.yahoo.vespa.config.JRTConnectionPool;
+import com.yahoo.vespa.filedistribution.FileDistributionConnectionPool;
import com.yahoo.vespa.filedistribution.FileDownloader;
import java.time.Duration;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
+import java.util.logging.Logger;
+
+import static java.util.logging.Level.INFO;
/**
* Keeps track of file distribution and url download rpc servers.
@@ -19,7 +24,9 @@ import java.util.concurrent.TimeUnit;
*/
public class FileDistributionAndUrlDownload {
+ private static final Logger log = Logger.getLogger(FileDistributionAndUrlDownload.class.getName());
private static final Duration delay = Duration.ofMinutes(1);
+
private final FileDistributionRpcServer fileDistributionRpcServer;
private final UrlDownloadRpcServer urlDownloadRpcServer;
private final ScheduledExecutorService cleanupExecutor =
@@ -28,7 +35,7 @@ public class FileDistributionAndUrlDownload {
public FileDistributionAndUrlDownload(Supervisor supervisor, ConfigSourceSet source) {
fileDistributionRpcServer =
new FileDistributionRpcServer(supervisor,
- new FileDownloader(new JRTConnectionPool(source, supervisor), supervisor, Duration.ofMinutes(5)));
+ new FileDownloader(createConnectionPool(supervisor, source), supervisor, Duration.ofMinutes(5)));
urlDownloadRpcServer = new UrlDownloadRpcServer(supervisor);
cleanupExecutor.scheduleAtFixedRate(new CachedFilesMaintainer(), delay.toSeconds(), delay.toSeconds(), TimeUnit.SECONDS);
}
@@ -45,4 +52,14 @@ public class FileDistributionAndUrlDownload {
}
}
+ private static ConnectionPool createConnectionPool(Supervisor supervisor, ConfigSourceSet source) {
+ String useFileDistributionConnectionPool = System.getenv("VESPA_CONFIG_PROXY_USE_FILE_DISTRIBUTION_CONNECTION_POOL");
+ // TODO: Lower log level or remove when verified
+ log.log(INFO, "VESPA_CONFIG_PROXY_USE_FILE_DISTRIBUTION_CONNECTION_POOL: " + useFileDistributionConnectionPool);
+ if (useFileDistributionConnectionPool != null && useFileDistributionConnectionPool.equalsIgnoreCase("true"))
+ return new FileDistributionConnectionPool(source, supervisor);
+ else
+ return new JRTConnectionPool(source, supervisor);
+ }
+
}
diff --git a/flags/src/main/java/com/yahoo/vespa/flags/Flags.java b/flags/src/main/java/com/yahoo/vespa/flags/Flags.java
index 22374cb5b50..89a97f3e17d 100644
--- a/flags/src/main/java/com/yahoo/vespa/flags/Flags.java
+++ b/flags/src/main/java/com/yahoo/vespa/flags/Flags.java
@@ -384,6 +384,13 @@ public class Flags {
"Takes effect on config server restart",
ZONE_ID);
+ public static final UnboundBooleanFlag CONFIG_PROXY_USE_FILE_DISTRIBUTION_CONNECTION_POOL = defineFeatureFlag(
+ "config-proxy-use-file-distribution-connection-pool", false,
+ List.of("hmusum"), "2021-11-25", "2021-12-25",
+ "Whether to use FileDistributionConnectionPool instead of JRTConnectionPool for file downloads in config proxy",
+ "Takes effect on container reboot",
+ ZONE_ID, APPLICATION_ID);
+
public static final UnboundBooleanFlag USE_V8_GEO_POSITIONS = defineFeatureFlag(
"use-v8-geo-positions", false,
List.of("arnej"), "2021-11-15", "2022-12-31",