Skip to content

Commit

Permalink
Merge pull request #33301 from vespa-engine/hmusum/stop-using-feature…
Browse files Browse the repository at this point in the history
…-flag-9

Stop using feature flag LOAD_CODE_AS_HUGEPAGES
  • Loading branch information
hmusum authored Feb 12, 2025
2 parents b30a68e + 66b66f2 commit 471e8fa
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ interface FeatureFlags {
@ModelFeatureFlag(owners = {"baldersheim"}) default double feedNiceness() { return 0.0; }
@ModelFeatureFlag(owners = {"baldersheim"}) default int maxUnCommittedMemory() { return 130000; }
@ModelFeatureFlag(owners = {"baldersheim"}, removeAfter = "8.477") default boolean sharedStringRepoNoReclaim() { return false; }
@ModelFeatureFlag(owners = {"baldersheim"}) default boolean loadCodeAsHugePages() { return false; }
@ModelFeatureFlag(owners = {"baldersheim"}, removeAfter = "8.479") default boolean loadCodeAsHugePages() { return false; }
@ModelFeatureFlag(owners = {"baldersheim"}) default boolean containerDumpHeapOnShutdownTimeout() { throw new UnsupportedOperationException("TODO specify default value"); }
@ModelFeatureFlag(owners = {"baldersheim"}, removeAfter = "8.478") default double containerShutdownTimeout() { return 50.0; }
@ModelFeatureFlag(owners = {"baldersheim"}) default int heapSizePercentage() { return 0; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ public class TestProperties implements ModelContext.Properties, ModelContext.Fea
private int maxCompactBuffers = 1;
private boolean useV8GeoPositions = true;
private List<String> environmentVariables = List.of();
private boolean loadCodeAsHugePages = false;
private int mbus_java_num_targets = 2;
private int mbus_java_events_before_wakeup = 1;
private int mbus_cpp_num_targets = 2;
Expand Down Expand Up @@ -118,7 +117,6 @@ public class TestProperties implements ModelContext.Properties, ModelContext.Fea
@Override public int maxCompactBuffers() { return maxCompactBuffers; }
@Override public boolean useV8GeoPositions() { return useV8GeoPositions; }
@Override public List<String> environmentVariables() { return environmentVariables; }
@Override public boolean loadCodeAsHugePages() { return loadCodeAsHugePages; }
@Override public int mbusNetworkThreads() { return mbus_network_threads; }
@Override public int mbusJavaRpcNumTargets() { return mbus_java_num_targets; }
@Override public int mbusJavaEventsBeforeWakeup() { return mbus_java_events_before_wakeup; }
Expand All @@ -137,11 +135,6 @@ public class TestProperties implements ModelContext.Properties, ModelContext.Fea
@Override public boolean symmetricPutAndActivateReplicaSelection() { return symmetricPutAndActivateReplicaSelection; }
@Override public boolean enforceStrictlyIncreasingClusterStateVersions() { return enforceStrictlyIncreasingClusterStateVersions; }

public TestProperties loadCodeAsHugePages(boolean loadCodeAsHugePages) {
this.loadCodeAsHugePages = loadCodeAsHugePages;
return this;
}

public TestProperties maxUnCommittedMemory(int maxUnCommittedMemory) {
this.maxUnCommittedMemory = maxUnCommittedMemory;
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ public void addSearchNode(DeployState deployState, ContentNode node, StorageGrou
if (element == null) {
searchNode = SearchNode.create(parent, "" + node.getDistributionKey(), node.getDistributionKey(), spec,
clusterName, node, flushOnShutdown, tuning, deployState.isHosted(),
fractionOfMemoryReserved, deployState.featureFlags(), syncTransactionLog);
fractionOfMemoryReserved, syncTransactionLog);
searchNode.setHostResource(node.getHostResource());
searchNode.initService(deployState);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
package com.yahoo.vespa.model.search;

import com.yahoo.cloud.config.filedistribution.FiledistributorrpcConfig;
import com.yahoo.config.model.api.ModelContext;
import com.yahoo.config.model.deploy.DeployState;
import com.yahoo.config.model.producer.AnyConfigProducer;
import com.yahoo.config.model.producer.TreeConfigProducer;
Expand Down Expand Up @@ -98,21 +97,17 @@ protected SearchNode doBuild(DeployState deployState, TreeConfigProducer<AnyConf
Element producerSpec) {
return SearchNode.create(ancestor, name, contentNode.getDistributionKey(), nodeSpec, clusterName,
contentNode, flushOnShutdown, tuning, deployState.isHosted(),
fractionOfMemoryReserved, deployState.featureFlags(), syncTransactionLog);
fractionOfMemoryReserved, syncTransactionLog);
}

}

public static SearchNode create(TreeConfigProducer<?> parent, String name, int distributionKey, NodeSpec nodeSpec,
String clusterName, AbstractService serviceLayerService, boolean flushOnShutdown,
Tuning tuning, boolean isHostedVespa, double fractionOfMemoryReserved,
ModelContext.FeatureFlags featureFlags, Boolean syncTransactionLog) {
SearchNode node = new SearchNode(parent, name, distributionKey, nodeSpec, clusterName, serviceLayerService,
flushOnShutdown, tuning, isHostedVespa, fractionOfMemoryReserved, syncTransactionLog);
if (featureFlags.loadCodeAsHugePages()) {
node.addEnvironmentVariable("VESPA_LOAD_CODE_AS_HUGEPAGES", true);
}
return node;
Boolean syncTransactionLog) {
return new SearchNode(parent, name, distributionKey, nodeSpec, clusterName, serviceLayerService,
flushOnShutdown, tuning, isHostedVespa, fractionOfMemoryReserved, syncTransactionLog);
}

private SearchNode(TreeConfigProducer<?> parent, String name, int distributionKey, NodeSpec nodeSpec,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,13 @@ private void prepare(MockRoot root, SearchNode node) {

private static SearchNode createSearchNode(MockRoot root, String name, int distributionKey, NodeSpec nodeSpec,
boolean flushOnShutDown, boolean isHosted,
ModelContext.FeatureFlags featureFlags,
Boolean syncTransactionLog) {
return SearchNode.create(root, name, distributionKey, nodeSpec, "mycluster", null, flushOnShutDown,
null, isHosted, 0.0, featureFlags, syncTransactionLog);
null, isHosted, 0.0, syncTransactionLog);
}

private static SearchNode createSearchNode(MockRoot root, Boolean syncTransactionLog) {
return createSearchNode(root, "mynode", 3, new NodeSpec(7, 5), true, true, new TestProperties(), syncTransactionLog);
return createSearchNode(root, "mynode", 3, new NodeSpec(7, 5), true, true, syncTransactionLog);
}

@Test
Expand All @@ -61,7 +60,7 @@ void requireThatSyncIsHonoured() {
void requireThatBasedirIsCorrectForElasticMode() {
MockRoot root = new MockRoot("");
SearchNode node = createSearchNode(root, "mynode", 3, new NodeSpec(7, 5), false,
root.getDeployState().isHosted(), new TestProperties(), true);
root.getDeployState().isHosted(), true);
prepare(root, node);
assertBaseDir(Defaults.getDefaults().underVespaHome("var/db/vespa/search/cluster.mycluster/n3"), node);
}
Expand All @@ -70,7 +69,7 @@ void requireThatBasedirIsCorrectForElasticMode() {
void requireThatPreShutdownCommandIsEmptyWhenNotActivated() {
MockRoot root = new MockRoot("");
SearchNode node = createSearchNode(root, "mynode", 3, new NodeSpec(7, 5), false,
root.getDeployState().isHosted(), new TestProperties(), true);
root.getDeployState().isHosted(), true);
node.setHostResource(new HostResource(new Host(node, "mynbode")));
node.initService(root.getDeployState());
assertFalse(node.getPreShutdownCommand().isPresent());
Expand All @@ -80,28 +79,13 @@ void requireThatPreShutdownCommandIsEmptyWhenNotActivated() {
void requireThatPreShutdownCommandUsesPrepareRestartWhenActivated() {
MockRoot root = new MockRoot("");
SearchNode node = createSearchNode(root, "mynode2", 4, new NodeSpec(7, 5), true,
root.getDeployState().isHosted(), new TestProperties(), true);
root.getDeployState().isHosted(), true);
node.setHostResource(new HostResource(new Host(node, "mynbode2")));
node.initService(root.getDeployState());
assertTrue(node.getPreShutdownCommand().isPresent());
assertTrue(node.getPreShutdownCommand().get().contains("vespa-proton-cmd " + node.getRpcPort() + " prepareRestart"));
}

private void verifyCodePlacement(boolean hugePages) {
MockRoot root = new MockRoot("");
SearchNode node = createSearchNode(root, "mynode2", 4, new NodeSpec(7, 5), true, false,
new TestProperties().loadCodeAsHugePages(hugePages), true);
node.setHostResource(new HostResource(new Host(node, "mynbode2")));
node.initService(root.getDeployState());
assertEquals(hugePages, node.getEnvVars().get("VESPA_LOAD_CODE_AS_HUGEPAGES") != null);
}

@Test
void requireThatCodePageTypeCanBeControlled() {
verifyCodePlacement(true);
verifyCodePlacement(false);
}

private MockRoot createRoot(ModelContext.Properties properties) {
return new MockRoot("", new DeployState.Builder().properties(properties).build());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ public static class FeatureFlags implements ModelContext.FeatureFlags {
private final double resourceLimitMemory;
private final double minNodeRatioPerGroup;
private final boolean containerDumpHeapOnShutdownTimeout;
private final boolean loadCodeAsHugePages;
private final int maxUnCommittedMemory;
private final boolean forwardIssuesAsErrors;
private final boolean useV8GeoPositions;
Expand Down Expand Up @@ -224,7 +223,6 @@ public FeatureFlags(FlagSource source, ApplicationId appId, Version version) {
this.resourceLimitMemory = PermanentFlags.RESOURCE_LIMIT_MEMORY.bindTo(source).with(appId).with(version).value();
this.minNodeRatioPerGroup = Flags.MIN_NODE_RATIO_PER_GROUP.bindTo(source).with(appId).with(version).value();
this.containerDumpHeapOnShutdownTimeout = Flags.CONTAINER_DUMP_HEAP_ON_SHUTDOWN_TIMEOUT.bindTo(source).with(appId).with(version).value();
this.loadCodeAsHugePages = Flags.LOAD_CODE_AS_HUGEPAGES.bindTo(source).with(appId).with(version).value();
this.maxUnCommittedMemory = Flags.MAX_UNCOMMITTED_MEMORY.bindTo(source).with(appId).with(version).value();
this.forwardIssuesAsErrors = PermanentFlags.FORWARD_ISSUES_AS_ERRORS.bindTo(source).with(appId).with(version).value();
this.useV8GeoPositions = Flags.USE_V8_GEO_POSITIONS.bindTo(source).with(appId).with(version).value();
Expand Down Expand Up @@ -274,7 +272,6 @@ public FeatureFlags(FlagSource source, ApplicationId appId, Version version) {
@Override public double resourceLimitMemory() { return resourceLimitMemory; }
@Override public double minNodeRatioPerGroup() { return minNodeRatioPerGroup; }
@Override public boolean containerDumpHeapOnShutdownTimeout() { return containerDumpHeapOnShutdownTimeout; }
@Override public boolean loadCodeAsHugePages() { return loadCodeAsHugePages; }
@Override public int maxUnCommittedMemory() { return maxUnCommittedMemory; }
@Override public boolean forwardIssuesAsErrors() { return forwardIssuesAsErrors; }
@Override public boolean useV8GeoPositions() { return useV8GeoPositions; }
Expand Down
7 changes: 0 additions & 7 deletions flags/src/main/java/com/yahoo/vespa/flags/Flags.java
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,6 @@ public class Flags {
"Takes effect at redeployment",
INSTANCE_ID);

public static final UnboundBooleanFlag LOAD_CODE_AS_HUGEPAGES = defineFeatureFlag(
"load-code-as-hugepages", false,
List.of("baldersheim"), "2022-05-13", "2025-03-01",
"Will try to map the code segment with huge (2M) pages",
"Takes effect at redeployment",
INSTANCE_ID);

public static final UnboundIntFlag MAX_ACTIVATION_INHIBITED_OUT_OF_SYNC_GROUPS = defineIntFlag(
"max-activation-inhibited-out-of-sync-groups", 0,
List.of("vekterli"), "2021-02-19", "2025-06-01",
Expand Down

0 comments on commit 471e8fa

Please sign in to comment.