Skip to content

Conversation

@deardeng
Copy link
Contributor

@deardeng deardeng commented Mar 3, 2025

What problem does this PR solve?

Issue Number: close #xxx

Related PR: #xxx

Problem Summary:
Fix:
image

Prevent fe getbackendid from consuming too much CPU when high-frequency stream loads

  1. table2Group use newConcurrentMap,reduce lock usage
  2. Check the calling method of getBackendId function to prevent redundant calls

Release note

None

Check List (For Author)

  • Test

    • Regression test
    • Unit Test
    • Manual test (add detailed scripts or steps below)
    • No need to test or manual test. Explain why:
      • This is a refactor/code format and no logic has been changed.
      • Previous test can cover this change.
      • No code files have been changed.
      • Other reason
  • Behavior changed:

    • No.
    • Yes.
  • Does this need documentation?

    • No.
    • Yes.

Check List (For Reviewer who merge this PR)

  • Confirm the release note
  • Confirm test cases
  • Confirm document
  • Add branch pick label

@hello-stephen
Copy link
Contributor

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

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@deardeng
Copy link
Contributor Author

deardeng commented Mar 3, 2025

run buildall

@dataroaring dataroaring added usercase Important user case type label dev/3.0.x labels Mar 3, 2025
@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17627	5312	5115	5115
q2	2048	304	168	168
q3	10403	1334	724	724
q4	10219	1012	538	538
q5	7518	2421	2338	2338
q6	194	167	137	137
q7	922	756	629	629
q8	9328	1272	1082	1082
q9	5108	4960	4572	4572
q10	6824	2305	1936	1936
q11	476	272	255	255
q12	347	365	217	217
q13	17750	3723	3091	3091
q14	236	226	208	208
q15	520	502	480	480
q16	617	610	582	582
q17	586	883	343	343
q18	6594	6224	6239	6224
q19	1211	951	522	522
q20	318	328	199	199
q21	2882	2183	1990	1990
q22	364	337	301	301
Total cold run time: 102092 ms
Total hot run time: 31651 ms

----- Round 2, with runtime_filter_mode=off -----
q1	5277	5127	5131	5127
q2	245	341	240	240
q3	2169	2680	2288	2288
q4	1449	1792	1349	1349
q5	4214	4119	4158	4119
q6	214	163	125	125
q7	1908	1837	1708	1708
q8	2617	2523	2532	2523
q9	7321	7103	7151	7103
q10	2988	3232	2787	2787
q11	563	508	492	492
q12	660	759	596	596
q13	3518	3891	3299	3299
q14	296	312	294	294
q15	524	471	457	457
q16	640	684	660	660
q17	1156	1617	1358	1358
q18	7615	7417	7335	7335
q19	806	830	916	830
q20	1996	2023	1873	1873
q21	5468	4905	4879	4879
q22	684	590	553	553
Total cold run time: 52328 ms
Total hot run time: 49995 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 184259 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 edf66330e095e1ce9ead351e114ebe8aef8fb08a, data reload: false

query1	981	375	382	375
query2	6525	1980	1924	1924
query3	6795	208	209	208
query4	26155	23701	22850	22850
query5	4311	664	518	518
query6	307	197	186	186
query7	4605	490	292	292
query8	299	243	237	237
query9	8621	2538	2545	2538
query10	488	328	261	261
query11	15787	15124	14903	14903
query12	154	108	111	108
query13	1656	531	386	386
query14	9773	6580	6393	6393
query15	212	198	180	180
query16	7151	610	427	427
query17	1206	723	569	569
query18	1959	408	305	305
query19	198	186	187	186
query20	122	113	114	113
query21	213	127	103	103
query22	4117	4436	4320	4320
query23	34077	32919	32964	32919
query24	7737	2395	2385	2385
query25	518	466	391	391
query26	1264	268	152	152
query27	2118	510	333	333
query28	3890	2394	2372	2372
query29	760	562	414	414
query30	233	187	156	156
query31	920	855	818	818
query32	79	63	67	63
query33	566	358	303	303
query34	801	854	511	511
query35	811	824	734	734
query36	982	1041	905	905
query37	126	96	88	88
query38	4214	4281	4161	4161
query39	1454	1448	1395	1395
query40	212	120	103	103
query41	55	52	52	52
query42	129	104	114	104
query43	497	523	507	507
query44	1317	800	782	782
query45	178	166	161	161
query46	896	1039	653	653
query47	1762	1791	1719	1719
query48	374	408	301	301
query49	797	527	413	413
query50	681	741	406	406
query51	4160	4211	4202	4202
query52	110	110	98	98
query53	253	264	186	186
query54	503	485	423	423
query55	84	78	80	78
query56	283	274	271	271
query57	1140	1118	1086	1086
query58	258	231	247	231
query59	2660	2845	2614	2614
query60	282	286	264	264
query61	120	122	117	117
query62	800	774	660	660
query63	237	195	195	195
query64	4411	1000	668	668
query65	3245	3138	3165	3138
query66	1133	414	312	312
query67	15812	15493	15270	15270
query68	8157	883	510	510
query69	470	302	274	274
query70	1192	1106	1122	1106
query71	462	298	281	281
query72	5637	3582	3740	3582
query73	790	766	359	359
query74	9261	9233	9129	9129
query75	3767	3209	2755	2755
query76	3697	1167	756	756
query77	778	370	286	286
query78	9971	10216	9258	9258
query79	2344	954	589	589
query80	607	515	434	434
query81	501	281	254	254
query82	658	129	99	99
query83	174	179	158	158
query84	230	97	78	78
query85	780	359	304	304
query86	356	305	273	273
query87	4381	4560	4303	4303
query88	3023	2231	2207	2207
query89	398	321	293	293
query90	1946	199	195	195
query91	144	140	120	120
query92	75	64	59	59
query93	1152	1051	562	562
query94	674	414	295	295
query95	360	276	262	262
query96	488	546	267	267
query97	3245	3402	3282	3282
query98	222	201	208	201
query99	1335	1411	1232	1232
Total cold run time: 271849 ms
Total hot run time: 184259 ms

@doris-robot
Copy link

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

query1	0.04	0.05	0.04
query2	0.07	0.03	0.03
query3	0.23	0.08	0.06
query4	1.61	0.11	0.09
query5	0.55	0.54	0.54
query6	1.21	0.72	0.71
query7	0.02	0.02	0.02
query8	0.05	0.04	0.03
query9	0.56	0.56	0.52
query10	0.57	0.57	0.57
query11	0.16	0.10	0.10
query12	0.15	0.11	0.11
query13	0.62	0.61	0.59
query14	2.68	2.74	2.69
query15	0.92	0.85	0.86
query16	0.37	0.40	0.40
query17	1.00	1.01	1.02
query18	0.22	0.19	0.19
query19	1.88	1.81	1.97
query20	0.02	0.02	0.01
query21	15.39	0.92	0.55
query22	0.74	1.23	0.80
query23	14.78	1.38	0.64
query24	7.08	1.79	0.49
query25	0.55	0.27	0.11
query26	0.70	0.16	0.14
query27	0.05	0.04	0.04
query28	9.00	0.91	0.42
query29	12.54	4.00	3.30
query30	0.25	0.09	0.07
query31	2.83	0.59	0.39
query32	3.23	0.56	0.46
query33	3.00	2.99	3.04
query34	15.82	5.14	4.53
query35	4.52	4.52	4.53
query36	0.66	0.50	0.48
query37	0.09	0.06	0.07
query38	0.05	0.04	0.03
query39	0.03	0.03	0.02
query40	0.17	0.14	0.14
query41	0.08	0.03	0.02
query42	0.04	0.03	0.02
query43	0.03	0.03	0.03
Total cold run time: 104.56 s
Total hot run time: 30.62 s

@gavinchou gavinchou added the p0_c label Mar 10, 2025
@gavinchou gavinchou changed the title [fix][cloud] Prevent fe CloudReplica.getBackendIdImpl consuming too m… [fix][cloud] Prevent fe CloudReplica.getBackendIdImpl consuming too much CPU when high-frequency stream loads Mar 10, 2025
@github-actions
Copy link
Contributor

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

