Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optimize the logic of cpu allocation #501

Merged
merged 1 commit into from
Nov 8, 2021

Conversation

DuodenumL
Copy link
Contributor

cache cloud那边有个需求,希望让同一台机器上的所有redis共享同一个核心来做bgsave,所以core里加入了一个配置项叫“maxshare”,限制最大的碎片核数。

不过在分配cpu的时候,core会把所有剩余pieces为0的核划分为碎片核,这样就会导致如下问题:对于一个四核的node,如果core设置了maxshare=1,那么在分配了一个带--cpu-bind --cpu=1.1的workload之后,再申请创建同样的workload会提示资源不足。原因是在第一个workload分配之后,有一个核剩余pieces是0,被识别为碎片核,core就不会再分配新的碎片核了。

所以改动了一下这里的逻辑,对于pieces为0的核,不再视为碎片核。

}

resources = append(newResources, resources[len(resources)-rem:]...)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

这里这个append没有用,不会更改外部的h.full,而且这个NewResources的设计也没有用到,我就给去掉了...

Copy link
Member

Choose a reason for hiding this comment

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

@jschwinger233
Copy link
Member

cache cloud那边有个需求,希望让同一台机器上的所有redis共享同一个核心来做bgsave,所以core里加入了一个配置项叫“maxshare”,限制最大的碎片核数。

因果关系不对, 不过不重要...

@jschwinger233
Copy link
Member

等下, 把对应的测试补上

@CMGS CMGS merged commit 88de04e into projecteru2:master Nov 8, 2021
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