aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Musum <musum@verizonmedia.com>2021-06-21 11:53:15 +0200
committerHarald Musum <musum@verizonmedia.com>2021-06-21 11:53:15 +0200
commit8943580a6167fda820e64a283966ed81101bf9fc (patch)
treea1f89fab4494c85c40dd9861ef6a07fdeef85650
parentca77b10e381a5a70fe0042b8c88bdf16b3b219f3 (diff)
Refactor creation of config request
-rw-r--r--config/src/main/java/com/yahoo/vespa/config/benchmark/LoadTester.java22
1 files changed, 13 insertions, 9 deletions
diff --git a/config/src/main/java/com/yahoo/vespa/config/benchmark/LoadTester.java b/config/src/main/java/com/yahoo/vespa/config/benchmark/LoadTester.java
index 02d89acbf73..26c5889c579 100644
--- a/config/src/main/java/com/yahoo/vespa/config/benchmark/LoadTester.java
+++ b/config/src/main/java/com/yahoo/vespa/config/benchmark/LoadTester.java
@@ -233,14 +233,14 @@ public class LoadTester {
int numberOfConfigs = configs.size();
for (int i = 0; i < iterations; i++) {
ConfigKey<?> reqKey = configs.get(ThreadLocalRandom.current().nextInt(numberOfConfigs));
- ConfigDefinitionKey dKey = new ConfigDefinitionKey(reqKey);
- Tuple2<String, String[]> defContent = defs.get(dKey);
- ConfigKey<?> configKey = createFull(reqKey.getName(), reqKey.getConfigId(), reqKey.getNamespace(), defContent.first);
- JRTClientConfigRequest request = createRequest(configKey, defContent.second);
- if (debug) System.out.println("# Requesting: " + reqKey);
+ JRTClientConfigRequest request = createRequest(reqKey);
+ if (debug)
+ System.out.println("# Requesting: " + reqKey);
+
long start = System.nanoTime();
target.invokeSync(request.getRequest(), 10.0);
long durationInMillis = (System.nanoTime() - start) / 1_000_000;
+
if (request.isError()) {
target = handleError(request, spec, target);
} else {
@@ -249,11 +249,15 @@ public class LoadTester {
}
}
- private JRTClientConfigRequest createRequest(ConfigKey<?> reqKey, String[] defContent) {
- if (defContent == null) defContent = new String[0];
+ private JRTClientConfigRequest createRequest(ConfigKey<?> reqKey) {
+ ConfigDefinitionKey dKey = new ConfigDefinitionKey(reqKey);
+ Tuple2<String, String[]> defContent = defs.get(dKey);
+ ConfigKey<?> fullKey = createFull(reqKey.getName(), reqKey.getConfigId(), reqKey.getNamespace(), defContent.first);
+
final long serverTimeout = 1000;
- return JRTClientConfigRequestV3.createWithParams(reqKey, DefContent.fromList(Arrays.asList(defContent)),
- ConfigUtils.getCanonicalHostName(), "", 0, serverTimeout, Trace.createDummy(),
+ return JRTClientConfigRequestV3.createWithParams(fullKey, DefContent.fromList(List.of(defContent.second)),
+ ConfigUtils.getCanonicalHostName(), "",
+ 0, serverTimeout, Trace.createDummy(),
compressionType, Optional.empty());
}