Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 4.0.0-incubating
    • Fix Version/s: 4.0.0-incubating
    • Component/s: rocketmq-broker
    • Labels:
      None

      Description

      when start RocketMQ,CPU get very high

        Issue Links

          Activity

          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user zhouxinyu commented on a diff in the pull request:

          https://github.com/apache/incubator-rocketmq/pull/31#discussion_r95059198

          — Diff: store/src/main/java/org/apache/rocketmq/store/CommitLog.java —
          @@ -1045,7 +1045,7 @@ public void run() {

          while (!this.isStopped()) {
          try {

          • this.waitForRunning(0);
            + this.waitForRunning(1000);
              • End diff –

          `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.

          Show
          githubbot ASF GitHub Bot added a comment - Github user zhouxinyu commented on a diff in the pull request: https://github.com/apache/incubator-rocketmq/pull/31#discussion_r95059198 — Diff: store/src/main/java/org/apache/rocketmq/store/CommitLog.java — @@ -1045,7 +1045,7 @@ public void run() { while (!this.isStopped()) { try { this.waitForRunning(0); + this.waitForRunning(1000); End diff – `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.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user zhouxinyu commented on a diff in the pull request:

          https://github.com/apache/incubator-rocketmq/pull/31#discussion_r95059881

          — Diff: store/src/main/java/org/apache/rocketmq/store/CommitLog.java —
          @@ -1045,7 +1045,7 @@ public void run() {

          while (!this.isStopped()) {
          try {

          • this.waitForRunning(0);
            + this.waitForRunning(1000);
              • End diff –

          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

          Show
          githubbot ASF GitHub Bot added a comment - Github user zhouxinyu commented on a diff in the pull request: https://github.com/apache/incubator-rocketmq/pull/31#discussion_r95059881 — Diff: store/src/main/java/org/apache/rocketmq/store/CommitLog.java — @@ -1045,7 +1045,7 @@ public void run() { while (!this.isStopped()) { try { this.waitForRunning(0); + this.waitForRunning(1000); End diff – 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
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user qinliujie commented on the issue:

          https://github.com/apache/incubator-rocketmq/pull/31

          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.

          Show
          githubbot ASF GitHub Bot added a comment - Github user qinliujie commented on the issue: https://github.com/apache/incubator-rocketmq/pull/31 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.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user zhouxinyu commented on the issue:

          https://github.com/apache/incubator-rocketmq/pull/31

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

          Show
          githubbot ASF GitHub Bot added a comment - Github user zhouxinyu commented on the issue: https://github.com/apache/incubator-rocketmq/pull/31 Thanks @qinliujie, please @vongosling @stevenschew help review.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user vintagewang commented on the issue:

          https://github.com/apache/incubator-rocketmq/pull/31

          review ok.

          Show
          githubbot ASF GitHub Bot added a comment - Github user vintagewang commented on the issue: https://github.com/apache/incubator-rocketmq/pull/31 review ok.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user zhouxinyu commented on the issue:

          https://github.com/apache/incubator-rocketmq/pull/31

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

          Show
          githubbot ASF GitHub Bot added a comment - Github user zhouxinyu commented on the issue: https://github.com/apache/incubator-rocketmq/pull/31 Hi, @qinliujie This PR will be merged soon, but next time please send PR from branch ROCKETMQ-33 instead of master.
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 9d76ea923159ff36d462b1809104164e270fce96 in incubator-rocketmq's branch refs/heads/master from qinliujie
          [ https://git-wip-us.apache.org/repos/asf?p=incubator-rocketmq.git;h=9d76ea9 ]

          MASTER ROCKETMQ-33 Resolve cpu occupy 100% issue in GroupCommitService/HAService, closes apache/incubator-rocketmq#31

          Show
          jira-bot ASF subversion and git services added a comment - Commit 9d76ea923159ff36d462b1809104164e270fce96 in incubator-rocketmq's branch refs/heads/master from qinliujie [ https://git-wip-us.apache.org/repos/asf?p=incubator-rocketmq.git;h=9d76ea9 ] MASTER ROCKETMQ-33 Resolve cpu occupy 100% issue in GroupCommitService/HAService, closes apache/incubator-rocketmq#31
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user asfgit closed the pull request at:

          https://github.com/apache/incubator-rocketmq/pull/31

          Show
          githubbot ASF GitHub Bot added a comment - Github user asfgit closed the pull request at: https://github.com/apache/incubator-rocketmq/pull/31
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user qinliujie commented on the issue:

          https://github.com/apache/incubator-rocketmq/pull/31

          @zhouxinyu OK.

          Show
          githubbot ASF GitHub Bot added a comment - Github user qinliujie commented on the issue: https://github.com/apache/incubator-rocketmq/pull/31 @zhouxinyu OK.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user Ah39 commented on the issue:

          https://github.com/apache/incubator-rocketmq/pull/31

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

          Show
          githubbot ASF GitHub Bot added a comment - Github user Ah39 commented on the issue: https://github.com/apache/incubator-rocketmq/pull/31 waitForRunning(0) is call wait(0). wait(0) is wait forever util somenoe notify the Thread
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user Jaskey commented on the issue:

          https://github.com/apache/incubator-rocketmq/pull/31

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

          Show
          githubbot ASF GitHub Bot added a comment - Github user Jaskey commented on the issue: https://github.com/apache/incubator-rocketmq/pull/31 I agreee with @Ah39 , 0ms is wait forever, which should not cause high cpu problem, any other justice reason to modify it to 10ms?
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user qinliujie commented on the issue:

          https://github.com/apache/incubator-rocketmq/pull/31

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

          Show
          githubbot ASF GitHub Bot added a comment - Github user qinliujie commented on the issue: https://github.com/apache/incubator-rocketmq/pull/31 old version use the Object wait() method,but it had changed to countdown latch in new version,please notice that @Jaskey

            People

            • Assignee:
              Yukon yukon
              Reporter:
              qinliujie qinliujie
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development