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](profile) Avoid unnecessary copies in the profile thrift. #34720

Merged
merged 1 commit into from May 22, 2024

Conversation

Mryange
Copy link
Contributor

@Mryange Mryange commented May 11, 2024

Proposed changes

need this pr
#34693

before

Create report exec status params cost 631.780ms
Create report exec status params cost 629.973ms

Getting realtime exec status cost 2s253ms
Getting realtime exec status cost 2s365ms
Getting realtime exec status cost 2s741ms

now

Create report exec status params cost 149.688ms
Create report exec status params cost 185.920ms

Getting realtime exec status cost 1s594ms
Getting realtime exec status cost 1s703ms
Getting realtime exec status cost 1s477ms

Further comments

If this is a relatively large or complex change, kick off the discussion at dev@doris.apache.org 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.

@Mryange
Copy link
Contributor Author

Mryange commented May 11, 2024

run buildall

Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17617	4494	4313	4313
q2	2036	198	202	198
q3	10721	1292	1212	1212
q4	10601	862	786	786
q5	7659	2769	2841	2769
q6	223	136	139	136
q7	1024	623	597	597
q8	9555	2164	2129	2129
q9	9358	6788	6700	6700
q10	9016	3720	3731	3720
q11	440	253	249	249
q12	431	232	230	230
q13	17755	2978	2980	2978
q14	259	207	234	207
q15	516	459	473	459
q16	523	387	391	387
q17	990	678	730	678
q18	8079	7551	7460	7460
q19	3041	1569	1511	1511
q20	644	308	314	308
q21	5209	4022	4145	4022
q22	347	282	309	282
Total cold run time: 116044 ms
Total hot run time: 41331 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4356	4225	4235	4225
q2	370	274	286	274
q3	3003	2846	2800	2800
q4	1901	1603	1623	1603
q5	5325	5322	5353	5322
q6	211	127	129	127
q7	2270	1848	1906	1848
q8	3243	3381	3411	3381
q9	8427	8407	8452	8407
q10	3920	3681	3708	3681
q11	588	490	490	490
q12	760	579	602	579
q13	16407	2997	2971	2971
q14	291	262	273	262
q15	540	474	471	471
q16	482	417	417	417
q17	1762	1508	1489	1489
q18	7671	7510	7543	7510
q19	1670	1573	1561	1561
q20	1939	1753	1786	1753
q21	5135	4850	4982	4850
q22	575	494	510	494
Total cold run time: 70846 ms
Total hot run time: 54515 ms

@doris-robot
Copy link

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

