refactor(判题机): 换成 go-judge,空闲内存从几百 MB 降到 16 MB
原来的 JudgeServer 按核数起 gunicorn worker、每份提交再按核数开进程池,空闲内存跟着核数走
(2 核 52MB、16 核 305MB)。换成 go-judge 后空闲 16MB,同一批提交判题中 80–100MB(原来约 370MB)。
go-judge 只管在沙箱里跑命令,编译、逐点运行、比对输出、定状态码搬到 judge/sandbox.ts,
口径逐条照搬 JudgeServer,出参形状不变。拿生产库真实提交新旧逐点对比:C 2000 份 1989 一致、
C++ 891 份 890 一致、Python 2000 份全一致;不一致的是 system("pause")(现在不再判运行时错误)、
未定义行为、endl 死循环打印(运行时错误变运行超时),见 docker/judge/README.md。
- 判题容器改成 privileged(go-judge 要自己建 cgroup),镜像 oj2-judge-3
- 心跳改由 worker 每 5 秒问判题机 /version 代记,删掉 /api/judge-server/heartbeat
- 前端统一用 stripJudgePath 去掉判题机工作目录(新的 /w/ 和旧的 /judger/run/)
- 提交前编译检查只编译不运行
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8427475337
commit
37e971b6b4
30 files changed
+881
-592
No files matched your search
+2
-3
@@ -36,9 +36,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
# 判题机心跳每秒一次;静态资源量大且带永久缓存。两者都不记访问日志。
|
||||
# 路径跟着新后端改了:judge_server_heartbeat → judge-server/heartbeat
|
||||
@nolog path /api/judge-server/heartbeat /api/judge-server/heartbeat/ /assets/* /emoji/*
|
||||
# 静态资源量大且带永久缓存,不记访问日志
|
||||
@nolog path /assets/* /emoji/*
|
||||
log_skip @nolog
|
||||
|
||||
handle /api/* {
|
||||
|
||||
Reference in new issue
Block a user