proxy-pool/docs/adr/README.md
youfak 4de3ffb85f
Some checks are pending
ci / test (ubuntu-latest) (push) Waiting to run
ci / test (windows-latest) (push) Waiting to run
ci / race (push) Waiting to run
feat: add ephemeral proxy activity pool
2026-07-29 12:51:18 +08:00

38 lines
1.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 架构决策记录
## ADR-001控制面与数据面分离
**状态:** 接受。
Gateway 只依赖本地不可变 SnapshotProvider、数据库、配置重载和健康聚合
位于 Controller/Checker。该选择隔离外部 I/O 抖动,并允许数据面按 QPS、
控制面按 Provider/库存规模独立扩容。
## ADR-002Distribution 使用独占提取
**状态:** 接受并覆盖早期 Lease 方案。
成功响应前,通过 Redis 原子操作完成候选选择、`AVAILABLE -> EXTRACTED` 和
短期幂等结果写入;不提供 release、renew 或使用跟踪。这样契合“拿走真实
代理后平台不再管理”的最终产品语义,并消除并发重复发放。
## ADR-003单 Worker 所有权
**状态:** 接受。
一个 Proxy 同一时刻至多归属一个 WorkerGateway 在本地维护 Active/Reserved。
Distribution 只提取无所有权 Proxy回收时执行 drain/ACK/归零/解除所有权。
该选择避免每请求访问 Redis 做全局并发计数。
## ADR-004PostgreSQL 保存控制面事实Redis 承载短效活动池
**状态:** 接受。
Proxy 明细不进入 PostgreSQL。短效 Proxy 及其状态、所有权和过期时间只存在于
带 TTL 的 Redis 活动池及节点内存Redis 同时承担独占提取、短期幂等结果、
Provider Leader、分布式速率和 Worker 心跳。Redis 丢失时活动池作废,由
Provider 重新获取并重建,不从 PostgreSQL 恢复原 Proxy。
PostgreSQL 只持久化配置版本、Upstream/Routing 管理状态、Admin 审计与 Outbox
以及可选的无 Proxy 明细聚合指标。两类存储不双写 Proxy也不建立跨存储事务。