query1	916	393	371	371
query2	6462	2393	2281	2281
query3	6655	203	204	203
query4	23334	21530	21475	21475
query5	4188	424	419	419
query6	269	180	171	171
query7	4592	294	291	291
query8	240	187	188	187
query9	8561	2409	2385	2385
query10	438	254	264	254
query11	14856	14274	14285	14274
query12	139	96	95	95
query13	1642	379	378	378
query14	9049	7856	8671	7856
query15	241	180	165	165
query16	7916	259	266	259
query17	1834	567	559	559
query18	1604	292	289	289
query19	210	147	145	145
query20	95	94	88	88
query21	201	139	131	131
query22	5080	4885	4858	4858
query23	34355	33653	33550	33550
query24	11813	2899	2929	2899
query25	645	367	365	365
query26	1819	165	157	157
query27	3037	326	339	326
query28	7556	2088	2095	2088
query29	997	628	609	609
query30	310	159	164	159
query31	937	754	747	747
query32	99	53	55	53
query33	743	250	260	250
query34	1032	486	507	486
query35	919	737	711	711
query36	1077	903	909	903
query37	173	69	69	69
query38	2901	2752	2747	2747
query39	1631	1578	1562	1562
query40	280	126	127	126
query41	44	36	38	36
query42	107	95	100	95
query43	566	540	551	540
query44	1191	745	748	745
query45	272	270	268	268
query46	1084	699	699	699
query47	1968	1866	1892	1866
query48	376	298	298	298
query49	1174	402	398	398
query50	778	401	383	383
query51	6980	6848	6910	6848
query52	102	91	93	91
query53	354	291	281	281
query54	897	466	452	452
query55	76	73	73	73
query56	236	218	215	215
query57	1259	1149	1167	1149
query58	220	203	205	203
query59	3437	3331	3257	3257
query60	252	254	242	242
query61	91	85	90	85
query62	694	464	493	464
query63	314	291	288	288
query64	9809	7503	7443	7443
query65	3248	3126	3164	3126
query66	1314	341	342	341
query67	15421	14981	14778	14778
query68	5653	545	549	545
query69	529	302	302	302
query70	1142	1132	1153	1132
query71	460	267	263	263
query72	8166	2540	2384	2384
query73	725	335	330	330
query74	6508	6163	6082	6082
query75	3855	2620	2708	2620
query76	3617	1010	995	995
query77	646	272	273	272
query78	10779	10184	10180	10180
query79	2487	506	516	506
query80	1302	444	433	433
query81	484	227	233	227
query82	803	97	103	97
query83	196	165	168	165
query84	265	85	86	85
query85	1376	282	311	282
query86	461	302	301	301
query87	3287	3125	3118	3118
query88	4072	2508	2426	2426
query89	466	380	399	380
query90	1924	192	196	192
query91	125	102	97	97
query92	56	53	49	49
query93	2749	521	518	518
query94	1149	184	186	184
query95	396	323	308	308
query96	594	271	270	270
query97	3200	3004	2998	2998
query98	244	221	215	215
query99	1276	906	909	906
Total cold run time: 290102 ms
Total hot run time: 188467 ms

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 35.65% (8981/25191)
Line Coverage: 27.32% (74255/271748)
Region Coverage: 26.56% (38378/144510)
Branch Coverage: 23.39% (19578/83718)
Coverage Report: http://coverage.selectdb-in.cc/coverage/eab221738fe000fbd0279891a71a178cba8b4269_eab221738fe000fbd0279891a71a178cba8b4269/report/index.html

@@ -126,15 +134,16 @@ TReportExecStatusParams RuntimeQueryStatiticsMgr::create_report_exec_status_para
}

TDetailedReportParams tmp;
tmp.__set_profile(*pipeline_profile);
tmp.__isset.profile = true;
tmp.profile = std::move(*pipeline_profile);
Copy link
Contributor

Choose a reason for hiding this comment

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

does this move safe? the original object will be broken

@@ -151,15 +160,17 @@ TReportExecStatusParams RuntimeQueryStatiticsMgr::create_report_exec_status_para
continue;
}

load_channel_profiles_req.push_back(*load_channel_profile);
load_channel_profiles_req.push_back(std::move(*load_channel_profile));
Copy link
Contributor

Choose a reason for hiding this comment

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

original object will be broken

be/src/runtime/runtime_query_statistics_mgr.cpp Outdated Show resolved Hide resolved
RuntimeProfile::Counter get_realtime_timer {TUnit::TIME_NS};

