From 36bd0d5e3319ce562681f0819774266b8ff29790 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Christian=20Seime?= Date: Tue, 14 Jan 2025 17:10:21 +0100 Subject: [PATCH] Determine queue size based on feature flag --- config-model-api/abi-spec.json | 3 ++- .../java/com/yahoo/config/model/api/ModelContext.java | 1 + .../model/container/ApplicationContainerCluster.java | 11 +++++++++++ .../vespa/config/server/deploy/ModelContextImpl.java | 3 +++ flags/src/main/java/com/yahoo/vespa/flags/Flags.java | 7 +++++++ 5 files changed, 24 insertions(+), 1 deletion(-) diff --git a/config-model-api/abi-spec.json b/config-model-api/abi-spec.json index a1b40b93813..7c371192f29 100644 --- a/config-model-api/abi-spec.json +++ b/config-model-api/abi-spec.json @@ -1344,7 +1344,8 @@ "public boolean useLegacyWandQueryParsing()", "public boolean forwardAllLogLevels()", "public long zookeeperPreAllocSize()", - "public int distributionBitsInDev()" + "public int distributionBitsInDev()", + "public int documentV1QueueSize()" ], "fields" : [ ] }, diff --git a/config-model-api/src/main/java/com/yahoo/config/model/api/ModelContext.java b/config-model-api/src/main/java/com/yahoo/config/model/api/ModelContext.java index 21e7af853f4..51c44e7ac95 100644 --- a/config-model-api/src/main/java/com/yahoo/config/model/api/ModelContext.java +++ b/config-model-api/src/main/java/com/yahoo/config/model/api/ModelContext.java @@ -126,6 +126,7 @@ interface FeatureFlags { @ModelFeatureFlag(owners = {"hmusum"}) default boolean forwardAllLogLevels() { return true; } @ModelFeatureFlag(owners = {"hmusum"}) default long zookeeperPreAllocSize() { return 65536L; } @ModelFeatureFlag(owners = {"hmusum"}) default int distributionBitsInDev() { return 0; } + @ModelFeatureFlag(owners = {"bjorncs"}) default int documentV1QueueSize() { return -1; } } /** Warning: As elsewhere in this package, do not make backwards incompatible changes that will break old config models! */ diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainerCluster.java b/config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainerCluster.java index 18794609939..2a96201416e 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainerCluster.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainerCluster.java @@ -26,6 +26,7 @@ import com.yahoo.container.handler.metrics.PrometheusV1Handler; import com.yahoo.container.jdisc.ContainerMbusConfig; import com.yahoo.container.jdisc.messagebus.MbusServerProvider; +import com.yahoo.document.restapi.DocumentOperationExecutorConfig; import com.yahoo.osgi.provider.model.ComponentModel; import com.yahoo.search.config.QrStartConfig; import com.yahoo.vespa.config.search.RankProfilesConfig; @@ -71,6 +72,7 @@ public final class ApplicationContainerCluster extends ContainerCluster parent, String configSu onnxModelCostCalculator = deployState.onnxModelCost().newCalculator( deployState.getApplicationPackage(), deployState.getProperties().applicationId(), ClusterSpec.Id.from(clusterId)); logger = deployState.getDeployLogger(); + documentV1QueueSize = deployState.featureFlags().documentV1QueueSize(); } public UserConfiguredUrls userConfiguredUrls() { return userConfiguredUrls; } @@ -426,6 +430,13 @@ private static boolean configureEndpoints(DeployState deployState) { return true; } + @Override + public void getConfig(DocumentOperationExecutorConfig.Builder builder) { + if (documentV1QueueSize >= 0) { + builder.maxThrottled(documentV1QueueSize); + } + } + public static class MbusParams { // the amount of the maxpendingbytes to process concurrently, typically 0.2 (20%) final Double maxConcurrentFactor; diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/deploy/ModelContextImpl.java b/configserver/src/main/java/com/yahoo/vespa/config/server/deploy/ModelContextImpl.java index 3abc09c5ff5..04c4d5ebe88 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/deploy/ModelContextImpl.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/deploy/ModelContextImpl.java @@ -217,6 +217,7 @@ public static class FeatureFlags implements ModelContext.FeatureFlags { private final boolean forwardAllLogLevels; private final long zookeeperPreAllocSize; private final int distributionBitsInDev; + private final int documentV1QueueSize; public FeatureFlags(FlagSource source, ApplicationId appId, Version version) { this.defaultTermwiseLimit = Flags.DEFAULT_TERM_WISE_LIMIT.bindTo(source).with(appId).with(version).value(); @@ -270,6 +271,7 @@ public FeatureFlags(FlagSource source, ApplicationId appId, Version version) { this.forwardAllLogLevels = PermanentFlags.FORWARD_ALL_LOG_LEVELS.bindTo(source).with(appId).with(version).value(); this.zookeeperPreAllocSize = Flags.ZOOKEEPER_PRE_ALLOC_SIZE_KIB.bindTo(source).value(); this.distributionBitsInDev = Flags.DISTRIBUTION_BITS_IN_DEV.bindTo(source).value(); + this.documentV1QueueSize = Flags.DOCUMENT_V1_QUEUE_SIZE.bindTo(source).with(appId).with(version).value(); } @Override public int heapSizePercentage() { return heapPercentage; } @@ -329,6 +331,7 @@ public FeatureFlags(FlagSource source, ApplicationId appId, Version version) { @Override public boolean forwardAllLogLevels() { return forwardAllLogLevels; } @Override public long zookeeperPreAllocSize() { return zookeeperPreAllocSize; } @Override public int distributionBitsInDev() { return distributionBitsInDev; } + @Override public int documentV1QueueSize() { return documentV1QueueSize; } } public static class Properties implements ModelContext.Properties { 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 3aa56588730..c93bb2cf5b0 100644 --- a/flags/src/main/java/com/yahoo/vespa/flags/Flags.java +++ b/flags/src/main/java/com/yahoo/vespa/flags/Flags.java @@ -468,6 +468,13 @@ public class Flags { "Takes effect at redeployment", INSTANCE_ID); + public static final UnboundIntFlag DOCUMENT_V1_QUEUE_SIZE = defineIntFlag( + "document-v1-queue-size", -1, + List.of("bjorncs"), "2025-01-14", "2025-12-01", + "Size of the document v1 queue. Use -1 for default as determined by 'document-operation-executor.def'", + "Takes effect at redeployment", + INSTANCE_ID); + /** WARNING: public for testing: All flags should be defined in {@link Flags}. */ public static UnboundBooleanFlag defineFeatureFlag(String flagId, boolean defaultValue, List owners, String createdAt, String expiresAt, String description,