-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
[fix](scanner) Fix incorrect _max_thread_num in scanner context when many queries are running. #41273
Conversation
Thank you for your contribution to Apache Doris. Since 2024-03-18, the Document has been moved to doris-website. |
run buildall |
almost same with #40569. |
TeamCity be ut coverage result: |
run buildall |
0925b96
to
c27cf18
Compare
run buildall |
TPC-H: Total hot run time: 41063 ms
|
TeamCity be ut coverage result: |
TPC-DS: Total hot run time: 191933 ms
|
ClickBench: Total hot run time: 32.74 s
|
run buildall |
TPC-H: Total hot run time: 40778 ms
|
TeamCity be ut coverage result: |
TPC-DS: Total hot run time: 190996 ms
|
ClickBench: Total hot run time: 32.26 s
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
PR approved by at least one committer and no changes requested. |
PR approved by anyone and no changes requested. |
c843245
to
2ab35e1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
run buildall |
2 similar comments
run buildall |
run buildall |
TeamCity be ut coverage result: |
f5855b7
to
b67039d
Compare
run buildall |
TeamCity be ut coverage result: |
b67039d
to
74c20dc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
run buildall |
TeamCity be ut coverage result: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
PR approved by at least one committer and no changes requested. |
…many queries are running. (apache#41273) 1. Minor refactor for scanner constructor, calculation of _max_thread_num is moved to init method 2. The expected value of _max_thread_num is changed. There is no need to submit too many scan task to scan scheduler, since thread num is limited. 3. Calculation of _max_bytes_in_queue is changed. _max_bytes_in_queue for each scan instance is limited to 100MB by default. ``` mysql [tpch]>select count(*) from supplier; -------------- select count(*) from supplier -------------- +----------+ | count(*) | +----------+ | 1000000 | +----------+ 1 row in set (0.04 sec) mysql [tpch]>select count(*) from revenue0; -------------- select count(*) from revenue0 -------------- +----------+ | count(*) | +----------+ | 1000000 | +----------+ 1 row in set (0.19 sec) ``` To illustrate the effect, we need to create much scanners, so ``` set global experimental_parallel_scan_min_rows_per_scanner=29715 ``` default value is `2097152`, we can make scanner num almost equal to `experimental_parallel_scan_max_scanners_count` which is 48. Lets use mysqlslap to do concurrent test. Current master: ```text [hezhiqiang@VM-10-8-centos be_1]$ mysqlslap -hxxxx -uroot -Pyyyy --create-schema=tpch -c 20 -i 5 -q "select s_suppkey, s_name, s_address, s_phone, total_revenue from supplier, revenue0 where s_suppkey = supplier_no and total_revenue = ( select max(total_revenue) from revenue0 ) order by s_suppkey;" Benchmark Average number of seconds to run all queries: 12.480 seconds Minimum number of seconds to run all queries: 12.159 seconds Maximum number of seconds to run all queries: 12.843 seconds Number of clients running queries: 20 Average number of queries per client: 1 [hezhiqiang@VM-10-8-centos be_1]$ mysqlslap -hyyyy -uroot -Pyyyy --create-schema=tpch -c 25 -i 5 -q "select s_suppkey, s_name, s_address, s_phone, total_revenue from supplier, revenue0 where s_suppkey = supplier_no and total_revenue = ( select max(total_revenue) from revenue0 ) order by s_suppkey;" mysqlslap: Cannot run query select s_suppkey, s_name, s_address, s_phone, total_revenue from supplier, revenue0 where s_suppkey = supplier_no and total_revenue = ( select max(total_revenue) from revenue0 ) order by s_suppkey; ERROR : errCode = 2, detailMessage = (10.16.10.8)[TOO_MANY_TASKS]Failed to submit scanner to scanner pool reason:Thread pool Scan_normal is at capacity (192/192 tasks running, 102400/102400 tasks queued)|type:0 ``` After this pr ``` [hezhiqiang@VM-10-8-centos lib]$ mysqlslap -hxxx -uroot -Pxxx --create-schema=tpch -c 50 -i 5 -q "select s_suppkey, s_name, s_address, s_phone, total_revenue from supplier, revenue0 where s_suppkey = supplier_no and total_revenue = ( select max(total_revenue) from revenue0 ) order by s_suppkey;" Benchmark Average number of seconds to run all queries: 31.520 seconds Minimum number of seconds to run all queries: 30.164 seconds Maximum number of seconds to run all queries: 34.131 seconds Number of clients running queries: 50 Average number of queries per client: 1 ``` The max concurrency increased from 25 to 50. Actually, for sequential query test, the performance does not decrease, `submit_many_scan_tasks_for_potential_performance_issue` can be remove in the future.
…many queries are running. (apache#41273) 1. Minor refactor for scanner constructor, calculation of _max_thread_num is moved to init method 2. The expected value of _max_thread_num is changed. There is no need to submit too many scan task to scan scheduler, since thread num is limited. 3. Calculation of _max_bytes_in_queue is changed. _max_bytes_in_queue for each scan instance is limited to 100MB by default. ``` mysql [tpch]>select count(*) from supplier; -------------- select count(*) from supplier -------------- +----------+ | count(*) | +----------+ | 1000000 | +----------+ 1 row in set (0.04 sec) mysql [tpch]>select count(*) from revenue0; -------------- select count(*) from revenue0 -------------- +----------+ | count(*) | +----------+ | 1000000 | +----------+ 1 row in set (0.19 sec) ``` To illustrate the effect, we need to create much scanners, so ``` set global experimental_parallel_scan_min_rows_per_scanner=29715 ``` default value is `2097152`, we can make scanner num almost equal to `experimental_parallel_scan_max_scanners_count` which is 48. Lets use mysqlslap to do concurrent test. Current master: ```text [hezhiqiang@VM-10-8-centos be_1]$ mysqlslap -hxxxx -uroot -Pyyyy --create-schema=tpch -c 20 -i 5 -q "select s_suppkey, s_name, s_address, s_phone, total_revenue from supplier, revenue0 where s_suppkey = supplier_no and total_revenue = ( select max(total_revenue) from revenue0 ) order by s_suppkey;" Benchmark Average number of seconds to run all queries: 12.480 seconds Minimum number of seconds to run all queries: 12.159 seconds Maximum number of seconds to run all queries: 12.843 seconds Number of clients running queries: 20 Average number of queries per client: 1 [hezhiqiang@VM-10-8-centos be_1]$ mysqlslap -hyyyy -uroot -Pyyyy --create-schema=tpch -c 25 -i 5 -q "select s_suppkey, s_name, s_address, s_phone, total_revenue from supplier, revenue0 where s_suppkey = supplier_no and total_revenue = ( select max(total_revenue) from revenue0 ) order by s_suppkey;" mysqlslap: Cannot run query select s_suppkey, s_name, s_address, s_phone, total_revenue from supplier, revenue0 where s_suppkey = supplier_no and total_revenue = ( select max(total_revenue) from revenue0 ) order by s_suppkey; ERROR : errCode = 2, detailMessage = (10.16.10.8)[TOO_MANY_TASKS]Failed to submit scanner to scanner pool reason:Thread pool Scan_normal is at capacity (192/192 tasks running, 102400/102400 tasks queued)|type:0 ``` After this pr ``` [hezhiqiang@VM-10-8-centos lib]$ mysqlslap -hxxx -uroot -Pxxx --create-schema=tpch -c 50 -i 5 -q "select s_suppkey, s_name, s_address, s_phone, total_revenue from supplier, revenue0 where s_suppkey = supplier_no and total_revenue = ( select max(total_revenue) from revenue0 ) order by s_suppkey;" Benchmark Average number of seconds to run all queries: 31.520 seconds Minimum number of seconds to run all queries: 30.164 seconds Maximum number of seconds to run all queries: 34.131 seconds Number of clients running queries: 50 Average number of queries per client: 1 ``` The max concurrency increased from 25 to 50. Actually, for sequential query test, the performance does not decrease, `submit_many_scan_tasks_for_potential_performance_issue` can be remove in the future.
To illustrate the effect, we need to create much scanners, so
default value is
2097152
, we can make scanner num almost equal toexperimental_parallel_scan_max_scanners_count
which is 48.Lets use mysqlslap to do concurrent test.
Current master:
After this pr
The max concurrency increased from 25 to 50.
Actually, for sequential query test, the performance does not decrease,
submit_many_scan_tasks_for_potential_performance_issue
can be remove in the future.