Skip to content
Snippets Groups Projects
Commit c40d8848 authored by Sören Henning's avatar Sören Henning
Browse files

Allow disabling DNS caching

parent afe0440f
No related branches found
No related tags found
No related merge requests found
Pipeline #6863 failed
......@@ -62,6 +62,7 @@ The prebuilt container images can be configured with the following environment v
| `PERIOD_MS` | The time in milliseconds between generating two messages for the same sensor. With our Theodolite benchmarks, we apply an [open workload model](https://www.usenix.org/legacy/event/nsdi06/tech/full_papers/schroeder/schroeder.pdf) in which new messages are generated at a fixed rate, without considering the think time of the target server nor the time required for generating a message. | 1000 |
| `VALUE` | The constant `valueInW` of an `ActivePowerRecord`. | 10 |
| `THREADS` | Number of worker threads used to generate the load. | 4 |
| `DISABLE_DNS_CACHING` | Set to `true` to disable DNS caching by the underlying JVM. You might want to do so when generating load via HTTP that should be sent to different target instances. | `false` |
Please note that there are some additional configuration options for benchmark [UC4's load generator](hhttps://github.com/cau-se/theodolite/blob/master/theodolite-benchmarks/uc4-load-generator/src/main/java/rocks/theodolite/benchmarks/uc4/loadgenerator/LoadGenerator.java).
......
......@@ -23,6 +23,8 @@ public final class ConfigurationKeys {
public static final String THREADS = "THREADS";
public static final String DISABLE_DNS_CACHING = "DISABLE_DNS_CACHING";
public static final String TARGET = "TARGET";
public static final String KAFKA_BOOTSTRAP_SERVERS = "KAFKA_BOOTSTRAP_SERVERS";
......@@ -45,6 +47,7 @@ public final class ConfigurationKeys {
public static final String PUBSUB_EMULATOR_HOST = "PUBSUB_EMULATOR_HOST";
private ConfigurationKeys() {}
}
......@@ -13,7 +13,17 @@ class EnvVarLoadGeneratorFactory {
private static final Logger LOGGER = LoggerFactory.getLogger(EnvVarLoadGeneratorFactory.class);
public static final boolean DISABLE_DNS_CACHING_DEFAULT = false;
public LoadGenerator create(final LoadGenerator loadGeneratorTemplate) {
final boolean disableDnsCaching = Boolean.parseBoolean(Objects.requireNonNullElse(
System.getenv(ConfigurationKeys.DISABLE_DNS_CACHING),
Boolean.toString(DISABLE_DNS_CACHING_DEFAULT)));
if (disableDnsCaching) {
this.disableDnsCaching();
}
final int numSensors = Integer.parseInt(Objects.requireNonNullElse(
System.getenv(ConfigurationKeys.NUM_SENSORS),
Integer.toString(LoadGenerator.NUMBER_OF_KEYS_DEFAULT)));
......@@ -135,4 +145,9 @@ class EnvVarLoadGeneratorFactory {
return recordSender;
}
private void disableDnsCaching() {
LOGGER.info("Disable DNS caching.");
java.security.Security.setProperty("networkaddress.cache.ttl", "0");
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment