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

[opt](coord) use single instance only with small limit #33888

Merged
merged 2 commits into from
Apr 19, 2024

Conversation

morningman
Copy link
Contributor

@morningman morningman commented Apr 19, 2024

Proposed changes

Followup #31342
When executing simple query like select * from tbl limit 1.
Doris will use only one instance for each scan node, to reduce the fan-out of simple queries.
But if the limit number is large, eg, 1 billion, this logic is not suitable.

So I add a new session variable limit_rows_for_single_instance, default is 10000.
Only if the limit number is lower than this value, Doris will use one instance for scan node.

Further comments

If this is a relatively large or complex change, kick off the discussion at [email protected] by explaining why you chose the solution you did and what alternatives you considered, etc...

@doris-robot
Copy link

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR

Since 2024-03-18, the Document has been moved to doris-website.
See Doris Document.

@morningman
Copy link
Contributor Author

run buildall

HappenLee
HappenLee previously approved these changes Apr 19, 2024
Copy link
Contributor

@HappenLee HappenLee left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

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

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Apr 19, 2024
Copy link
Contributor

PR approved by anyone and no changes requested.

yiguolei
yiguolei previously approved these changes Apr 19, 2024
Copy link
Contributor

@yiguolei yiguolei left a comment

Choose a reason for hiding this comment

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

LGTM

@doris-robot
Copy link

TPC-H: Total hot run time: 38386 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 2cb70e547a803e895203f95ab72a13d01e1963a0, data reload: false

------ Round 1 ----------------------------------
q1	17595	4623	4222	4222
q2	2019	188	193	188
q3	10451	1143	1202	1143
q4	10199	870	744	744
q5	7494	2714	2640	2640
q6	217	137	140	137
q7	1021	621	589	589
q8	9214	2084	2027	2027
q9	7282	6592	6562	6562
q10	8512	3486	3503	3486
q11	442	227	228	227
q12	445	234	219	219
q13	17772	2939	2968	2939
q14	271	224	232	224
q15	521	476	474	474
q16	518	384	374	374
q17	958	734	697	697
q18	7470	6983	6609	6609
q19	7042	1487	1446	1446
q20	644	326	301	301
q21	3446	2826	2847	2826
q22	380	312	320	312
Total cold run time: 113913 ms
Total hot run time: 38386 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4427	4202	4162	4162
q2	377	258	265	258
q3	2989	2749	2703	2703
q4	1916	1562	1578	1562
q5	5393	5395	5309	5309
q6	206	124	124	124
q7	2256	1879	1871	1871
q8	3210	3352	3339	3339
q9	8631	8609	8718	8609
q10	4099	3911	4049	3911
q11	597	491	495	491
q12	781	656	622	622
q13	17262	3185	3134	3134
q14	327	276	275	275
q15	496	486	485	485
q16	507	438	435	435
q17	1813	1557	1508	1508
q18	8185	7980	7905	7905
q19	1670	1531	1542	1531
q20	2065	1858	1808	1808
q21	8648	4881	5001	4881
q22	550	471	476	471
Total cold run time: 76405 ms
Total hot run time: 55394 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 184048 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit 2cb70e547a803e895203f95ab72a13d01e1963a0, data reload: false

query1	897	364	360	360
query2	7362	2641	2520	2520
query3	6650	214	205	205
query4	22555	21204	21230	21204
query5	4144	407	402	402
query6	264	172	181	172
query7	4584	293	286	286
query8	247	185	192	185
query9	8512	2296	2279	2279
query10	409	245	254	245
query11	14746	14191	14181	14181
query12	130	87	94	87
query13	1649	381	374	374
query14	9929	7303	7417	7303
query15	238	191	177	177
query16	8138	261	261	261
query17	1913	556	540	540
query18	2070	268	262	262
query19	196	144	149	144
query20	88	81	83	81
query21	197	126	122	122
query22	4971	4825	4792	4792
query23	34001	33037	33125	33037
query24	10554	3014	3000	3000
query25	608	378	388	378
query26	708	158	152	152
query27	2456	363	373	363
query28	6027	2056	2081	2056
query29	894	604	606	604
query30	313	181	185	181
query31	1014	784	759	759
query32	95	53	56	53
query33	676	265	263	263
query34	898	487	489	487
query35	857	716	689	689
query36	1108	908	925	908
query37	120	73	75	73
query38	3496	3350	3312	3312
query39	1613	1573	1583	1573
query40	183	134	124	124
query41	51	45	46	45
query42	110	103	99	99
query43	600	544	545	544
query44	1113	744	749	744
query45	296	268	259	259
query46	1088	727	704	704
query47	1991	1902	1927	1902
query48	382	292	306	292
query49	832	424	420	420
query50	802	420	411	411
query51	7062	6870	6837	6837
query52	108	82	91	82
query53	343	279	273	273
query54	297	230	229	229
query55	81	72	71	71
query56	240	219	228	219
query57	1229	1120	1122	1120
query58	212	200	206	200
query59	3554	3318	3137	3137
query60	250	232	232	232
query61	86	85	88	85
query62	595	439	434	434
query63	304	278	274	274
query64	5028	4159	3087	3087
query65	3073	3006	3001	3001
query66	764	333	337	333
query67	15453	14971	15145	14971
query68	6736	538	546	538
query69	543	308	301	301
query70	1229	1200	1101	1101
query71	1448	1269	1328	1269
query72	6314	2592	2438	2438
query73	717	316	319	316
query74	6805	6357	6433	6357
query75	3837	2652	2622	2622
query76	4357	924	891	891
query77	696	270	266	266
query78	10791	10231	10133	10133
query79	7603	516	516	516
query80	1510	433	430	430
query81	527	246	240	240
query82	1342	100	94	94
query83	205	172	165	165
query84	268	81	81	81
query85	1223	275	263	263
query86	456	293	313	293
query87	3481	3275	3265	3265
query88	4735	2323	2344	2323
query89	504	366	370	366
query90	1934	185	184	184
query91	124	97	97	97
query92	56	46	47	46
query93	6352	515	516	515
query94	1065	180	179	179
query95	386	303	302	302
query96	608	266	262	262
query97	3171	2938	2936	2936
query98	233	217	220	217
query99	1205	844	843	843
Total cold run time: 291915 ms
Total hot run time: 184048 ms

@doris-robot
Copy link

ClickBench: Total hot run time: 29.97 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 2cb70e547a803e895203f95ab72a13d01e1963a0, data reload: false

query1	0.04	0.03	0.04
query2	0.08	0.04	0.04
query3	0.23	0.04	0.05
query4	1.69	0.08	0.08
query5	0.50	0.48	0.51
query6	1.46	0.72	0.71
query7	0.02	0.01	0.01
query8	0.04	0.04	0.04
query9	0.56	0.48	0.50
query10	0.55	0.56	0.52
query11	0.14	0.11	0.12
query12	0.15	0.12	0.12
query13	0.60	0.57	0.57
query14	0.78	0.79	0.78
query15	0.82	0.80	0.80
query16	0.35	0.36	0.36
query17	0.97	1.02	0.94
query18	0.20	0.28	0.22
query19	1.78	1.66	1.67
query20	0.02	0.01	0.01
query21	15.40	0.66	0.66
query22	4.30	7.50	1.71
query23	18.29	1.29	1.27
query24	1.90	0.20	0.20
query25	0.14	0.08	0.09
query26	0.26	0.17	0.17
query27	0.08	0.08	0.08
query28	13.40	1.01	0.98
query29	12.54	3.28	3.23
query30	0.26	0.07	0.06
query31	2.87	0.38	0.38
query32	3.28	0.47	0.47
query33	2.79	2.88	2.84
query34	17.23	4.39	4.44
query35	4.46	4.41	4.52
query36	0.66	0.46	0.46
query37	0.19	0.16	0.16
query38	0.15	0.14	0.14
query39	0.04	0.03	0.04
query40	0.18	0.14	0.13
query41	0.08	0.05	0.04
query42	0.06	0.05	0.05
query43	0.04	0.04	0.03
Total cold run time: 109.58 s
Total hot run time: 29.97 s

@xiaokang xiaokang added the usercase Important user case type label label Apr 19, 2024
@morningman morningman marked this pull request as draft April 19, 2024 10:38
@morningman morningman dismissed stale reviews from yiguolei and HappenLee via 3f98fed April 19, 2024 10:41
@morningman morningman marked this pull request as ready for review April 19, 2024 10:41
@morningman
Copy link
Contributor Author

run buildall

@github-actions github-actions bot removed the approved Indicates a PR has been approved by one committer. label Apr 19, 2024
morningman added a commit to morningman/doris that referenced this pull request Apr 19, 2024
@doris-robot
Copy link

TPC-H: Total hot run time: 38498 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 3f98fedf4d7a002f227c68586f29f8ddbabd55bc, data reload: false

------ Round 1 ----------------------------------
q1	17962	4481	4260	4260
q2	2012	190	192	190
q3	10449	1154	1207	1154
q4	10200	860	844	844
q5	7524	2704	2651	2651
q6	219	133	134	133
q7	1004	607	593	593
q8	9223	2055	2027	2027
q9	7432	6604	6542	6542
q10	8473	3543	3539	3539
q11	436	237	237	237
q12	387	219	215	215
q13	17764	2952	2942	2942
q14	275	235	227	227
q15	524	497	479	479
q16	521	380	373	373
q17	965	609	629	609
q18	7407	6746	6656	6656
q19	1582	1490	1532	1490
q20	647	316	297	297
q21	3551	2724	2823	2724
q22	366	316	319	316
Total cold run time: 108923 ms
Total hot run time: 38498 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4261	4219	4262	4219
q2	368	277	273	273
q3	3018	2729	2729	2729
q4	1845	1639	1617	1617
q5	5297	5335	5326	5326
q6	209	123	126	123
q7	2234	1854	1894	1854
q8	3173	3398	3384	3384
q9	8590	8563	8568	8563
q10	3934	3711	3727	3711
q11	584	502	481	481
q12	758	570	569	569
q13	17261	2941	3000	2941
q14	322	272	296	272
q15	503	469	461	461
q16	477	422	415	415
q17	1793	1459	1476	1459
q18	7505	7370	7372	7370
q19	1616	1518	1517	1517
q20	1949	1753	1733	1733
q21	4844	4740	4889	4740
q22	524	474	480	474
Total cold run time: 71065 ms
Total hot run time: 54231 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 184285 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit 3f98fedf4d7a002f227c68586f29f8ddbabd55bc, data reload: false

query1	909	378	369	369
query2	6467	2626	2442	2442
query3	6659	216	218	216
query4	24662	21604	21249	21249
query5	4174	408	404	404
query6	261	180	170	170
query7	4584	285	286	285
query8	251	202	184	184
query9	8383	2315	2296	2296
query10	566	256	247	247
query11	14687	14251	14225	14225
query12	137	95	88	88
query13	1652	364	361	361
query14	9477	7596	7756	7596
query15	262	180	185	180
query16	8148	260	260	260
query17	1931	574	544	544
query18	2099	282	285	282
query19	276	146	149	146
query20	89	83	86	83
query21	202	126	121	121
query22	5003	4885	4859	4859
query23	33765	33074	33041	33041
query24	11951	3004	2953	2953
query25	654	364	369	364
query26	1755	152	145	145
query27	3049	314	308	308
query28	7682	2013	1983	1983
query29	1017	603	589	589
query30	308	175	173	173
query31	964	725	735	725
query32	89	54	56	54
query33	735	260	245	245
query34	1066	479	475	475
query35	841	704	691	691
query36	1065	872	877	872
query37	289	71	68	68
query38	3342	3139	3185	3139
query39	1705	1529	1551	1529
query40	267	127	127	127
query41	45	44	42	42
query42	103	95	97	95
query43	583	539	566	539
query44	1194	719	732	719
query45	290	270	267	267
query46	1080	730	753	730
query47	1903	1859	1858	1858
query48	358	290	295	290
query49	1163	386	381	381
query50	748	389	381	381
query51	6755	6611	6675	6611
query52	98	92	85	85
query53	355	294	282	282
query54	312	223	239	223
query55	77	73	71	71
query56	239	216	223	216
query57	1232	1123	1120	1120
query58	217	198	194	194
query59	3318	3256	3153	3153
query60	280	227	246	227
query61	88	87	90	87
query62	646	434	440	434
query63	305	276	273	273
query64	6226	3998	3702	3702
query65	3160	3068	3053	3053
query66	1388	364	410	364
query67	15316	14920	15313	14920
query68	5183	533	534	533
query69	481	305	304	304
query70	1234	1097	1217	1097
query71	1410	1267	1260	1260
query72	6552	2646	2419	2419
query73	703	317	315	315
query74	7073	6435	6499	6435
query75	3486	2644	2620	2620
query76	3319	992	954	954
query77	399	263	265	263
query78	10905	10349	10125	10125
query79	2739	528	524	524
query80	2009	424	415	415
query81	537	244	242	242
query82	852	99	97	97
query83	285	165	172	165
query84	267	82	86	82
query85	2143	261	259	259
query86	532	307	290	290
query87	3463	3272	3265	3265
query88	4451	2317	2316	2316
query89	476	376	361	361
query90	2067	184	178	178
query91	125	93	101	93
query92	61	47	47	47
query93	4208	530	512	512
query94	1250	179	179	179
query95	375	312	304	304
query96	611	262	268	262
query97	3094	2926	2964	2926
query98	242	215	262	215
query99	1255	823	846	823
Total cold run time: 290689 ms
Total hot run time: 184285 ms

@doris-robot
Copy link

ClickBench: Total hot run time: 30.07 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 3f98fedf4d7a002f227c68586f29f8ddbabd55bc, data reload: false

query1	0.04	0.03	0.03
query2	0.07	0.04	0.04
query3	0.23	0.05	0.05
query4	1.68	0.07	0.06
query5	0.51	0.49	0.49
query6	1.44	0.71	0.72
query7	0.02	0.01	0.02
query8	0.05	0.04	0.04
query9	0.54	0.48	0.49
query10	0.53	0.56	0.53
query11	0.16	0.11	0.12
query12	0.15	0.12	0.11
query13	0.60	0.60	0.59
query14	0.75	0.79	0.77
query15	0.82	0.80	0.81
query16	0.38	0.37	0.35
query17	0.94	0.98	0.99
query18	0.20	0.25	0.22
query19	1.77	1.82	1.70
query20	0.02	0.01	0.01
query21	15.40	0.66	0.65
query22	4.77	7.22	1.73
query23	18.31	1.31	1.30
query24	2.00	0.21	0.21
query25	0.15	0.10	0.08
query26	0.26	0.18	0.17
query27	0.08	0.07	0.08
query28	13.28	1.00	0.98
query29	12.64	3.25	3.21
query30	0.26	0.07	0.06
query31	2.85	0.37	0.38
query32	3.28	0.47	0.46
query33	2.86	2.81	2.82
query34	17.19	4.39	4.43
query35	4.44	4.50	4.45
query36	0.65	0.46	0.46
query37	0.18	0.15	0.15
query38	0.15	0.14	0.14
query39	0.05	0.04	0.03
query40	0.17	0.14	0.14
query41	0.09	0.05	0.05
query42	0.06	0.04	0.04
query43	0.04	0.04	0.04
Total cold run time: 110.06 s
Total hot run time: 30.07 s

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Apr 19, 2024
Copy link
Contributor

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

@yiguolei yiguolei merged commit b840c66 into apache:master Apr 19, 2024
27 of 31 checks passed
liaoxin01 added a commit to liaoxin01/doris that referenced this pull request Apr 23, 2024
mongo360 pushed a commit to mongo360/doris that referenced this pull request Aug 16, 2024
yiguolei pushed a commit that referenced this pull request Sep 4, 2024
… limit involved (#39927)

For queries like `select * from tbl limit 100;`, we should limit the
parallelism to 1.

We already have strategies in our code, but we can not control its
behavior. So add session variables to control them.

Previous pr like #33888 #36535 already has done something similar, this
pr integrates them.
zhiqiang-hhhh added a commit to zhiqiang-hhhh/doris that referenced this pull request Sep 4, 2024
… limit involved (apache#39927)

For queries like `select * from tbl limit 100;`, we should limit the
parallelism to 1.

We already have strategies in our code, but we can not control its
behavior. So add session variables to control them.

Previous pr like apache#33888 apache#36535 already has done something similar, this
pr integrates them.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by one committer. dev/2.0.9-merged dev/2.1.3-merged reviewed usercase Important user case type label
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants