mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 17:30:23 +08:00
fix: 治理 Prometheus 指标基数爆炸和内存缓存无界增长
- 移除 token/latency Prometheus 指标的 model 标签,避免 provider x model 笛卡尔积 - HealthMonitor 滑动窗口从 DB JSON 迁移至进程内存,减少写放大 - ModelCostService 三层缓存增加 500 条上限,超限时清空 - StickyPriority 粘性缓存和健康状态字典增加容量淘汰 - AffinityManager 请求锁字典增加 500 条上限,淘汰空闲锁 - 配额刷新/探测查询使用 defer/load_only 避免加载大 JSON 列 - Alembic 迁移清理 DB 中遗留的 request_results_window 数据 - 同步更新测试适配 batch_get_cooldowns 返回值和批量删除异步化
This commit is contained in:
@@ -22,12 +22,12 @@ def test_parse_pool_config_returns_defaults_for_empty_advanced() -> None:
|
||||
assert cfg is not None
|
||||
assert cfg.sticky_session_ttl_seconds == 3600
|
||||
assert cfg.load_threshold_percent == 80
|
||||
assert cfg.lru_enabled is True
|
||||
assert cfg.scheduling_mode == "lru"
|
||||
assert cfg.lru_enabled is False
|
||||
assert cfg.scheduling_mode == "multi_score"
|
||||
assert cfg.scoring_weights == ScoringWeights()
|
||||
# Default: only LRU preset enabled
|
||||
# Default: only cache_affinity preset enabled
|
||||
assert len(cfg.scheduling_presets) == 1
|
||||
assert cfg.scheduling_presets[0].preset == "lru"
|
||||
assert cfg.scheduling_presets[0].preset == "cache_affinity"
|
||||
assert cfg.scheduling_presets[0].enabled is True
|
||||
assert cfg.latency_window_seconds == 3600
|
||||
assert cfg.latency_sample_limit == 50
|
||||
@@ -263,10 +263,11 @@ def test_parse_pool_config_handles_invalid_types_gracefully() -> None:
|
||||
assert cfg.cost_limit_per_key_tokens is None # default for opt_int
|
||||
|
||||
|
||||
def test_parse_pool_config_invalid_scheduling_mode_falls_back_to_lru() -> None:
|
||||
def test_parse_pool_config_invalid_scheduling_mode_falls_back_to_cache_affinity() -> None:
|
||||
cfg = parse_pool_config({"pool_advanced": {"scheduling_mode": "unknown"}})
|
||||
assert cfg is not None
|
||||
assert cfg.scheduling_mode == "lru"
|
||||
# Default with no explicit presets: cache_affinity -> multi_score
|
||||
assert cfg.scheduling_mode == "multi_score"
|
||||
|
||||
|
||||
def test_parse_pool_config_scoring_weights_invalid_values_are_clamped() -> None:
|
||||
|
||||
Reference in New Issue
Block a user