Skip to content
Snippets Groups Projects
Commit 397866a0 authored by Simon Ehrenstein's avatar Simon Ehrenstein
Browse files

Introduce benchmark interface

parent 6efbd7b5
No related branches found
No related tags found
4 merge requests!159Re-implementation of Theodolite with Kotlin/Quarkus,!157Update Graal Image in CI pipeline,!83WIP: Re-implementation of Theodolite with Kotlin/Quarkus,!78Resolve "Implement Quarkus/Kotlin protype"
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.
*
......
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()
......
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 {
......
......@@ -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
) {}
}
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
) {}
}
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
......@@ -2,7 +2,7 @@ package theodolite.util
import theodolite.k8s.UC1Benchmark
class TestBenchmark : Benchmark(
class TestBenchmark : AbstractBenchmark(
UC1Benchmark.UC1BenchmarkConfig(
zookeeperConnectionString = "",
kafkaIPConnectionString = "",
......
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