aboutsummaryrefslogtreecommitdiffstats
path: root/config-model
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2020-07-06 09:45:27 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2020-07-06 09:45:27 +0000
commita1e9de08322c03f79191d84df1586eac45c8d6b5 (patch)
tree5e69f8acde7b54f1ad06b5743352dda736f9d050 /config-model
parente1a5f32ee4e4273e42720a910b6ad0e928d5854b (diff)
Add feature flag control of response sequencer.
Diffstat (limited to 'config-model')
-rw-r--r--config-model/src/main/java/com/yahoo/config/model/deploy/TestProperties.java23
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/content/storagecluster/FileStorProducer.java21
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/content/storagecluster/StorageCluster.java2
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/content/StorageClusterTest.java29
4 files changed, 64 insertions, 11 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 a31574eea10..9708207b11f 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
@@ -30,12 +30,9 @@ public class TestProperties implements ModelContext.Properties {
private boolean multitenant = false;
private ApplicationId applicationId = ApplicationId.defaultId();
private List<ConfigServerSpec> configServerSpecs = Collections.emptyList();
- private HostName loadBalancerName = null;
- private URI ztsUrl = null;
- private String athenzDnsSuffix = null;
private boolean hostedVespa = false;
private Zone zone;
- private Set<ContainerEndpoint> endpoints = Collections.emptySet();
+ private final Set<ContainerEndpoint> endpoints = Collections.emptySet();
private boolean useDedicatedNodeForLogserver = false;
private boolean useContentNodeBtreeDb = false;
private boolean useThreePhaseUpdates = false;
@@ -44,6 +41,8 @@ public class TestProperties implements ModelContext.Properties {
private double queueSizeFactor = 0.0;
private String jvmGCOptions = null;
private String sequencerType = "LATENCY";
+ private String responseSequencerType = "ADAPTIVE";
+ private int reponseNumThreads = 2;
private Optional<EndpointCertificateSecrets> endpointCertificateSecrets = Optional.empty();
private AthenzDomain athenzDomain;
private ApplicationRoles applicationRoles;
@@ -51,9 +50,9 @@ public class TestProperties implements ModelContext.Properties {
@Override public boolean multitenant() { return multitenant; }
@Override public ApplicationId applicationId() { return applicationId; }
@Override public List<ConfigServerSpec> configServerSpecs() { return configServerSpecs; }
- @Override public HostName loadBalancerName() { return loadBalancerName; }
- @Override public URI ztsUrl() { return ztsUrl; }
- @Override public String athenzDnsSuffix() { return athenzDnsSuffix; }
+ @Override public HostName loadBalancerName() { return null; }
+ @Override public URI ztsUrl() { return null; }
+ @Override public String athenzDnsSuffix() { return null; }
@Override public boolean hostedVespa() { return hostedVespa; }
@Override public Zone zone() { return zone; }
@Override public Set<ContainerEndpoint> endpoints() { return endpoints; }
@@ -74,6 +73,8 @@ public class TestProperties implements ModelContext.Properties {
@Override public boolean useThreePhaseUpdates() { return useThreePhaseUpdates; }
@Override public Optional<AthenzDomain> athenzDomain() { return Optional.ofNullable(athenzDomain); }
@Override public Optional<ApplicationRoles> applicationRoles() { return Optional.ofNullable(applicationRoles); }
+ @Override public String responseSequencerType() { return responseSequencerType; }
+ @Override public int defaultNumResponseThreads() { return reponseNumThreads; }
public TestProperties setJvmGCOptions(String gcOptions) {
jvmGCOptions = gcOptions;
@@ -83,6 +84,14 @@ public class TestProperties implements ModelContext.Properties {
sequencerType = type;
return this;
}
+ public TestProperties setResponseSequencerType(String type) {
+ responseSequencerType = type;
+ return this;
+ }
+ public TestProperties setResponseNumThreads(int numThreads) {
+ reponseNumThreads = numThreads;
+ return this;
+ }
public TestProperties setDefaultTermwiseLimit(double limit) {
defaultTermwiseLimit = limit;
return this;
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 eaefa8ea35f..2e1a6662488 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
@@ -1,7 +1,9 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.model.content.storagecluster;
+import com.yahoo.config.model.api.ModelContext;
import com.yahoo.vespa.config.content.StorFilestorConfig;
+import com.yahoo.vespa.config.search.core.ProtonConfig;
import com.yahoo.vespa.model.builder.xml.dom.ModelElement;
import com.yahoo.vespa.model.content.cluster.ContentCluster;
@@ -11,8 +13,8 @@ import com.yahoo.vespa.model.content.cluster.ContentCluster;
public class FileStorProducer implements StorFilestorConfig.Producer {
public static class Builder {
- protected FileStorProducer build(ContentCluster parent, ModelElement clusterElem) {
- return new FileStorProducer(parent, getThreads(clusterElem));
+ protected FileStorProducer build(ModelContext.Properties properties, ContentCluster parent, ModelElement clusterElem) {
+ return new FileStorProducer(properties, parent, getThreads(clusterElem));
}
private Integer getThreads(ModelElement clusterElem) {
@@ -43,10 +45,21 @@ public class FileStorProducer implements StorFilestorConfig.Producer {
private final Integer numThreads;
private final ContentCluster cluster;
+ private final int reponseNumThreads;
+ private final StorFilestorConfig.Response_sequencer_type.Enum responseSequencerType;
- public FileStorProducer(ContentCluster parent, Integer numThreads) {
+ private static StorFilestorConfig.Response_sequencer_type.Enum convertResponseSequencerType(String sequencerType) {
+ try {
+ return StorFilestorConfig.Response_sequencer_type.Enum.valueOf(sequencerType);
+ } catch (Throwable t) {
+ return StorFilestorConfig.Response_sequencer_type.Enum.ADAPTIVE;
+ }
+ }
+ public FileStorProducer(ModelContext.Properties properties, ContentCluster parent, Integer numThreads) {
this.numThreads = numThreads;
this.cluster = parent;
+ this.reponseNumThreads = properties.defaultNumResponseThreads();
+ this.responseSequencerType = convertResponseSequencerType(properties.responseSequencerType());
}
@Override
@@ -55,6 +68,8 @@ public class FileStorProducer implements StorFilestorConfig.Producer {
builder.num_threads(numThreads);
}
builder.enable_multibit_split_optimalization(cluster.getPersistence().enableMultiLevelSplitting());
+ builder.num_response_threads(reponseNumThreads);
+ builder.response_sequencer_type(responseSequencerType);
}
}
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/content/storagecluster/StorageCluster.java b/config-model/src/main/java/com/yahoo/vespa/model/content/storagecluster/StorageCluster.java
index 0a8abfbd3ad..981ce1bc004 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/content/storagecluster/StorageCluster.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/content/storagecluster/StorageCluster.java
@@ -37,7 +37,7 @@ public class StorageCluster extends AbstractConfigProducer<StorageNode>
return new StorageCluster(ancestor,
ContentCluster.getClusterId(clusterElem),
- new FileStorProducer.Builder().build(cluster, clusterElem),
+ new FileStorProducer.Builder().build(deployState.getProperties(), cluster, clusterElem),
new IntegrityCheckerProducer.Builder().build(cluster, clusterElem),
new StorServerProducer.Builder().build(clusterElem, useContentNodeBtreeDb),
new StorVisitorProducer.Builder().build(clusterElem),
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 e4a02180f0e..660c4c3abad 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
@@ -1,7 +1,9 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.model.content;
+import com.yahoo.config.model.api.ModelContext;
import com.yahoo.config.model.deploy.DeployState;
+import com.yahoo.config.model.deploy.TestProperties;
import com.yahoo.config.model.provision.SingleNodeProvisioner;
import com.yahoo.config.model.test.MockApplicationPackage;
import com.yahoo.config.provision.Flavor;
@@ -34,6 +36,13 @@ public class StorageClusterTest {
.modelHostProvisioner(new SingleNodeProvisioner(flavor)).build());
return parse(xml, root);
}
+ StorageCluster parse(String xml, Flavor flavor, ModelContext.Properties properties) {
+ MockRoot root = new MockRoot("", new DeployState.Builder()
+ .applicationPackage(new MockApplicationPackage.Builder().build())
+ .modelHostProvisioner(new SingleNodeProvisioner(flavor))
+ .properties(properties).build());
+ return parse(xml, root);
+ }
StorageCluster parse(String xml) {
MockRoot root = new MockRoot();
@@ -181,6 +190,7 @@ public class StorageClusterTest {
stc.getConfig(builder);
StorFilestorConfig config = new StorFilestorConfig(builder);
assertEquals(2, config.num_response_threads());
+ assertEquals(StorFilestorConfig.Response_sequencer_type.ADAPTIVE, config.response_sequencer_type());
assertEquals(7, config.num_threads());
}
@@ -253,6 +263,25 @@ public class StorageClusterTest {
}
@Test
+ public void testFeatureFlagControlOfResponseSequencer() {
+ StorageCluster stc = parse(
+ "<cluster id=\"bees\">\n" +
+ " <documents/>" +
+ " <group>" +
+ " <node distribution-key=\"0\" hostalias=\"mockhost\"/>" +
+ " </group>" +
+ "</cluster>",
+ new Flavor(new FlavorsConfig.Flavor.Builder().name("test-flavor").minCpuCores(9).build()),
+ new TestProperties().setResponseNumThreads(13).setResponseSequencerType("THROUGHPUT")
+ );
+ StorFilestorConfig.Builder builder = new StorFilestorConfig.Builder();
+ stc.getConfig(builder);
+ StorFilestorConfig config = new StorFilestorConfig(builder);
+ assertEquals(13, config.num_response_threads());
+ assertEquals(StorFilestorConfig.Response_sequencer_type.THROUGHPUT, config.response_sequencer_type());
+ }
+
+ @Test
public void integrity_checker_explicitly_disabled_when_not_running_with_vds_provider() {
StorIntegritycheckerConfig.Builder builder = new StorIntegritycheckerConfig.Builder();
parse(