Skip to content

以APP为范围使用LRU和LFU#3159

Open
buzhidaolvtu wants to merge 1 commit into
xuxueli:masterfrom
buzhidaolvtu:master
Open

以APP为范围使用LRU和LFU#3159
buzhidaolvtu wants to merge 1 commit into
xuxueli:masterfrom
buzhidaolvtu:master

Conversation

@buzhidaolvtu
Copy link
Copy Markdown

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

The description of the PR:
现在的LRU和LFU都是以一个JOB为单位统计的,即使其他JOB(同一个APP内)对某一台执行器地址使用的很频繁,另一个JOB也感知不到。

建议方案:调度中心选择APP的执行器地址时,建立APP范围内的LFU和LRU的统计信息,统计JOB之间的互相使用。

实现方案:每次route地址成功后,都更新LRU和LFU的统计信息,且每个APP都有独立的统计结果。

效果:经单测验证,LRU和LFU可以实现近似均匀分布的效果。
xxl-job-admin/src/test/java/com/xxl/job/admin/core/route/ExecutorRouterHelperTest.java

测试:一个app,地址是两个,分别为191.0.0.1,192.0.0.2,然后建立两个route策略,第一个JOB路由策略是First,运行1000次,第二个JOB路由策略是LFU,运行1000次,地址的统计数据是:
{191.0.0.1=1016, 192.0.0.2=984}

Other information:

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.

1 participant