MCPcopy
hub / github.com/benoitc/gunicorn / run_isolated_suite

Function run_isolated_suite

benchmarks/dirty_benchmark.py:525–644  ·  view source on GitHub ↗

Run the full isolated benchmark suite.

(
    workers: int = 2,
    threads: int = 1,
    verbose: bool = False,
)

Source from the content-addressed store, hash-verified

523
524
525def run_isolated_suite(
526 workers: int = 2,
527 threads: int = 1,
528 verbose: bool = False,
529) -> list[BenchmarkResult]:
530 """Run the full isolated benchmark suite."""
531 results = []
532
533 bench = IsolatedBenchmark(
534 dirty_workers=workers,
535 dirty_threads=threads,
536 verbose=verbose,
537 )
538
539 print(f"\nStarting isolated benchmarks (workers={workers}, "
540 f"threads={threads})...")
541
542 try:
543 bench.start()
544 bench.warmup()
545
546 # Define scenarios
547 scenarios = [
548 # Baseline
549 {
550 "name": "baseline_10ms",
551 "action": "sleep_task",
552 "args": (10,),
553 "requests": 1000,
554 "concurrency": 1,
555 "description": "Single request latency (10ms sleep)",
556 },
557 # Throughput
558 {
559 "name": "throughput_10ms",
560 "action": "sleep_task",
561 "args": (10,),
562 "requests": 5000,
563 "concurrency": 100,
564 "description": "Max requests/sec (10ms sleep, 100 clients)",
565 },
566 # CPU Bound
567 {
568 "name": "cpu_bound_100ms",
569 "action": "cpu_task",
570 "args": (100,),
571 "requests": 500,
572 "concurrency": 20,
573 "description": "CPU-bound work (100ms, 20 clients)",
574 },
575 # I/O Bound
576 {
577 "name": "io_bound_500ms",
578 "action": "sleep_task",
579 "args": (500,),
580 "requests": 200,
581 "concurrency": 50,
582 "description": "I/O-bound work (500ms sleep, 50 clients)",

Callers 1

mainFunction · 0.85

Calls 8

startMethod · 0.95
warmupMethod · 0.95
run_benchmarkMethod · 0.95
stopMethod · 0.95
IsolatedBenchmarkClass · 0.85
from_samplesMethod · 0.80
BenchmarkResultClass · 0.70
getMethod · 0.45

Tested by

no test coverage detected