@github-actions github-actions bot added approved Indicates a PR has been approved by one committer. reviewed labels Mar 10, 2025
@github-actions
Copy link
Contributor

PR approved by anyone and no changes requested.

@dataroaring
Copy link
Contributor

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17583	5594	5431	5431
q2	2055	298	179	179
q3	10395	1235	755	755
q4	10205	992	529	529
q5	7530	2378	2344	2344
q6	191	168	130	130
q7	897	753	592	592
q8	9304	1267	1075	1075
q9	4894	4695	4606	4606
q10	6800	2289	1872	1872
q11	462	270	266	266
q12	358	343	210	210
q13	17738	3703	3101	3101
q14	242	228	203	203
q15	526	480	493	480
q16	645	622	570	570
q17	576	855	347	347
q18	6752	6543	6334	6334
q19	1243	953	577	577
q20	325	332	201	201
q21	2821	2126	1930	1930
q22	1026	1029	950	950
Total cold run time: 102568 ms
Total hot run time: 32682 ms

----- Round 2, with runtime_filter_mode=off -----
q1	5588	5539	5525	5525
q2	230	320	232	232
q3	2177	2650	2299	2299
q4	1409	1840	1330	1330
q5	4209	4154	4163	4154
q6	210	163	122	122
q7	1987	2008	1818	1818
q8	2647	2604	2576	2576
q9	7496	7417	7255	7255
q10	3105	3255	2770	2770
q11	599	512	504	504
q12	649	766	585	585
q13	3630	3922	3282	3282
q14	286	317	278	278
q15	531	484	485	484
q16	671	698	649	649
q17	1151	1568	1376	1376
q18	7800	7650	7506	7506
q19	845	919	1324	919
q20	1982	2037	1898	1898
q21	5565	4943	4894	4894
q22	1113	1090	993	993
Total cold run time: 53880 ms
Total hot run time: 51449 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 191661 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 9ac3e87eb50da7023ba49f820efe05cc49efc3f9, data reload: false

query1	1397	999	1005	999
query2	6095	1956	1981	1956
query3	11157	4639	4611	4611
query4	25664	23516	22986	22986
query5	3606	638	466	466
query6	279	204	185	185
query7	3986	529	297	297
query8	303	263	232	232
query9	8473	2581	2596	2581
query10	443	306	246	246
query11	15417	15216	15300	15216
query12	163	116	105	105
query13	1541	526	385	385
query14	8651	6161	6184	6161
query15	203	189	179	179
query16	7212	653	459	459
query17	1189	712	576	576
query18	1956	438	327	327
query19	219	195	164	164
query20	134	126	123	123
query21	202	124	114	114
query22	4588	4881	4420	4420
query23	34356	33705	33350	33350
query24	8544	2449	2424	2424
query25	528	508	446	446
query26	1174	283	162	162
query27	2903	576	353	353
query28	4441	2432	2421	2421
query29	751	587	421	421
query30	272	224	197	197
query31	928	875	767	767
query32	72	64	66	64
query33	528	349	298	298
query34	800	850	499	499
query35	801	846	760	760
query36	993	1039	918	918
query37	119	105	74	74
query38	4359	4207	4233	4207
query39	1488	1438	1436	1436
query40	216	117	102	102
query41	51	51	49	49
query42	115	103	103	103
query43	513	527	466	466
query44	1287	802	790	790
query45	174	179	164	164
query46	839	1029	651	651
query47	1841	1887	1804	1804
query48	397	418	313	313
query49	757	525	428	428
query50	709	753	412	412
query51	4299	4291	4264	4264
query52	100	105	102	102
query53	239	253	190	190
query54	499	483	440	440
query55	78	80	77	77
query56	267	269	257	257
query57	1178	1210	1099	1099
query58	248	241	253	241
query59	2886	2978	2929	2929
query60	285	280	273	273
query61	138	120	115	115
query62	792	711	674	674
query63	229	189	193	189
query64	4227	1015	733	733
query65	4567	4513	4505	4505
query66	1205	404	298	298
query67	16453	15528	15145	15145
query68	9175	866	502	502
query69	429	284	256	256
query70	1225	1090	1109	1090
query71	462	286	274	274
query72	5083	3546	3701	3546
query73	638	712	357	357
query74	9025	9193	8708	8708
query75	4097	3137	2682	2682
query76	4309	1171	738	738
query77	915	362	268	268
query78	9864	10007	9324	9324
query79	3307	822	573	573
query80	581	517	440	440
query81	473	257	217	217
query82	250	131	94	94
query83	161	172	150	150
query84	284	91	77	77
query85	746	342	307	307
query86	333	378	273	273
query87	4459	4526	4406	4406
query88	2862	2220	2211	2211
query89	405	307	277	277
query90	2178	203	207	203
query91	138	131	106	106
query92	69	59	57	57
query93	2355	1020	579	579
query94	658	402	300	300
query95	342	253	348	253
query96	476	557	266	266
query97	3235	3438	3258	3258
query98	225	205	195	195
query99	1352	1395	1276	1276
Total cold run time: 280635 ms
Total hot run time: 191661 ms

@doris-robot
Copy link

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

query1	0.04	0.03	0.02
query2	0.07	0.03	0.04
query3	0.23	0.06	0.06
query4	1.62	0.11	0.10
query5	0.57	0.56	0.54
query6	1.21	0.71	0.71
query7	0.02	0.02	0.02
query8	0.04	0.03	0.03
query9	0.58	0.52	0.52
query10	0.58	0.61	0.58
query11	0.16	0.12	0.10
query12	0.15	0.12	0.11
query13	0.61	0.61	0.60
query14	2.67	2.67	2.69
query15	0.93	0.86	0.85
query16	0.39	0.39	0.38
query17	1.03	1.10	1.06
query18	0.21	0.20	0.19
query19	1.96	1.89	1.94
query20	0.02	0.01	0.01
query21	15.39	0.93	0.55
query22	0.76	1.15	0.69
query23	14.86	1.37	0.62
query24	6.64	1.68	1.83
query25	0.48	0.25	0.08
query26	0.65	0.16	0.14
query27	0.05	0.05	0.05
query28	9.32	0.85	0.44
query29	12.51	4.05	3.33
query30	0.25	0.09	0.06
query31	2.82	0.59	0.39
query32	3.23	0.54	0.47
query33	2.98	3.05	3.01
query34	15.79	5.13	4.57
query35	4.55	4.55	4.59
query36	0.66	0.49	0.49
query37	0.09	0.06	0.06
query38	0.05	0.04	0.04
query39	0.03	0.02	0.02
query40	0.18	0.14	0.12
query41	0.09	0.02	0.02
query42	0.04	0.02	0.02
query43	0.04	0.04	0.03
Total cold run time: 104.55 s
Total hot run time: 31.9 s

@dataroaring dataroaring merged commit be92883 into apache:master Mar 13, 2025
28 of 34 checks passed
deardeng added a commit to deardeng/incubator-doris that referenced this pull request Mar 15, 2025
dataroaring pushed a commit that referenced this pull request Mar 17, 2025
…suming too much CPU when high-frequency stream loads #48564 (#49108)

cherry pick from #48564
dataroaring pushed a commit that referenced this pull request Mar 18, 2025
github-actions bot pushed a commit that referenced this pull request Mar 18, 2025
csun5285 pushed a commit to csun5285/doris that referenced this pull request Mar 28, 2025
csun5285 pushed a commit to csun5285/doris that referenced this pull request Mar 28, 2025
@gavinchou gavinchou mentioned this pull request Apr 23, 2025
koarz pushed a commit to koarz/doris that referenced this pull request Jun 4, 2025
koarz pushed a commit to koarz/doris that referenced this pull request Jun 4, 2025
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/3.0.5-merged p0_c reviewed usercase Important user case type label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants