20260521 三RP性能对比支持rpki-client p4

This commit is contained in:
yuyr 2026-05-23 17:27:42 +08:00
parent fcd0bac070
commit cda7fdb135

View File

@ -425,6 +425,10 @@ def prepare_rpki_client_official_tree(tag: str) -> None:
raise SystemExit(f"rpki-client worktree dirty; refusing checkout:\n{git_status(RPKI_CLIENT_ROOT)}") raise SystemExit(f"rpki-client worktree dirty; refusing checkout:\n{git_status(RPKI_CLIENT_ROOT)}")
run_local(["git", "checkout", tag], cwd=RPKI_CLIENT_ROOT) run_local(["git", "checkout", tag], cwd=RPKI_CLIENT_ROOT)
update_branch = f"rpki-client-{tag}" update_branch = f"rpki-client-{tag}"
local_ref = run_local(["git", "rev-parse", "--verify", update_branch], cwd=RPKI_CLIENT_ROOT / "openbsd", check=False)
if local_ref.returncode == 0:
restore_rpki_client_sources_from_local_openbsd(update_branch)
else:
update_result = run_local(["./update.sh", update_branch], cwd=RPKI_CLIENT_ROOT, check=False) update_result = run_local(["./update.sh", update_branch], cwd=RPKI_CLIENT_ROOT, check=False)
if update_result.returncode != 0: if update_result.returncode != 0:
print( print(
@ -449,7 +453,9 @@ def prepare_rpki_client_official_tree(tag: str) -> None:
run_local(["make", "clean"], cwd=RPKI_CLIENT_ROOT, check=False, capture=False) run_local(["make", "clean"], cwd=RPKI_CLIENT_ROOT, check=False, capture=False)
run_local(["make", f"-j{max(2, min(os.cpu_count() or 2, 8))}"], cwd=RPKI_CLIENT_ROOT, env=configure_env, capture=False) run_local(["make", f"-j{max(2, min(os.cpu_count() or 2, 8))}"], cwd=RPKI_CLIENT_ROOT, env=configure_env, capture=False)
binary = RPKI_CLIENT_ROOT / "src" / "rpki-client" binary = RPKI_CLIENT_ROOT / "src" / "rpki-client"
version = run_local([str(binary), "-V"]).stdout.strip() version_result = run_local([str(binary), "-V"])
version_lines = [line.strip() for text in (version_result.stdout, version_result.stderr) for line in text.splitlines() if line.strip()]
version = version_lines[-1] if version_lines else ""
if version != f"rpki-client-portable {tag}": if version != f"rpki-client-portable {tag}":
raise SystemExit(f"unexpected rpki-client version after build: {version}") raise SystemExit(f"unexpected rpki-client version after build: {version}")
source_text = (RPKI_CLIENT_ROOT / "src" / "http.c").read_text(encoding="utf-8", errors="replace") source_text = (RPKI_CLIENT_ROOT / "src" / "http.c").read_text(encoding="utf-8", errors="replace")
@ -725,7 +731,10 @@ def remote_shell_for_rp(rp: str, run_index: int, mode: str, rirs: list[str], rem
return timed_script(run_dir, reset, argv) return timed_script(run_dir, reset, argv)
if rp == "rpki-client": if rp == "rpki-client":
skiplist = f"{state_dir}/skiplist" skiplist = f"{state_dir}/skiplist"
argv = [f"{remote_root}/bin/rpki-client", "-j", "-c", "-S", skiplist, "-d", f"{state_dir}/cache"] argv = [f"{remote_root}/bin/rpki-client"]
if args.rpki_client_parser_workers:
argv.extend(["-p", str(args.rpki_client_parser_workers)])
argv.extend(["-j", "-c", "-S", skiplist, "-d", f"{state_dir}/cache"])
for rir in rirs: for rir in rirs:
argv.extend(["-t", f"{fixture_dir}/tal/{RIR_TAL[rir]}"]) argv.extend(["-t", f"{fixture_dir}/tal/{RIR_TAL[rir]}"])
argv.append(run_dir) argv.append(run_dir)
@ -1033,6 +1042,7 @@ def process_outputs(args: argparse.Namespace, binary_meta: dict[str, Any], rirs:
"schedule": args.schedule, "schedule": args.schedule,
"oursRsyncScope": args.ours_rsync_scope, "oursRsyncScope": args.ours_rsync_scope,
"routinatorEnableAspa": args.routinator_enable_aspa, "routinatorEnableAspa": args.routinator_enable_aspa,
"rpkiClientParserWorkers": args.rpki_client_parser_workers,
"remoteRoot": args.remote_root, "remoteRoot": args.remote_root,
"sshTarget": args.ssh_target, "sshTarget": args.ssh_target,
"rpResults": rp_results, "rpResults": rp_results,
@ -1501,6 +1511,10 @@ def write_html_report(path: Path, report: dict[str, Any]) -> None:
f"--schedule {report.get('schedule', 'round-robin')} --ours-rsync-scope {report.get('oursRsyncScope', '')} " f"--schedule {report.get('schedule', 'round-robin')} --ours-rsync-scope {report.get('oursRsyncScope', '')} "
"--routinator-enable-aspa" "--routinator-enable-aspa"
) )
rpki_client_parser_workers = int(report.get("rpkiClientParserWorkers", 0) or 0)
rpki_client_p_arg = f" -p {rpki_client_parser_workers}" if rpki_client_parser_workers else ""
rpki_client_p_cli = f" --rpki-client-parser-workers {rpki_client_parser_workers}" if rpki_client_parser_workers else ""
command += rpki_client_p_cli
html_text = f"""<!doctype html> html_text = f"""<!doctype html>
<html lang="zh-CN"> <html lang="zh-CN">
<head> <head>
@ -1523,7 +1537,7 @@ footer {{ color:#64748b; font-size:13px; margin-top:28px; }} @media (max-width:9
<body> <body>
<header> <header>
<h1> RP Round-Robin 性能与产物对比报告</h1> <h1> RP Round-Robin 性能与产物对比报告</h1>
<p>all5 live 十轮对比调度顺序为 <code>rp1 run1 rp2 run1 rp3 run1 rp1 run2 ...</code>ours RP 使用 <code>{h(report.get('oursRsyncScope', ''))}</code>Routinator 启用 <code>--enable-aspa</code>rpki-client 使用 official <code>9.8</code> 正确构建</p> <p>all5 live 十轮对比调度顺序为 <code>rp1 run1 rp2 run1 rp3 run1 rp1 run2 ...</code>ours RP 使用 <code>{h(report.get('oursRsyncScope', ''))}</code>Routinator 启用 <code>--enable-aspa</code>rpki-client 使用 official <code>9.8</code>{h(rpki_client_p_arg)} 正确构建</p>
</header> </header>
<main> <main>
<section> <section>
@ -1543,7 +1557,7 @@ footer {{ color:#64748b; font-size:13px; margin-top:28px; }} @media (max-width:9
<li>RIR<code>{h(','.join(report['rirs']))}</code></li><li>调度<code>{h(report.get('schedule', ''))}</code></li> <li>RIR<code>{h(','.join(report['rirs']))}</code></li><li>调度<code>{h(report.get('schedule', ''))}</code></li>
</ul></div><div><h3>关键变量</h3><ul> </ul></div><div><h3>关键变量</h3><ul>
<li>ours RP<code>--rsync-scope {h(report.get('oursRsyncScope', ''))}</code></li> <li>ours RP<code>--rsync-scope {h(report.get('oursRsyncScope', ''))}</code></li>
<li>Routinator<code>--enable-aspa</code></li><li>rpki-clientofficial <code>9.8</code>本地 fixture TAL/TA</li> <li>Routinator<code>--enable-aspa</code></li><li>rpki-clientofficial <code>9.8</code>{h(rpki_client_p_arg)}本地 fixture TAL/TA</li>
<li>首轮 snapshot后续 delta</li> <li>首轮 snapshot后续 delta</li>
</ul></div></div> </ul></div></div>
<pre>{h(command)}</pre> <pre>{h(command)}</pre>
@ -1572,6 +1586,7 @@ def write_xml(path: Path, report: dict[str, Any]) -> None:
"schedule": str(report.get("schedule", "")), "schedule": str(report.get("schedule", "")),
"oursRsyncScope": str(report.get("oursRsyncScope", "")), "oursRsyncScope": str(report.get("oursRsyncScope", "")),
"routinatorEnableAspa": str(report.get("routinatorEnableAspa", "")).lower(), "routinatorEnableAspa": str(report.get("routinatorEnableAspa", "")).lower(),
"rpkiClientParserWorkers": str(report.get("rpkiClientParserWorkers", "")),
}) })
env = ET.SubElement(root, "environment") env = ET.SubElement(root, "environment")
ET.SubElement(env, "artifactRoot").text = str(path.parent) ET.SubElement(env, "artifactRoot").text = str(path.parent)
@ -1641,8 +1656,11 @@ def main() -> None:
parser.add_argument("--schedule", default="round-robin", choices=["round-robin", "rp-block"], help="Execution schedule: run-index round-robin or one RP block at a time.") parser.add_argument("--schedule", default="round-robin", choices=["round-robin", "rp-block"], help="Execution schedule: run-index round-robin or one RP block at a time.")
parser.add_argument("--ours-rsync-scope", default="publication-point", choices=sorted(RPKI_SCOPE_POLICIES)) parser.add_argument("--ours-rsync-scope", default="publication-point", choices=sorted(RPKI_SCOPE_POLICIES))
parser.add_argument("--routinator-enable-aspa", action="store_true", help="Pass --enable-aspa to Routinator so jsonext includes ASPA/VAP data.") parser.add_argument("--routinator-enable-aspa", action="store_true", help="Pass --enable-aspa to Routinator so jsonext includes ASPA/VAP data.")
parser.add_argument("--rpki-client-parser-workers", type=int, default=0, help="Pass -p N to rpki-client. 0 keeps rpki-client default.")
parser.add_argument("--dry-run", action="store_true") parser.add_argument("--dry-run", action="store_true")
args = parser.parse_args() args = parser.parse_args()
if args.rpki_client_parser_workers < 0:
raise SystemExit("--rpki-client-parser-workers must be >= 0")
args.run_root = args.run_root.resolve() args.run_root = args.run_root.resolve()
args.run_root.mkdir(parents=True, exist_ok=True) args.run_root.mkdir(parents=True, exist_ok=True)
args.active_rps = active_rps(args) args.active_rps = active_rps(args)
@ -1659,6 +1677,7 @@ def main() -> None:
"schedule": args.schedule, "schedule": args.schedule,
"oursRsyncScope": args.ours_rsync_scope, "oursRsyncScope": args.ours_rsync_scope,
"routinatorEnableAspa": args.routinator_enable_aspa, "routinatorEnableAspa": args.routinator_enable_aspa,
"rpkiClientParserWorkers": args.rpki_client_parser_workers,
} }
write_json(args.run_root / "dry-run-plan.json", plan) write_json(args.run_root / "dry-run-plan.json", plan)
if args.dry_run: if args.dry_run: