test: compare native concurrency and server memory

This commit is contained in:
2026-09-21 02:35:48 +08:00
parent c36bb70f96
commit 3d5f225fb2
10 changed files with 2577 additions and 115 deletions

View File

@@ -11,7 +11,12 @@ def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--go", default="go")
parser.add_argument("--count", type=int, default=3)
parser.add_argument("--load", action="store_true", help="Also compare isolated servers and idle connection memory")
parser.add_argument("--duration", default="2s", help="Duration per load scenario")
parser.add_argument("--output", help="JSON output path for --load")
args = parser.parse_args()
if args.count < 1:
parser.error("--count must be positive")
root = Path(__file__).resolve().parent.parent
env = dict(os.environ, GOWORK="off")
checks = [
@@ -23,12 +28,13 @@ def main():
"-benchmem", "-count", str(args.count), "./transport"],
"transport benchmarks",
),
(
[args.go, "test", "-run", "^$", "-bench", "^BenchmarkNative",
"-benchmem", "-count", str(args.count), "./transport/native"],
"native TCP benchmarks",
),
]
if args.load:
command = [args.go, "run", "./internal/perfcheck", "--duration", args.duration,
"--count", str(args.count)]
if args.output:
command += ["--output", str(Path(args.output).resolve())]
checks.append((command, "isolated server concurrency and idle-memory matrix"))
for command, name in checks:
print(f"Running {name}", flush=True)
result = subprocess.run(command, cwd=root, env=env, text=True,