以APP为范围使用LRU和LFU#3159
Open
buzhidaolvtu wants to merge 1 commit into
Open
Conversation
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.
What kind of change does this PR introduce? (check at least one)
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: