You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/12/16 03:41:40 UTC

[GitHub] [doris] liutang123 opened a new pull request, #15124: [Pipeline] Add MLFQ when schedule

liutang123 opened a new pull request, #15124:
URL: https://github.com/apache/doris/pull/15124

   # Proposed changes
   
   Issue Number: close #xxx
   
   ## Problem summary
   
   Describe your changes.
   before use mlfq:
   query  | query time     |  query time with big query   |        query time increase times
   -- | -- | -- | --
   q1       |    124.0              |     6554.0                |                        52.85
   q2      |     104.0        |          2341.0                  |                       22.51
   q3       |    280.0        |          8174.0                  |                       29.19
   q4        |   45.0          |          2596.0                 |                       57.69
   
   aflter use mlfq as pipeline task queue:
   query  | query time     |  query time with big query   |        query time increase times
   -- | -- | -- | --
   q1       |    89.0         |          1416.0 | 15.91
   q2      |    68.0           |      1692.0 | 24.88
   q3      |    149.0         |         1266.0 | 8.50
   q4       |   50.0           |         406.0 | 8.12
   
   
   
   
   
   
   ## Checklist(Required)
   
   1. Does it affect the original behavior: 
       - [ ] Yes
       - [ ] No
       - [ ] I don't know
   2. Has unit tests been added:
       - [ ] Yes
       - [ ] No
       - [ ] No Need
   3. Has document been added or modified:
       - [ ] Yes
       - [ ] No
       - [ ] No Need
   4. Does it need to update dependencies:
       - [ ] Yes
       - [ ] No
   5. Are there any changes that cannot be rolled back:
       - [ ] Yes (If Yes, please explain WHY)
       - [ ] No
   
   ## Further comments
   
   If this is a relatively large or complex change, kick off the discussion at [dev@doris.apache.org](mailto:dev@doris.apache.org) by explaining why you chose the solution you did and what alternatives you considered, etc...
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] liutang123 commented on a diff in pull request #15124: [Pipeline] Add MLFQ when schedule

Posted by GitBox <gi...@apache.org>.
liutang123 commented on code in PR #15124:
URL: https://github.com/apache/doris/pull/15124#discussion_r1051381695


##########
be/src/pipeline/pipeline_fragment_context.cpp:
##########
@@ -512,12 +515,28 @@ Status PipelineFragmentContext::submit() {
     if (_submitted) {

Review Comment:
   At present, there is no logic to sbumit twice.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] github-actions[bot] commented on pull request #15124: [Pipeline] Add MLFQ when schedule

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #15124:
URL: https://github.com/apache/doris/pull/15124#issuecomment-1354158771

   clang-tidy review says "All clean, LGTM! :+1:"


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] github-actions[bot] commented on pull request #15124: [Pipeline] Add MLFQ when schedule

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #15124:
URL: https://github.com/apache/doris/pull/15124#issuecomment-1354607540

   clang-tidy review says "All clean, LGTM! :+1:"


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] github-actions[bot] commented on pull request #15124: [Pipeline] Add MLFQ when schedule

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #15124:
URL: https://github.com/apache/doris/pull/15124#issuecomment-1356167265

   clang-tidy review says "All clean, LGTM! :+1:"


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] HappenLee merged pull request #15124: [Pipeline] Add MLFQ when schedule

Posted by GitBox <gi...@apache.org>.
HappenLee merged PR #15124:
URL: https://github.com/apache/doris/pull/15124


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] Gabriel39 commented on a diff in pull request #15124: [Pipeline] Add MLFQ when schedule

Posted by GitBox <gi...@apache.org>.
Gabriel39 commented on code in PR #15124:
URL: https://github.com/apache/doris/pull/15124#discussion_r1050507505


##########
be/src/pipeline/pipeline_fragment_context.cpp:
##########
@@ -512,12 +515,28 @@ Status PipelineFragmentContext::submit() {
     if (_submitted) {

Review Comment:
   In which case this `submit` method will be called multiple times?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] HappenLee commented on a diff in pull request #15124: [Pipeline] Add MLFQ when schedule

Posted by GitBox <gi...@apache.org>.
HappenLee commented on code in PR #15124:
URL: https://github.com/apache/doris/pull/15124#discussion_r1051544229


##########
be/src/pipeline/task_queue.cpp:
##########
@@ -0,0 +1,192 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include "task_queue.h"
+
+namespace doris {
+namespace pipeline {
+
+PipelineTask* SubWorkTaskQueue::try_take() {
+    if (_queue.empty()) {
+        return nullptr;
+    }
+    ++_schedule_time;
+    auto task = _queue.front();
+    _queue.pop();
+    return task;
+}
+
+////////////////////  WorkTaskQueue ////////////////////
+
+WorkTaskQueue::WorkTaskQueue() : _closed(false) {
+    double factor = 1;
+    for (int i = 0; i < SUB_QUEUE_LEVEL; ++i) {
+        _sub_queues[i].set_factor_for_normal(factor);
+        factor *= LEVEL_QUEUE_TIME_FACTOR;
+    }
+
+    int i = 0;
+    _task_schedule_limit[i] = BASE_LIMIT * (i + 1);
+    for (i = 1; i < SUB_QUEUE_LEVEL - 1; ++i) {
+        _task_schedule_limit[i] = _task_schedule_limit[i - 1] + BASE_LIMIT * (i + 1);
+    }
+}
+
+void WorkTaskQueue::close() {
+    std::unique_lock<std::mutex> lock(_work_size_mutex);
+    _closed = true;
+    _wait_task.notify_all();
+}
+
+PipelineTask* WorkTaskQueue::try_take_unprotected() {
+    if (_total_task_size == 0 || _closed) {
+        return nullptr;
+    }
+    double normal_schedule_times[SUB_QUEUE_LEVEL];
+    double min_schedule_time = 0;
+    int idx = -1;
+    for (int i = 0; i < SUB_QUEUE_LEVEL; ++i) {
+        normal_schedule_times[i] = _sub_queues[i].schedule_time_after_normal();
+        if (!_sub_queues[i].empty()) {
+            if (idx == -1 || normal_schedule_times[i] < min_schedule_time) {
+                idx = i;
+                min_schedule_time = normal_schedule_times[i];
+            }
+        }
+    }
+    DCHECK(idx != -1);

Review Comment:
   if all `_sub_queue` is empty() ? the DCHECK may failed ?  



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] github-actions[bot] commented on pull request #15124: [Pipeline] Add MLFQ when schedule

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #15124:
URL: https://github.com/apache/doris/pull/15124#issuecomment-1357726820

   clang-tidy review says "All clean, LGTM! :+1:"


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] hello-stephen commented on pull request #15124: [Pipeline] Add MLFQ when schedule

Posted by GitBox <gi...@apache.org>.
hello-stephen commented on PR #15124:
URL: https://github.com/apache/doris/pull/15124#issuecomment-1354255551

   TeamCity pipeline, clickbench performance test result:
    the sum of best hot time: 35.48 seconds
    load time: 450 seconds
    storage size: 17123356938 Bytes
    https://doris-community-test-1308700295.cos.ap-hongkong.myqcloud.com/tmp/20221216055045_clickbench_pr_64271.html


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] github-actions[bot] commented on pull request #15124: [Pipeline] Add MLFQ when schedule

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #15124:
URL: https://github.com/apache/doris/pull/15124#issuecomment-1357725729

   clang-tidy review says "All clean, LGTM! :+1:"


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] github-actions[bot] commented on pull request #15124: [Pipeline] Add MLFQ when schedule

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #15124:
URL: https://github.com/apache/doris/pull/15124#issuecomment-1358766407

   PR approved by anyone and no changes requested.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] liutang123 commented on a diff in pull request #15124: [Pipeline] Add MLFQ when schedule

Posted by GitBox <gi...@apache.org>.
liutang123 commented on code in PR #15124:
URL: https://github.com/apache/doris/pull/15124#discussion_r1051589276


##########
be/src/pipeline/task_queue.cpp:
##########
@@ -0,0 +1,192 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include "task_queue.h"
+
+namespace doris {
+namespace pipeline {
+
+PipelineTask* SubWorkTaskQueue::try_take() {
+    if (_queue.empty()) {
+        return nullptr;
+    }
+    ++_schedule_time;
+    auto task = _queue.front();
+    _queue.pop();
+    return task;
+}
+
+////////////////////  WorkTaskQueue ////////////////////
+
+WorkTaskQueue::WorkTaskQueue() : _closed(false) {
+    double factor = 1;
+    for (int i = 0; i < SUB_QUEUE_LEVEL; ++i) {
+        _sub_queues[i].set_factor_for_normal(factor);
+        factor *= LEVEL_QUEUE_TIME_FACTOR;
+    }
+
+    int i = 0;
+    _task_schedule_limit[i] = BASE_LIMIT * (i + 1);
+    for (i = 1; i < SUB_QUEUE_LEVEL - 1; ++i) {
+        _task_schedule_limit[i] = _task_schedule_limit[i - 1] + BASE_LIMIT * (i + 1);
+    }
+}
+
+void WorkTaskQueue::close() {
+    std::unique_lock<std::mutex> lock(_work_size_mutex);
+    _closed = true;
+    _wait_task.notify_all();
+}
+
+PipelineTask* WorkTaskQueue::try_take_unprotected() {
+    if (_total_task_size == 0 || _closed) {
+        return nullptr;
+    }
+    double normal_schedule_times[SUB_QUEUE_LEVEL];
+    double min_schedule_time = 0;
+    int idx = -1;
+    for (int i = 0; i < SUB_QUEUE_LEVEL; ++i) {
+        normal_schedule_times[i] = _sub_queues[i].schedule_time_after_normal();
+        if (!_sub_queues[i].empty()) {
+            if (idx == -1 || normal_schedule_times[i] < min_schedule_time) {
+                idx = i;
+                min_schedule_time = normal_schedule_times[i];
+            }
+        }
+    }
+    DCHECK(idx != -1);

Review Comment:
   if `_total_task_size == 0`,  `nullptr` will return in the begin of this method.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] liutang123 commented on a diff in pull request #15124: [Pipeline] Add MLFQ when schedule

Posted by GitBox <gi...@apache.org>.
liutang123 commented on code in PR #15124:
URL: https://github.com/apache/doris/pull/15124#discussion_r1051381510


##########
be/src/runtime/fragment_mgr.cpp:
##########
@@ -763,13 +763,7 @@ Status FragmentMgr::exec_plan_fragment(const TExecPlanFragmentParams& params, Fi
             _pipeline_map.insert(std::make_pair(fragment_instance_id, context));
             _cv.notify_all();
         }
-        auto st = context->submit();

Review Comment:
   If task2 submit fail, `In PipelineFragmentContext::submit` will cancel the context and set `_total_tasks` to 1.
   If `_closed_tasks == _total_tasks` represents task1 is close, we try to exec `_close_action`.
   if `_closed_tasks != _total_tasks`, task1 will exec `_close_action`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] github-actions[bot] commented on pull request #15124: [Pipeline] Add MLFQ when schedule

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #15124:
URL: https://github.com/apache/doris/pull/15124#issuecomment-1354302705

   clang-tidy review says "All clean, LGTM! :+1:"


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] HappenLee commented on a diff in pull request #15124: [Pipeline] Add MLFQ when schedule

Posted by GitBox <gi...@apache.org>.
HappenLee commented on code in PR #15124:
URL: https://github.com/apache/doris/pull/15124#discussion_r1050780293


##########
be/src/pipeline/pipeline.cpp:
##########
@@ -30,6 +30,22 @@ Status Pipeline::prepare(RuntimeState* state) {
         RETURN_IF_ERROR(op->prepare(state));
     }
     RETURN_IF_ERROR(_sink->prepare(state));
+    std::stringstream sink_id_str;

Review Comment:
   use `fmt::format` replace `std::stringstream`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] Gabriel39 commented on a diff in pull request #15124: [Pipeline] Add MLFQ when schedule

Posted by GitBox <gi...@apache.org>.
Gabriel39 commented on code in PR #15124:
URL: https://github.com/apache/doris/pull/15124#discussion_r1050506071


##########
be/src/runtime/fragment_mgr.cpp:
##########
@@ -763,13 +763,7 @@ Status FragmentMgr::exec_plan_fragment(const TExecPlanFragmentParams& params, Fi
             _pipeline_map.insert(std::make_pair(fragment_instance_id, context));
             _cv.notify_all();
         }
-        auto st = context->submit();

Review Comment:
   Assume task1, task2, task3 exist in this context, if we submit task1 successfully and task2 failed, will submitted task1 be processed properly?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] github-actions[bot] commented on pull request #15124: [Pipeline] Add MLFQ when schedule

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #15124:
URL: https://github.com/apache/doris/pull/15124#issuecomment-1358766386

   PR approved by at least one committer and no changes requested.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org