perf: 反混淆路径并发限流(默认 32) - #1
Merged
Merged
Conversation
- 三张全局查找表改用 ahash::AHashMap(实测 wall ~3% 收益,零成本保留) - 新增并发限流信号量 GATE(SPINYARN_MAX_CONCURRENCY,默认 8): 无缓存模型下每个在途请求持有一整套版本表(~30MB),限流把峰值内存 钉在 N×单版本,防止突发流量 OOM。默认值依据 LogShare 实际流量 ~1600 RPM × ~150ms/请求 ≈ 稳态并发 4,平时不触发 - 响应体移除 original 字段(breaking:客户端持有原文,大日志响应体减半), 并消除 handler 中的 content.clone() 内存实测(Termux,1.21.11,232KB 日志):空闲 ~6MB;8 并发峰值 ~152MB, 突发结束回落 ~23MB;多版本交替请求 RSS 稳定 ~33-36MB,无驻留累积。
qitry
self-requested a review
August 2, 2026 16:40
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
改动
并发限流(本 PR 唯一改动)
src/api/deobfuscate.rs新增全局Semaphore(SPINYARN_MAX_CONCURRENCY,默认 32)。无缓存模型下每个在途请求持有一整套版本表(~30MB),不限流时 N 并发 = N×30MB。限流把峰值内存钉死,突发流量时把 OOM 换成短暂排队。
默认值依据:LogShare 实际流量 ~1600 RPM(~27 req/s)× ~150ms/请求 ≈ 稳态并发 16,限 32 平时完全不触发,只在突发时生效。
Review 调整
原 PR 中的以下两项已回退:
original字段:breaking change,客户端暂不能同步适配,保留该字段测试
cargo test:15/15 通过bash test.sh:7/7 通过