Skip to content

Conversation

@rinfx
Copy link
Collaborator

@rinfx rinfx commented Sep 23, 2025

Ⅰ. Describe what this PR did

优化全局最小请求数选pod的逻辑

Ⅱ. Does this pull request fix one issue?

Ⅲ. Why don't you add test cases (unit test/integration test)?

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

@lingma-agents
Copy link

lingma-agents bot commented Sep 23, 2025

优化AI负载均衡器的全局最小请求数算法

变更概述
  • 问题修复

    • 修复了全局最小请求数负载均衡策略中遍历目标节点的逻辑错误,确保正确选择请求数最少的目标。
    • 修正了在多个目标具有相同请求数时,未能正确随机选择目标的问题。
    • global_least_request/lb_policy.goprefix_cache/lb_policy.go 中统一了遍历逻辑,增强了代码一致性。
  • 重构

    • 简化了Lua脚本中对目标节点请求数比较和更新的循环逻辑。
    • 移除了冗余代码,提升了脚本可读性和维护性。
  • 性能优化

    • 通过减少不必要的条件判断和优化循环结构,提升了负载均衡决策的执行效率。
变更文件
文件路径 变更说明
plugins/​wasm-go/​extensions/​ai-load-balancer/​global_​least_​request/​lb_​policy.​go 优化了全局最小请求数负载均衡策略的Lua脚本逻辑,修复了遍历目标节点选择最优目标的问题,并增强了随机选择机制。
plugins/​wasm-go/​extensions/​ai-load-balancer/​prefix_​cache/​lb_​policy.​go 调整了前缀缓存负载均衡策略中的目标选择逻辑,与全局最小请求数策略保持一致,确保行为正确性。

💡 小贴士

与 lingma-agents 交流的方式

📜 直接回复评论
直接回复本条评论,lingma-agents 将自动处理您的请求。例如:

  • 在当前代码中添加详细的注释说明。

  • 请详细介绍一下你说的 LRU 改造方案,并使用伪代码加以说明。

📜 在代码行处标记
在文件的特定位置创建评论并 @lingma-agents。例如:

  • @lingma-agents 分析这个方法的性能瓶颈并提供优化建议。

  • @lingma-agents 对这个方法生成优化代码。

📜 在讨论中提问
在任何讨论中 @lingma-agents 来获取帮助。例如:

  • @lingma-agents 请总结上述讨论并提出解决方案。

  • @lingma-agents 请根据讨论内容生成优化代码。

@codecov-commenter
Copy link

codecov-commenter commented Sep 23, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 44.96%. Comparing base (ef31e09) to head (d17c6e3).
⚠️ Report is 725 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2945      +/-   ##
==========================================
+ Coverage   35.91%   44.96%   +9.05%     
==========================================
  Files          69       82      +13     
  Lines       11576    13377    +1801     
==========================================
+ Hits         4157     6015    +1858     
+ Misses       7104     7015      -89     
- Partials      315      347      +32     

see 80 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@johnlanni johnlanni changed the title [optimize] update global least request lua script for ai-load-balancer opt(ai-loadbalancer): update global least request lua script for ai-load-balancer Sep 23, 2025
@johnlanni johnlanni changed the title opt(ai-loadbalancer): update global least request lua script for ai-load-balancer opt(ai-load-balancer): update global least request lua script for ai-load-balancer Sep 23, 2025
Copy link
Collaborator

@johnlanni johnlanni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@johnlanni johnlanni merged commit 9a3ccff into alibaba:main Sep 23, 2025
17 checks passed
Tsukilc pushed a commit to Tsukilc/higress that referenced this pull request Sep 30, 2025
ink-hz pushed a commit to ink-hz/higress-ai-capability-auth that referenced this pull request Nov 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants