Skip to content

[ROCKETMQ-33] CPU Occupy 100%#31

Closed
qinliujie wants to merge 4 commits into
apache:masterfrom
qinliujie:master
Closed

[ROCKETMQ-33] CPU Occupy 100%#31
qinliujie wants to merge 4 commits into
apache:masterfrom
qinliujie:master

Conversation

@qinliujie

Copy link
Copy Markdown
Contributor

@qinliujie

Copy link
Copy Markdown
Contributor Author

Sorry,I wrote the wrong issue number,it shoud be [ROCKETMQ-33] CPU Occupy 100%

@qinliujie qinliujie changed the title [ROCKETMQ-34] CPU Occupy 100% [ROCKETMQ-33] CPU Occupy 100% Jan 7, 2017
while (!this.isStopped()) {
try {
this.waitForRunning(0);
this.waitForRunning(1000);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

GroupCommitService will be used when broker is in SYNC_FLUSH, so the flushCommitLogService need always doCommit without a break.

And this won't cause 100% CPU usage unless your server only has one cpu core.

BTW, how about use ASYNC_FLUSH if you mind.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I also think waitForRunning(0) is too rigorous, but waitForRunning(1000) is adventurous while the GroupCommitService may miss some notify signals.

How about set a smaller wait time, like 10ms? what's your opinion ? @qinliujie

@qinliujie

qinliujie commented Jan 8, 2017

Copy link
Copy Markdown
Contributor Author

When I use ASYNC_MASTER,there was the same problem,Because HAService also has this.waitForRunning(0),whether SYNC_MASTER or not.

When you said that the GroupCommitService may miss some notify signals,I think it's right.So I think wait time to be 10ms is acceptable. @zhouxinyu

@zhouxinyu

Copy link
Copy Markdown
Member

Thanks @qinliujie, please @vongosling @stevenschew help review.

@vintagewang

Copy link
Copy Markdown
Contributor

review ok.

@zhouxinyu

Copy link
Copy Markdown
Member

Hi, @qinliujie This PR will be merged soon, but next time please send PR from branch ROCKETMQ-33 instead of master.

@asfgit asfgit closed this in 9d76ea9 Jan 9, 2017
@qinliujie

Copy link
Copy Markdown
Contributor Author

@zhouxinyu OK.

@Ah39

Ah39 commented Jan 16, 2017

Copy link
Copy Markdown

waitForRunning(0) is call wait(0). wait(0) is wait forever util somenoe notify the Thread

@Jaskey

Jaskey commented Feb 14, 2017

Copy link
Copy Markdown
Contributor

I agreee with @Ah39 , 0ms is wait forever, which should not cause high cpu problem, any other justice reason to modify it to 10ms?

@qinliujie

Copy link
Copy Markdown
Contributor Author

old version use the Object wait() method,but it had changed to countdown latch in new version,please notice that @Jaskey

lizhanhui pushed a commit to lizhanhui/rocketmq that referenced this pull request Jun 25, 2019
JiaMingLiu93 pushed a commit to JiaMingLiu93/rocketmq that referenced this pull request May 28, 2020
pingww pushed a commit that referenced this pull request Aug 26, 2022
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.

6 participants