From 053529305004948ff31ea7ae0a8c7df4a9b19355 Mon Sep 17 00:00:00 2001 From: Kristian Petras Date: Wed, 18 Sep 2024 21:23:42 +0200 Subject: [PATCH] renamed property --- .../kotlin/org/renaissance/http4k/Http4kBenchmark.kt | 11 +++++++++-- .../org/renaissance/http4k/workload/WorkloadClient.kt | 4 ++-- .../http4k/workload/WorkloadConfiguration.kt | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/benchmarks/http4k/src/main/kotlin/org/renaissance/http4k/Http4kBenchmark.kt b/benchmarks/http4k/src/main/kotlin/org/renaissance/http4k/Http4kBenchmark.kt index 1d771543..cf4c88f1 100644 --- a/benchmarks/http4k/src/main/kotlin/org/renaissance/http4k/Http4kBenchmark.kt +++ b/benchmarks/http4k/src/main/kotlin/org/renaissance/http4k/Http4kBenchmark.kt @@ -58,10 +58,17 @@ import org.renaissance.http4k.workload.WorkloadServer summary = "Maximum number of threads to use for the executor of the requests." ) @Parameter( - name = "workload_selector_seed", + name = "workload_selection_seed", defaultValue = "42", summary = "Seed used to generate random workloads." ) +@Configuration( + name = "test", + settings = [ + "max_threads = 2", + "workload_count = 100", + ] +) @Configuration(name = "jmh") class Http4kBenchmark : Benchmark { private lateinit var server: WorkloadServer @@ -96,7 +103,7 @@ class Http4kBenchmark : Benchmark { mixedWorkloadRepeatCount = parameter("mixed_workload_repeat_count").value().toInt(), workloadCount = parameter("workload_count").value().toInt(), maxThreads = parameter("max_threads").value().toInt(), - workloadSelectorSeed = parameter("workload_selector_seed").value().toLong() + workloadSelectionSeed = parameter("workload_selection_seed").value().toLong() ) private fun WorkloadConfiguration.toWorkloadClient(): WorkloadClient = diff --git a/benchmarks/http4k/src/main/kotlin/org/renaissance/http4k/workload/WorkloadClient.kt b/benchmarks/http4k/src/main/kotlin/org/renaissance/http4k/workload/WorkloadClient.kt index 513c8c1c..1a390c8b 100644 --- a/benchmarks/http4k/src/main/kotlin/org/renaissance/http4k/workload/WorkloadClient.kt +++ b/benchmarks/http4k/src/main/kotlin/org/renaissance/http4k/workload/WorkloadClient.kt @@ -36,11 +36,11 @@ internal class WorkloadClient( * Each workload consists of read, write, ddos and mixed requests. * The number of workloads is determined by [WorkloadConfiguration.workloadCount]. * The number of requests for each workload type is determined by the corresponding configuration value. - * Random workload is generated for each iteration based on the seed in [WorkloadConfiguration.workloadSelectorSeed]. + * Random workload is generated for each iteration based on the seed in [WorkloadConfiguration.workloadSelectionSeed]. * @return WorkloadResult containing number of requests per type used for validation. */ suspend fun workload(): WorkloadSummary = coroutineScope { - val random = Random(configuration.workloadSelectorSeed) + val random = Random(configuration.workloadSelectionSeed) withContext(dispatcher) { range(configuration.workloadCount).flatMap { when (random.nextWorkload()) { diff --git a/benchmarks/http4k/src/main/kotlin/org/renaissance/http4k/workload/WorkloadConfiguration.kt b/benchmarks/http4k/src/main/kotlin/org/renaissance/http4k/workload/WorkloadConfiguration.kt index a9737cd2..bfe198d1 100644 --- a/benchmarks/http4k/src/main/kotlin/org/renaissance/http4k/workload/WorkloadConfiguration.kt +++ b/benchmarks/http4k/src/main/kotlin/org/renaissance/http4k/workload/WorkloadConfiguration.kt @@ -9,5 +9,5 @@ internal data class WorkloadConfiguration( val mixedWorkloadRepeatCount: Int, val workloadCount: Int, val maxThreads: Int, - val workloadSelectorSeed: Long, + val workloadSelectionSeed: Long, ) \ No newline at end of file