diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutor.kt b/theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutor.kt index 2cc54a25cfd3bc30d3f96c9f36e684869e95f750..82a40908990879624edd54dbb9c999df14ad4f2f 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutor.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutor.kt @@ -1,7 +1,7 @@ package theodolite.execution import mu.KotlinLogging -import theodolite.util.Benchmark +import theodolite.util.AbstractBenchmark import theodolite.util.LoadDimension import theodolite.util.Resource import theodolite.util.Results @@ -17,7 +17,7 @@ private val logger = KotlinLogging.logger {} * @property executionDuration * @constructor Create empty Benchmark executor */ -abstract class BenchmarkExecutor(val benchmark: Benchmark, val results: Results, val executionDuration: Duration) { +abstract class BenchmarkExecutor(val benchmark: AbstractBenchmark, val results: Results, val executionDuration: Duration) { /** * Run a experiment for the given parametrization, evaluate the experiment and save the result. * diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutorImpl.kt b/theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutorImpl.kt index 189b32043447aae73c2cc69c12fa52b87dcacc3b..a975085bf38f7d00146a4f4e415aa4444d85e991 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutorImpl.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutorImpl.kt @@ -1,13 +1,12 @@ package theodolite.execution -import mu.KotlinLogging -import theodolite.util.Benchmark +import theodolite.util.AbstractBenchmark import theodolite.util.LoadDimension import theodolite.util.Resource import theodolite.util.Results import java.time.Duration -class BenchmarkExecutorImpl(benchmark: Benchmark, results: Results, executionDuration: Duration) : BenchmarkExecutor(benchmark, results, executionDuration) { +class BenchmarkExecutorImpl(benchmark: AbstractBenchmark, results: Results, executionDuration: Duration) : BenchmarkExecutor(benchmark, results, executionDuration) { override fun runExperiment(load: LoadDimension, res: Resource): Boolean { benchmark.start(load, res) this.waitAndLog() diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/execution/TestBenchmarkExecutorImpl.kt b/theodolite-quarkus/src/main/kotlin/theodolite/execution/TestBenchmarkExecutorImpl.kt index 4eb3de4e1ab88703e9fe3e652a35d7f8a44fd5b8..9823c4dd5c9800955e07eded87a76871a30c9e86 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/execution/TestBenchmarkExecutorImpl.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/execution/TestBenchmarkExecutorImpl.kt @@ -1,14 +1,12 @@ package theodolite.execution -import mu.KotlinLogging -import theodolite.execution.BenchmarkExecutor -import theodolite.util.Benchmark +import theodolite.util.AbstractBenchmark import theodolite.util.LoadDimension import theodolite.util.Resource import theodolite.util.Results import java.time.Duration -class TestBenchmarkExecutorImpl(private val mockResults: Array<Array<Boolean>>, benchmark: Benchmark, results: Results): +class TestBenchmarkExecutorImpl(private val mockResults: Array<Array<Boolean>>, benchmark: AbstractBenchmark, results: Results): BenchmarkExecutor(benchmark, results, executionDuration = Duration.ofSeconds(1)) { override fun runExperiment(load: LoadDimension, res: Resource): Boolean { diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/k8s/UC1Benchmark.kt b/theodolite-quarkus/src/main/kotlin/theodolite/k8s/UC1Benchmark.kt index c8766c2fa8723feced205a67af482046ec38f4eb..2f3dd9d66661ce26114bac79c95f670b5b3e3843 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/k8s/UC1Benchmark.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/k8s/UC1Benchmark.kt @@ -6,13 +6,13 @@ import io.fabric8.kubernetes.api.model.apps.Deployment import io.fabric8.kubernetes.client.DefaultKubernetesClient import io.fabric8.kubernetes.client.NamespacedKubernetesClient import mu.KotlinLogging -import theodolite.util.Benchmark +import theodolite.util.AbstractBenchmark import theodolite.util.LoadDimension import theodolite.util.Resource private val logger = KotlinLogging.logger {} -class UC1Benchmark(config: UC1BenchmarkConfig) : Benchmark(config) { +class UC1Benchmark(config: AbstractBenchmarkConfig) : AbstractBenchmark(config) { private val workloadGeneratorStateCleaner: WorkloadGeneratorStateCleaner private val topicManager: TopicManager @@ -94,19 +94,4 @@ class UC1Benchmark(config: UC1BenchmarkConfig) : Benchmark(config) { this.deploymentManager.setWorkloadEnv(this.wgDeployment, "workload-generator", environmentVariables) this.deploymentManager.deploy(this.wgDeployment) } - - data class UC1BenchmarkConfig( - val zookeeperConnectionString: String, - val kafkaIPConnectionString: String, - val schemaRegistryConnectionString: String, - val kafkaTopics: List<String>, - val kafkaReplication: Short, - val kafkaPartition: Int, - val ucDeploymentPath: String, - val ucServicePath: String, - val configMapPath: String, - val wgDeploymentPath: String, - val ucImageURL: String, - val wgImageURL: String - ) {} } diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/util/AbstractBenchmark.kt b/theodolite-quarkus/src/main/kotlin/theodolite/util/AbstractBenchmark.kt new file mode 100644 index 0000000000000000000000000000000000000000..7f78b74d2f10002b11bcf0468cfe8d3191628a49 --- /dev/null +++ b/theodolite-quarkus/src/main/kotlin/theodolite/util/AbstractBenchmark.kt @@ -0,0 +1,27 @@ +package theodolite.util + +import theodolite.k8s.UC1Benchmark + +abstract class AbstractBenchmark(val config: AbstractBenchmarkConfig): Benchmark { + override fun start(load: LoadDimension, resources: Resource) { + this.clearClusterEnvironment() + this.initializeClusterEnvironment() + this.startSUT(resources) + this.startWorkloadGenerator(load) + } + + data class AbstractBenchmarkConfig( + val zookeeperConnectionString: String, + val kafkaIPConnectionString: String, + val schemaRegistryConnectionString: String, + val kafkaTopics: List<String>, + val kafkaReplication: Short, + val kafkaPartition: Int, + val ucDeploymentPath: String, + val ucServicePath: String, + val configMapPath: String, + val wgDeploymentPath: String, + val ucImageURL: String, + val wgImageURL: String + ) {} +} diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/util/Benchmark.kt b/theodolite-quarkus/src/main/kotlin/theodolite/util/Benchmark.kt index 0cb342a2912dfde8d976765c66114e86555128c5..44f98da2ec34df02d2b010dc1844f1ffa57c0f50 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/util/Benchmark.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/util/Benchmark.kt @@ -1,19 +1,12 @@ package theodolite.util -import theodolite.k8s.UC1Benchmark - -abstract class Benchmark(val config: UC1Benchmark.UC1BenchmarkConfig) { +interface Benchmark { fun start(load: LoadDimension, resources: Resource) { - this.clearClusterEnvironment() - this.initializeClusterEnvironment() - this.startSUT(resources) - this.startWorkloadGenerator(load) } - abstract fun initializeClusterEnvironment(); - abstract fun clearClusterEnvironment(); - - abstract fun startSUT(resources: Resource); + fun initializeClusterEnvironment(); + fun clearClusterEnvironment(); - abstract fun startWorkloadGenerator(load: LoadDimension) -} + fun startSUT(resources: Resource); + fun startWorkloadGenerator(load: LoadDimension) +} \ No newline at end of file diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/util/TestBenchmark.kt b/theodolite-quarkus/src/main/kotlin/theodolite/util/TestBenchmark.kt index 3e6cf2396708d4af72c178a81517a2c620ad4061..0f32e24b0fbf9bdebb3aeaf4794a34ac481bd371 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/util/TestBenchmark.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/util/TestBenchmark.kt @@ -2,7 +2,7 @@ package theodolite.util import theodolite.k8s.UC1Benchmark -class TestBenchmark : Benchmark( +class TestBenchmark : AbstractBenchmark( UC1Benchmark.UC1BenchmarkConfig( zookeeperConnectionString = "", kafkaIPConnectionString = "",