Skip to content

Commit

Permalink
renamed property
Browse files Browse the repository at this point in the history
  • Loading branch information
sf-petras committed Sep 18, 2024
1 parent b1b1c99 commit 0535293
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ internal data class WorkloadConfiguration(
val mixedWorkloadRepeatCount: Int,
val workloadCount: Int,
val maxThreads: Int,
val workloadSelectorSeed: Long,
val workloadSelectionSeed: Long,
)

0 comments on commit 0535293

Please sign in to comment.