diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2023-03-30 09:30:49 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2023-03-30 10:23:38 +0200 |
commit | e7d6baa6981edceff032b2d685d70b76c476828e (patch) | |
tree | 0a2bb7fc25591f3b62cddccbc7afb4ca9a51aa9e | |
parent | 904eac185da61419c9c7e244835c1704c318c134 (diff) |
Propagate the configured slime decode type into the rpc summary handling.
9 files changed, 82 insertions, 14 deletions
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 21797f0f469..fef2354c452 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 @@ -72,7 +72,7 @@ public interface ModelContext { * - Remove all flag data files from hosted-feature-flag repository */ interface FeatureFlags { - @ModelFeatureFlag(owners = {"baldersheim"}, comment = "Revisit in May or June 2021") default double defaultTermwiseLimit() { throw new UnsupportedOperationException("TODO specify default value"); } + @ModelFeatureFlag(owners = {"baldersheim"}, comment = "Revisit in May or June 2023") default double defaultTermwiseLimit() { throw new UnsupportedOperationException("TODO specify default value"); } @ModelFeatureFlag(owners = {"baldersheim"}, comment = "Select sequencer type use while feeding") default String feedSequencerType() { return "THROUGHPUT"; } @ModelFeatureFlag(owners = {"baldersheim"}) default String responseSequencerType() { throw new UnsupportedOperationException("TODO specify default value"); } @ModelFeatureFlag(owners = {"baldersheim"}) default String queryDispatchPolicy() { return "adaptive"; } @@ -112,6 +112,7 @@ public interface ModelContext { @ModelFeatureFlag(owners = {"arnej","baldersheim"}, removeAfter = "8.110") default boolean useOldJdiscContainerStartup() { return false; } @ModelFeatureFlag(owners = {"tokle, bjorncs"}, removeAfter = "8.108") default boolean enableDataPlaneFilter() { return true; } @ModelFeatureFlag(owners = {"arnej, bjorncs"}) default boolean enableGlobalPhase() { return true; } + @ModelFeatureFlag(owners = {"baldersheim"}, comment = "Select summary decode type") default String summaryDecodePolicy() { return "eager"; } //Below are all flags that must be kept until 7 is out of the door @ModelFeatureFlag(owners = {"arnej"}, removeAfter="7.last") default boolean ignoreThreadStackSizes() { return false; } 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 ecbb990f096..c72aa23a836 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 @@ -43,6 +43,7 @@ public class TestProperties implements ModelContext.Properties, ModelContext.Fea private double defaultTermwiseLimit = 1.0; private String jvmGCOptions = null; private String queryDispatchPolicy = "adaptive"; + private String summaryDecodePolicy = "eager"; private String sequencerType = "THROUGHPUT"; private boolean firstTimeDeployment = false; private String responseSequencerType = "ADAPTIVE"; @@ -134,6 +135,7 @@ public class TestProperties implements ModelContext.Properties, ModelContext.Fea @Override public int heapSizePercentage() { return heapSizePercentage; } @Override public int rpcEventsBeforeWakeup() { return rpc_events_before_wakeup; } @Override public String queryDispatchPolicy() { return queryDispatchPolicy; } + @Override public String summaryDecodePolicy() { return summaryDecodePolicy; } @Override public boolean useRestrictedDataPlaneBindings() { return useRestrictedDataPlaneBindings; } @Override public Optional<CloudAccount> cloudAccount() { return cloudAccount; } @Override public boolean allowUserFilters() { return allowUserFilters; } @@ -191,6 +193,10 @@ public class TestProperties implements ModelContext.Properties, ModelContext.Fea queryDispatchPolicy = policy; return this; } + public TestProperties setSummaryDecodePolicy(String type) { + summaryDecodePolicy = type; + return this; + } public TestProperties setFeedSequencerType(String type) { sequencerType = type; return this; diff --git a/config-model/src/main/java/com/yahoo/vespa/model/search/IndexedSearchCluster.java b/config-model/src/main/java/com/yahoo/vespa/model/search/IndexedSearchCluster.java index 4ed8c5ab2e8..670460a9f9f 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/search/IndexedSearchCluster.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/search/IndexedSearchCluster.java @@ -64,6 +64,7 @@ public class IndexedSearchCluster extends SearchCluster private final List<SearchNode> searchNodes = new ArrayList<>(); private final DispatchTuning.DispatchPolicy defaultDispatchPolicy; private final double dispatchWarmup; + private final String summaryDecodePolicy; /** * Returns the document selector that is able to resolve what documents are to be routed to this search cluster. * This string uses the document selector language as defined in the "document" module. @@ -80,6 +81,7 @@ public class IndexedSearchCluster extends SearchCluster rootDispatch = new DispatchGroup(this); defaultDispatchPolicy = DispatchTuning.Builder.toDispatchPolicy(featureFlags.queryDispatchPolicy()); dispatchWarmup = featureFlags.queryDispatchWarmup(); + summaryDecodePolicy = featureFlags.summaryDecodePolicy(); } @Override @@ -337,6 +339,15 @@ public class IndexedSearchCluster extends SearchCluster builder.maxWaitAfterCoverageFactor(searchCoverage.getMaxWaitAfterCoverageFactor()); } builder.warmuptime(dispatchWarmup); + builder.summaryDecodePolicy(toSummaryDecoding(summaryDecodePolicy)); + } + + private DispatchConfig.SummaryDecodePolicy.Enum toSummaryDecoding(String summaryDecodeType) { + return switch (summaryDecodeType.toLowerCase()) { + case "eager" -> DispatchConfig.SummaryDecodePolicy.EAGER; + case "ondemand","on-demand" -> DispatchConfig.SummaryDecodePolicy.Enum.ONDEMAND; + default -> DispatchConfig.SummaryDecodePolicy.Enum.EAGER; + }; } @Override diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/ContentClusterTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/ContentClusterTest.java index b2175014cd4..488ad9f8484 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/content/ContentClusterTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/content/ContentClusterTest.java @@ -1099,6 +1099,30 @@ public class ContentClusterTest extends ContentBaseTest { } } + private void verifySummaryDecodeType(String policy, DispatchConfig.SummaryDecodePolicy.Enum expected) { + TestProperties properties = new TestProperties(); + if (policy != null) { + properties.setSummaryDecodePolicy(policy); + } + VespaModel model = createEnd2EndOneNode(properties); + + ContentCluster cc = model.getContentClusters().get("storage"); + DispatchConfig.Builder builder = new DispatchConfig.Builder(); + cc.getSearch().getConfig(builder); + + DispatchConfig cfg = new DispatchConfig(builder); + assertEquals(expected, cfg.summaryDecodePolicy()); + } + + @Test + public void verify_summary_decoding_controlled_by_properties() { + verifySummaryDecodeType(null, DispatchConfig.SummaryDecodePolicy.EAGER); + verifySummaryDecodeType("illegal-config", DispatchConfig.SummaryDecodePolicy.EAGER); + verifySummaryDecodeType("eager", DispatchConfig.SummaryDecodePolicy.EAGER); + verifySummaryDecodeType("ondemand", DispatchConfig.SummaryDecodePolicy.ONDEMAND); + verifySummaryDecodeType("on-demand", DispatchConfig.SummaryDecodePolicy.ONDEMAND); + } + private int resolveMaxCompactBuffers(OptionalInt maxCompactBuffers) { TestProperties testProperties = new TestProperties(); if (maxCompactBuffers.isPresent()) { diff --git a/configdefinitions/src/vespa/dispatch.def b/configdefinitions/src/vespa/dispatch.def index 936b1400053..01fc5d48dfa 100644 --- a/configdefinitions/src/vespa/dispatch.def +++ b/configdefinitions/src/vespa/dispatch.def @@ -3,11 +3,11 @@ namespace=vespa.config.search -# The active docs a group must have as a % of the average active docs of all other groups, -# for that group to be included in queries +## The active docs a group must have as a % of the average active docs of all other groups, +## for that group to be included in queries minActivedocsPercentage double default=97.0 -# Distribution policy for group selection +## Distribution policy for group selection distributionPolicy enum { ROUNDROBIN, BEST_OF_RANDOM_2, LATENCY_AMORTIZED_OVER_REQUESTS, LATENCY_AMORTIZED_OVER_TIME, ADAPTIVE } default=ADAPTIVE ## Maximum number of hits that will be requested from a single node @@ -26,24 +26,28 @@ maxHitsPerNode int default=2147483647 ## a setting of 1.0. This is a significant optimisation with with very little loss in presicion. topKProbability double default=0.9999 -# Number of document replicas _per group_ that will be present in a stable cluster. -# Should always be >= searchableCopies. +## Number of document replicas _per group_ that will be present in a stable cluster. +## Should always be >= searchableCopies. redundancy long default=1 -# Minimum search coverage required before returning the results of a query +## Minimum search coverage required before returning the results of a query minSearchCoverage double default=100 -# Minimum wait time for full coverage after minimum coverage is achieved, factored based on time left at minimum coverage +## Minimum wait time for full coverage after minimum coverage is achieved, factored based on time left at minimum coverage minWaitAfterCoverageFactor double default=0 -# Maximum wait time for full coverage after minimum coverage is achieved, factored based on time left at minimum coverage +## Maximum wait time for full coverage after minimum coverage is achieved, factored based on time left at minimum coverage maxWaitAfterCoverageFactor double default=1 -# Number of JRT transport threads +## Number of JRT transport threads numJrtTransportThreads int default=8 -# Number of JRT connections per backend node +## Number of JRT connections per backend node numJrtConnectionsPerNode int default=8 -# Number of seconds to spend warming up code to prevent JIT cold start issues. +## Number of seconds to spend warming up code to prevent JIT cold start issues. warmuptime double default=0.1 + +## Specifies how summary data are decoded +## Eager will build java objects immediately, while ONDEMAND will do so when it is needed +summaryDecodePolicy enum {EAGER, ONDEMAND} default=EAGER 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 ad5423f0a94..7a2377594a1 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 @@ -203,6 +203,7 @@ public class ModelContextImpl implements ModelContext { private final boolean useRestrictedDataPlaneBindings; private final int heapPercentage; private final boolean enableGlobalPhase; + private final String summaryDecodePolicy; public FeatureFlags(FlagSource source, ApplicationId appId, Version version) { this.defaultTermwiseLimit = flagValue(source, appId, version, Flags.DEFAULT_TERM_WISE_LIMIT); @@ -248,11 +249,13 @@ public class ModelContextImpl implements ModelContext { this.useRestrictedDataPlaneBindings = flagValue(source, appId, version, Flags.RESTRICT_DATA_PLANE_BINDINGS); this.heapPercentage = flagValue(source, appId, version, PermanentFlags.HEAP_SIZE_PERCENTAGE); this.enableGlobalPhase = flagValue(source, appId, version, Flags.ENABLE_GLOBAL_PHASE); + this.summaryDecodePolicy = flagValue(source, appId, version, Flags.SUMMARY_DECODE_POLICY); } @Override public int heapSizePercentage() { return heapPercentage; } @Override public String queryDispatchPolicy() { return queryDispatchPolicy; } @Override public double queryDispatchWarmup() { return queryDispatchWarmup; } + @Override public String summaryDecodePolicy() { return summaryDecodePolicy; } @Override public double defaultTermwiseLimit() { return defaultTermwiseLimit; } @Override public String feedSequencerType() { return feedSequencer; } @Override public String responseSequencerType() { return responseSequencer; } diff --git a/container-search/src/main/java/com/yahoo/search/dispatch/rpc/RpcInvokerFactory.java b/container-search/src/main/java/com/yahoo/search/dispatch/rpc/RpcInvokerFactory.java index 4466b03a713..154002c4f77 100644 --- a/container-search/src/main/java/com/yahoo/search/dispatch/rpc/RpcInvokerFactory.java +++ b/container-search/src/main/java/com/yahoo/search/dispatch/rpc/RpcInvokerFactory.java @@ -20,11 +20,20 @@ public class RpcInvokerFactory extends InvokerFactory { private final RpcConnectionPool rpcResourcePool; private final CompressPayload compressor; + private final RpcProtobufFillInvoker.DecodePolicy decodeType; + + private static RpcProtobufFillInvoker.DecodePolicy convert(DispatchConfig.SummaryDecodePolicy.Enum decoding) { + return switch (decoding) { + case EAGER -> RpcProtobufFillInvoker.DecodePolicy.EAGER; + case ONDEMAND -> RpcProtobufFillInvoker.DecodePolicy.ONDEMAND; + }; + } public RpcInvokerFactory(RpcConnectionPool rpcResourcePool, SearchGroups cluster, DispatchConfig dispatchConfig) { super(cluster, dispatchConfig); this.rpcResourcePool = rpcResourcePool; this.compressor = new CompressService(); + decodeType = convert(dispatchConfig.summaryDecodePolicy()); } @Override @@ -37,6 +46,7 @@ public class RpcInvokerFactory extends InvokerFactory { Query query = result.getQuery(); boolean summaryNeedsQuery = searcher.summaryNeedsQuery(query); - return new RpcProtobufFillInvoker(rpcResourcePool, compressor, searcher.getDocumentDatabase(query), searcher.getServerId(), summaryNeedsQuery); + return new RpcProtobufFillInvoker(rpcResourcePool, compressor, searcher.getDocumentDatabase(query), + searcher.getServerId(), decodeType, summaryNeedsQuery); } } diff --git a/container-search/src/main/java/com/yahoo/search/dispatch/rpc/RpcProtobufFillInvoker.java b/container-search/src/main/java/com/yahoo/search/dispatch/rpc/RpcProtobufFillInvoker.java index 4e538fb54dc..8ffeecd71a8 100644 --- a/container-search/src/main/java/com/yahoo/search/dispatch/rpc/RpcProtobufFillInvoker.java +++ b/container-search/src/main/java/com/yahoo/search/dispatch/rpc/RpcProtobufFillInvoker.java @@ -42,6 +42,8 @@ public class RpcProtobufFillInvoker extends FillInvoker { private static final Logger log = Logger.getLogger(RpcProtobufFillInvoker.class.getName()); + enum DecodePolicy {EAGER, ONDEMAND} + private final DocumentDatabase documentDb; private final RpcConnectionPool resourcePool; private final boolean summaryNeedsQuery; @@ -56,7 +58,8 @@ public class RpcProtobufFillInvoker extends FillInvoker { /** The number of responses we should receive (and process) before this is complete */ private int outstandingResponses; - RpcProtobufFillInvoker(RpcConnectionPool resourcePool, CompressPayload compressor, DocumentDatabase documentDb, String serverId, boolean summaryNeedsQuery) { + RpcProtobufFillInvoker(RpcConnectionPool resourcePool, CompressPayload compressor, DocumentDatabase documentDb, + String serverId, DecodePolicy decodePolicy, boolean summaryNeedsQuery) { this.documentDb = documentDb; this.resourcePool = resourcePool; this.serverId = serverId; 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 76702d3791d..4ba5911dd30 100644 --- a/flags/src/main/java/com/yahoo/vespa/flags/Flags.java +++ b/flags/src/main/java/com/yahoo/vespa/flags/Flags.java @@ -79,6 +79,12 @@ public class Flags { " latency-amortized-over-requests, latency-amortized-over-time", "Takes effect at redeployment (requires restart)", ZONE_ID, APPLICATION_ID); + public static final UnboundStringFlag SUMMARY_DECODE_POLICY = defineStringFlag( + "summary-decode-policy", "eager", + List.of("baldersheim"), "2023-03-30", "2023-12-31", + "Select summary decoding policy, valid values are eager and on-demand/ondemand.", + "Takes effect at redeployment (requires restart)", + ZONE_ID, APPLICATION_ID); public static final UnboundStringFlag FEED_SEQUENCER_TYPE = defineStringFlag( "feed-sequencer-type", "THROUGHPUT", |