aboutsummaryrefslogtreecommitdiffstats
path: root/config-model
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2022-01-12 14:34:36 +0100
committerGitHub <noreply@github.com>2022-01-12 14:34:36 +0100
commit3410b8997ce99abfc97b13d270509f08f9c478fc (patch)
treec98dd44cbc121848ed1d5715bbcf5ea51240260e /config-model
parent45f2f43a043eb08d2c01c2d144096e6e6bf4e082 (diff)
parent5e425b8215b05e573ee9321f1cae509bb259d370 (diff)
Merge pull request #20772 from vespa-engine/vekterli/add-feature-flag-for-persistence-async-throttling
Add feature flag for controlling throttling of async persistence operations
Diffstat (limited to 'config-model')
-rw-r--r--config-model/src/main/java/com/yahoo/config/model/deploy/TestProperties.java7
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/content/storagecluster/FileStorProducer.java11
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/content/StorageClusterTest.java19
3 files changed, 37 insertions, 0 deletions
diff --git a/config-model/src/main/java/com/yahoo/config/model/deploy/TestProperties.java b/config-model/src/main/java/com/yahoo/config/model/deploy/TestProperties.java
index 0007fa0d18a..2dc91ab1b1f 100644
--- a/config-model/src/main/java/com/yahoo/config/model/deploy/TestProperties.java
+++ b/config-model/src/main/java/com/yahoo/config/model/deploy/TestProperties.java
@@ -77,6 +77,7 @@ public class TestProperties implements ModelContext.Properties, ModelContext.Fea
private int maxCompactBuffers = 1;
private boolean failDeploymentWithInvalidJvmOptions = false;
private double tlsSizeFraction = 0.02;
+ private String persistenceAsyncThrottling = "UNLIMITED";
@Override public ModelContext.FeatureFlags featureFlags() { return this; }
@Override public boolean multitenant() { return multitenant; }
@@ -134,6 +135,7 @@ public class TestProperties implements ModelContext.Properties, ModelContext.Fea
@Override public int maxCompactBuffers() { return maxCompactBuffers; }
@Override public boolean failDeploymentWithInvalidJvmOptions() { return failDeploymentWithInvalidJvmOptions; }
@Override public double tlsSizeFraction() { return tlsSizeFraction; }
+ @Override public String persistenceAsyncThrottling() { return persistenceAsyncThrottling; }
public TestProperties maxUnCommittedMemory(int maxUnCommittedMemory) {
this.maxUnCommittedMemory = maxUnCommittedMemory;
@@ -356,6 +358,11 @@ public class TestProperties implements ModelContext.Properties, ModelContext.Fea
return this;
}
+ public TestProperties setPersistenceAsyncThrottling(String type) {
+ this.persistenceAsyncThrottling = type;
+ return this;
+ }
+
public static class Spec implements ConfigServerSpec {
private final String hostName;
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/content/storagecluster/FileStorProducer.java b/config-model/src/main/java/com/yahoo/vespa/model/content/storagecluster/FileStorProducer.java
index d7f6fb6c581..1f3a76b766e 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/content/storagecluster/FileStorProducer.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/content/storagecluster/FileStorProducer.java
@@ -46,6 +46,7 @@ public class FileStorProducer implements StorFilestorConfig.Producer {
private final ContentCluster cluster;
private final int reponseNumThreads;
private final StorFilestorConfig.Response_sequencer_type.Enum responseSequencerType;
+ private final StorFilestorConfig.Async_operation_throttler_type.Enum asyncOperationThrottlerType;
private final boolean useAsyncMessageHandlingOnSchedule;
private final boolean asyncApplyBucketDiff;
@@ -57,11 +58,20 @@ public class FileStorProducer implements StorFilestorConfig.Producer {
}
}
+ private static StorFilestorConfig.Async_operation_throttler_type.Enum toAsyncOperationThrottlerType(String throttlerType) {
+ try {
+ return StorFilestorConfig.Async_operation_throttler_type.Enum.valueOf(throttlerType);
+ } catch (Throwable t) {
+ return StorFilestorConfig.Async_operation_throttler_type.UNLIMITED;
+ }
+ }
+
public FileStorProducer(ModelContext.FeatureFlags featureFlags, ContentCluster parent, Integer numThreads) {
this.numThreads = numThreads;
this.cluster = parent;
this.reponseNumThreads = featureFlags.defaultNumResponseThreads();
this.responseSequencerType = convertResponseSequencerType(featureFlags.responseSequencerType());
+ this.asyncOperationThrottlerType = toAsyncOperationThrottlerType(featureFlags.persistenceAsyncThrottling());
useAsyncMessageHandlingOnSchedule = featureFlags.useAsyncMessageHandlingOnSchedule();
asyncApplyBucketDiff = featureFlags.asyncApplyBucketDiff();
}
@@ -76,6 +86,7 @@ public class FileStorProducer implements StorFilestorConfig.Producer {
builder.response_sequencer_type(responseSequencerType);
builder.use_async_message_handling_on_schedule(useAsyncMessageHandlingOnSchedule);
builder.async_apply_bucket_diff(asyncApplyBucketDiff);
+ builder.async_operation_throttler_type(asyncOperationThrottlerType);
}
}
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/StorageClusterTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/StorageClusterTest.java
index 739f8b7fff2..740193feeff 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/content/StorageClusterTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/content/StorageClusterTest.java
@@ -306,6 +306,25 @@ public class StorageClusterTest {
}
@Test
+ public void persistence_async_throttle_config_defaults_to_unlimited() {
+ var config = filestorConfigFromProducer(simpleCluster(new TestProperties()));
+ assertEquals(StorFilestorConfig.Async_operation_throttler_type.UNLIMITED, config.async_operation_throttler_type());
+ }
+
+ @Test
+ public void persistence_async_throttle_config_is_derived_from_flag() {
+ var config = filestorConfigFromProducer(simpleCluster(new TestProperties().setPersistenceAsyncThrottling("UNLIMITED")));
+ assertEquals(StorFilestorConfig.Async_operation_throttler_type.UNLIMITED, config.async_operation_throttler_type());
+
+ config = filestorConfigFromProducer(simpleCluster(new TestProperties().setPersistenceAsyncThrottling("DYNAMIC")));
+ assertEquals(StorFilestorConfig.Async_operation_throttler_type.DYNAMIC, config.async_operation_throttler_type());
+
+ // Invalid enum values fall back to the default
+ config = filestorConfigFromProducer(simpleCluster(new TestProperties().setPersistenceAsyncThrottling("BANANAS")));
+ assertEquals(StorFilestorConfig.Async_operation_throttler_type.UNLIMITED, config.async_operation_throttler_type());
+ }
+
+ @Test
public void integrity_checker_explicitly_disabled_when_not_running_with_vds_provider() {
StorIntegritycheckerConfig.Builder builder = new StorIntegritycheckerConfig.Builder();
parse(cluster("bees", "")).getConfig(builder);