Skip to content

Commit 0b9e609

Browse files
committed
override throughput + client parameters if load testing
Signed-off-by: Michael Oviedo <[email protected]>
1 parent 61ebf09 commit 0b9e609

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

osbenchmark/benchmark.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -648,10 +648,9 @@ def add_workload_source(subparser):
648648
help="Stop executing tests if an error occurs in one of the test iterations (default: false).",
649649
)
650650
test_execution_parser.add_argument(
651-
"--load-test",
652-
action="store_true",
653-
help="Run a load test (default: false).",
654-
default=False
651+
"--load-test-qps",
652+
help="Run a load test on your cluster, up to a certain QPS value (default: 0)",
653+
default=0
655654
)
656655

657656
###############################################################################
@@ -926,7 +925,7 @@ def configure_test(arg_parser, args, cfg):
926925
"load_worker_coordinator_hosts",
927926
opts.csv_to_list(args.load_worker_coordinator_hosts))
928927
cfg.add(config.Scope.applicationOverride, "workload", "test.mode.enabled", args.test_mode)
929-
cfg.add(config.Scope.applicationOverride, "workload", "load.test.enabled", args.load_test)
928+
cfg.add(config.Scope.applicationOverride, "workload", "load.test.clients", int(args.load_test_qps))
930929
cfg.add(config.Scope.applicationOverride, "workload", "latency.percentiles", args.latency_percentiles)
931930
cfg.add(config.Scope.applicationOverride, "workload", "throughput.percentiles", args.throughput_percentiles)
932931
cfg.add(config.Scope.applicationOverride, "workload", "randomization.enabled", args.randomization_enabled)

osbenchmark/worker_coordinator/worker_coordinator.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,15 @@ def start_benchmark(self):
657657
self.logger.info("Attaching cluster-level telemetry devices.")
658658
self.telemetry.on_benchmark_start()
659659
self.logger.info("Cluster-level telemetry devices are now attached.")
660-
660+
# if load testing is enabled, modify the client + throughput number for the task(s)
661+
# target throughput + clients will then be equal to the qps passed in through --load-test
662+
load_test_clients = self.config.opts("workload", "load.test.clients", mandatory=False)
663+
if load_test_clients:
664+
for task in self.test_procedure.schedule:
665+
for subtask in task:
666+
subtask.clients = load_test_clients
667+
subtask.params["target-throughput"] = load_test_clients
668+
self.logger.info("Load test mode enabled - set client count to %d", load_test_clients)
661669
allocator = Allocator(self.test_procedure.schedule)
662670
self.allocations = allocator.allocations
663671
self.number_of_steps = len(allocator.join_points) - 1
@@ -1634,7 +1642,7 @@ async def __call__(self, *args, **kwargs):
16341642
await asyncio.sleep(rampup_wait_time)
16351643

16361644
if rampup_wait_time:
1637-
self.logger.info(f" Client id {self.client_id} is running now.")
1645+
self.logger.info("Client id [%s] is running now.", self.client_id)
16381646

16391647
self.logger.debug("Entering main loop for client id [%s].", self.client_id)
16401648
# noinspection PyBroadException

0 commit comments

Comments
 (0)