Defer _print_log([&]() {
LOG_INFO("Getting realtime exec status cost {}",
Copy link
Contributor

Choose a reason for hiding this comment

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

LOG_WARNING if we meet some threshold

@Mryange
Copy link
Contributor Author

Mryange commented May 11, 2024

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17604	4374	4280	4280
q2	2021	198	189	189
q3	10451	1238	1159	1159
q4	10200	832	751	751
q5	7465	2755	2757	2755
q6	230	136	136	136
q7	1033	586	618	586
q8	9249	2145	2107	2107
q9	9241	6791	6694	6694
q10	9997	3899	3921	3899
q11	454	252	244	244
q12	568	221	222	221
q13	17259	3145	3200	3145
q14	275	241	230	230
q15	514	472	484	472
q16	481	383	389	383
q17	997	725	745	725
q18	8293	7873	7806	7806
q19	5114	1564	1502	1502
q20	647	318	324	318
q21	5328	4206	4102	4102
q22	365	303	296	296
Total cold run time: 117786 ms
Total hot run time: 42000 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4641	4379	4394	4379
q2	375	268	271	268
q3	3171	2979	2909	2909
q4	1940	1620	1651	1620
q5	5509	5494	5489	5489
q6	210	127	126	126
q7	2277	1986	1967	1967
q8	3279	3443	3379	3379
q9	8660	8678	8732	8678
q10	3972	3778	3800	3778
q11	594	491	479	479
q12	802	636	614	614
q13	16405	3160	3174	3160
q14	301	272	286	272
q15	520	470	489	470
q16	486	448	434	434
q17	1803	1474	1473	1473
q18	7896	7612	7357	7357
q19	1696	1603	1556	1556
q20	1964	1767	1748	1748
q21	8563	4816	4730	4730
q22	584	506	503	503
Total cold run time: 75648 ms
Total hot run time: 55389 ms

@doris-robot
Copy link

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

query1	910	372	346	346
query2	6687	2522	2464	2464
query3	6651	209	210	209
query4	23942	21308	21243	21243
query5	4095	415	427	415
query6	257	182	173	173
query7	4575	286	290	286
query8	255	206	195	195
query9	8639	2391	2354	2354
query10	453	257	262	257
query11	14654	14268	14152	14152
query12	138	87	87	87
query13	1643	387	373	373
query14	10474	8408	7729	7729
query15	244	168	170	168
query16	8018	263	265	263
query17	1726	562	552	552
query18	2074	279	267	267
query19	208	152	155	152
query20	94	85	83	83
query21	195	136	129	129
query22	5022	4797	4866	4797
query23	34202	33531	33600	33531
query24	6875	2855	2881	2855
query25	566	372	379	372
query26	697	158	151	151
query27	2001	314	330	314
query28	3890	2100	2074	2074
query29	855	608	595	595
query30	221	152	153	152
query31	965	777	776	776
query32	91	55	56	55
query33	476	249	243	243
query34	880	473	486	473
query35	774	685	685	685
query36	1058	932	876	876
query37	102	63	66	63
query38	2959	2790	2769	2769
query39	1635	1553	1558	1553
query40	194	122	120	120
query41	41	40	38	38
query42	103	99	99	99
query43	583	566	568	566
query44	1074	736	756	736
query45	270	236	243	236
query46	1048	727	725	725
query47	1964	1894	1889	1889
query48	373	311	296	296
query49	842	427	397	397
query50	763	391	386	386
query51	6925	6735	6730	6730
query52	108	88	90	88
query53	351	279	277	277
query54	534	441	433	433
query55	73	71	71	71
query56	238	224	223	223
query57	1242	1136	1171	1136
query58	216	190	198	190
query59	3526	3158	3335	3158
query60	256	236	247	236
query61	97	88	87	87
query62	632	462	480	462
query63	312	278	276	276
query64	8418	7451	7366	7366
query65	3132	3095	3095	3095
query66	780	345	348	345
query67	15400	15138	15179	15138
query68	4559	532	550	532
query69	470	302	305	302
query70	1199	1098	1173	1098
query71	383	277	260	260
query72	7111	2580	2368	2368
query73	695	323	319	319
query74	6577	6109	6078	6078
query75	3349	2691	2664	2664
query76	2242	1048	961	961
query77	424	260	260	260
query78	10643	10194	10084	10084
query79	2502	517	514	514
query80	1037	429	429	429
query81	526	222	216	216
query82	747	91	92	91
query83	247	166	162	162
query84	254	90	86	86
query85	1268	271	258	258
query86	527	303	325	303
query87	3310	3142	3126	3126
query88	4256	2424	2422	2422
query89	481	376	390	376
query90	2049	186	183	183
query91	121	101	99	99
query92	64	47	48	47
query93	2111	520	510	510
query94	1100	180	191	180
query95	390	305	302	302
query96	591	271	269	269
query97	3174	2988	3004	2988
query98	244	225	219	219
query99	1172	905	914	905
Total cold run time: 272519 ms
Total hot run time: 187641 ms

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 35.65% (8984/25202)
Line Coverage: 27.31% (74254/271852)
Region Coverage: 26.55% (38386/144558)
Branch Coverage: 23.36% (19566/83752)
Coverage Report: http://coverage.selectdb-in.cc/coverage/eab221738fe000fbd0279891a71a178cba8b4269_eab221738fe000fbd0279891a71a178cba8b4269/report/index.html

@Mryange
Copy link
Contributor Author

Mryange commented May 12, 2024

run buildall

Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 35.65% (8984/25202)
Line Coverage: 27.31% (74263/271878)
Region Coverage: 26.55% (38382/144579)
Branch Coverage: 23.36% (19571/83766)
Coverage Report: http://coverage.selectdb-in.cc/coverage/60278271c99fd32cb261e1cd8f35545e530590c7_60278271c99fd32cb261e1cd8f35545e530590c7/report/index.html

Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@Mryange
Copy link
Contributor Author

Mryange commented May 13, 2024

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17878	4652	4268	4268
q2	2019	185	212	185
q3	10535	1146	1145	1145
q4	10181	811	838	811
q5	7529	2744	2734	2734
q6	221	131	132	131
q7	1057	596	610	596
q8	9261	2208	2146	2146
q9	9371	6862	6529	6529
q10	9108	3936	3841	3841
q11	470	247	250	247
q12	465	227	220	220
q13	18763	3157	3176	3157
q14	271	225	219	219
q15	524	482	481	481
q16	535	404	401	401
q17	1003	634	718	634
q18	8603	7883	7554	7554
q19	5923	1570	1558	1558
q20	671	328	318	318
q21	5193	4118	4090	4090
q22	346	285	280	280
Total cold run time: 119927 ms
Total hot run time: 41545 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4342	4236	4268	4236
q2	366	268	262	262
q3	3049	2807	2751	2751
q4	1857	1614	1581	1581
q5	5314	5314	5312	5312
q6	207	123	119	119
q7	2237	1905	1884	1884
q8	3184	3356	3337	3337
q9	8449	8475	8352	8352
q10	3914	3699	3721	3699
q11	579	482	513	482
q12	793	581	585	581
q13	17419	2997	3031	2997
q14	299	254	254	254
q15	504	475	475	475
q16	461	406	419	406
q17	1795	1463	1501	1463
q18	7630	7767	7421	7421
q19	1686	1561	1588	1561
q20	1979	1808	1747	1747
q21	10497	4799	4814	4799
q22	580	500	504	500
Total cold run time: 77141 ms
Total hot run time: 54219 ms

@doris-robot
Copy link

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

query1	933	385	356	356
query2	6444	2550	2277	2277
query3	6644	211	216	211
query4	24345	21288	21293	21288
query5	4149	421	425	421
query6	262	173	194	173
query7	4579	291	283	283
query8	239	189	195	189
query9	8656	2346	2342	2342
query10	444	258	240	240
query11	14849	14181	14092	14092
query12	149	94	91	91
query13	1658	376	376	376
query14	9760	8023	8490	8023
query15	256	175	178	175
query16	8014	260	252	252
query17	1752	555	547	547
query18	2060	275	285	275
query19	207	150	152	150
query20	93	83	85	83
query21	195	127	128	127
query22	5001	4849	4873	4849
query23	34513	33453	33494	33453
query24	6917	3002	2852	2852
query25	583	379	368	368
query26	703	158	163	158
query27	2154	316	330	316
query28	4962	2042	2050	2042
query29	837	617	620	617
query30	297	152	160	152
query31	983	764	733	733
query32	91	52	55	52
query33	514	252	251	251
query34	886	478	502	478
query35	766	692	658	658
query36	1075	929	911	911
query37	106	67	73	67
query38	2849	2768	2753	2753
query39	1642	1555	1580	1555
query40	202	126	128	126
query41	43	39	39	39
query42	103	97	103	97
query43	557	552	555	552
query44	1109	738	747	738
query45	259	249	241	241
query46	1058	741	687	687
query47	1943	1875	1869	1869
query48	378	296	293	293
query49	953	396	407	396
query50	788	379	392	379
query51	6868	6744	6698	6698
query52	110	89	96	89
query53	355	287	292	287
query54	532	425	456	425
query55	77	73	72	72
query56	240	227	228	227
query57	1203	1125	1152	1125
query58	217	204	232	204
query59	3251	3089	3158	3089
query60	261	231	241	231
query61	92	90	88	88
query62	643	484	483	483
query63	314	286	291	286
query64	8535	7424	7410	7410
query65	3199	3107	3077	3077
query66	734	340	349	340
query67	15298	14939	14836	14836
query68	4529	537	526	526
query69	453	309	301	301
query70	1153	1131	1157	1131
query71	367	268	263	263
query72	7762	2559	2401	2401
query73	700	322	321	321
query74	6456	6180	6161	6161
query75	3335	2659	2631	2631
query76	2310	996	1002	996
query77	415	268	274	268
query78	10636	10257	10126	10126
query79	1245	530	520	520
query80	1022	451	464	451
query81	537	226	223	223
query82	1189	96	96	96
query83	257	172	187	172
query84	251	90	90	90
query85	1003	391	268	268
query86	370	282	334	282
query87	3267	3119	3142	3119
query88	2944	2340	2331	2331
query89	460	397	403	397
query90	1789	189	192	189
query91	123	100	97	97
query92	57	50	51	50
query93	1013	519	502	502
query94	1004	181	184	181
query95	411	315	311	311
query96	574	262	266	262
query97	3182	3004	2959	2959
query98	240	226	216	216
query99	1214	910	909	909
Total cold run time: 270157 ms
Total hot run time: 187370 ms

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 35.65% (8986/25203)
Line Coverage: 27.32% (74280/271889)
Region Coverage: 26.55% (38386/144589)
Branch Coverage: 23.37% (19576/83774)
Coverage Report: http://coverage.selectdb-in.cc/coverage/de6bdf54940e3437c5a0ce1aba98112b24ca1ef8_de6bdf54940e3437c5a0ce1aba98112b24ca1ef8/report/index.html

@Mryange
Copy link
Contributor Author

Mryange commented May 13, 2024

run cloud_p1

}

TReportExecStatusParams req;
req.__set_query_profile(profile);
Copy link
Contributor

Choose a reason for hiding this comment

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

check the thrift api have a better way?
likereq.__set_query_profile(std::move(profile)

@Mryange
Copy link
Contributor Author

Mryange commented May 14, 2024

run buildall

Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 35.65% (8981/25191)
Line Coverage: 27.32% (74258/271795)
Region Coverage: 26.55% (38369/144501)
Branch Coverage: 23.38% (19572/83720)
Coverage Report: http://coverage.selectdb-in.cc/coverage/8386330f42dded61c5e5e35da275463880a52fc8_8386330f42dded61c5e5e35da275463880a52fc8/report/index.html

@Mryange
Copy link
Contributor Author

Mryange commented May 19, 2024

run buildall

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 35.70% (9008/25229)
Line Coverage: 27.36% (74498/272265)
Region Coverage: 26.61% (38534/144808)
Branch Coverage: 23.44% (19661/83888)
Coverage Report: http://coverage.selectdb-in.cc/coverage/8386330f42dded61c5e5e35da275463880a52fc8_8386330f42dded61c5e5e35da275463880a52fc8/report/index.html

// This function will clear the data of fragment_id_to_profile and load_channel_profiles.
RuntimeProfile::Counter timer {TUnit::TIME_NS};
Defer _print_log([&]() {
LOG_INFO("Create report exec status params cost {}",
Copy link
Contributor

Choose a reason for hiding this comment

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

why we need log each profile report time?

@@ -38,6 +38,11 @@ class TTransport;
} // namespace apache

namespace doris {

#define SET_THRIFT_VALUES(thrift, member, value) \
Copy link
Contributor

Choose a reason for hiding this comment

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

why not call MOVE_VALUE

@Mryange
Copy link
Contributor Author

Mryange commented May 20, 2024

run buildall

Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 35.70% (9013/25247)
Line Coverage: 27.35% (74531/272461)
Region Coverage: 26.61% (38547/144880)
Branch Coverage: 23.44% (19664/83906)
Coverage Report: http://coverage.selectdb-in.cc/coverage/9014998ec98006fe16c0b266b3f6d3e8a209b67a_9014998ec98006fe16c0b266b3f6d3e8a209b67a/report/index.html

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

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

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

Copy link
Contributor

PR approved by anyone and no changes requested.

@Gabriel39 Gabriel39 merged commit 16e25f6 into apache:master May 22, 2024
25 of 28 checks passed
M1saka2003 pushed a commit to M1saka2003/doris that referenced this pull request May 24, 2024
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. meta-change reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants