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

[Feature](Cloud) Support session variable disable_file_cache and enable_segment_cache in query #37141

Merged
merged 2 commits into from
Aug 6, 2024

Conversation

wangshuo128
Copy link
Contributor

@wangshuo128 wangshuo128 commented Jul 2, 2024

Proposed changes

Currently, whether to read from file cache or remote storage is controlled by the BE config enable_file_cache in cloud mode.
This PR proposed to control the file cache behavior via session variables when executing queries in cloud mode.
It's more convenient when have such a session variable, cache behavior could be controlled per query/session without changing BE configs, such as:

  1. Performance test. Test the query performance when read from local file cache or remote storage for queries.
  2. Data correctness. Check if it's file cache issue for certain tables or queries.

The read path has three kinds of caches: segment cache, page cache and file cache.

module cache BE config session variable
Segment segment cache disable_segment_cache enable_segment_cache (supportted by this PR)
PageIO page cache disable_storage_page_cache enable_page_cache
FileReader file cache enable_file_cache disable_file_cache (supportted by this PR)

The modification of the PR:

  • enable_segment_cache: add a new session variable enable_segment_cache to control use segment cache or not.
  • disable_file_cache: disable_file_cache was for write path in cloud mode. It's supported for read path when executing queries in the PR.

With this PR, data is read from remote storage without cache:

set enable_segment_cache=false;
set enable_page_cache=false;
set disable_file_cache=true;

@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.

Copy link
Contributor

github-actions bot commented Jul 2, 2024

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

3 similar comments
Copy link
Contributor

github-actions bot commented Jul 2, 2024

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

Copy link
Contributor

github-actions bot commented Jul 3, 2024

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

Copy link
Contributor

github-actions bot commented Jul 3, 2024

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

Copy link
Contributor

github-actions bot commented Jul 4, 2024

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

@wangshuo128
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	18023	4557	4339	4339
q2	2040	196	192	192
q3	10553	1162	1120	1120
q4	10211	860	749	749
q5	7470	2698	2660	2660
q6	227	143	141	141
q7	995	607	612	607
q8	9230	2108	2101	2101
q9	9052	6522	6514	6514
q10	8963	3700	3703	3700
q11	475	239	238	238
q12	438	234	232	232
q13	17779	2974	3005	2974
q14	267	234	226	226
q15	520	494	491	491
q16	509	385	377	377
q17	980	702	639	639
q18	8070	7595	7327	7327
q19	6405	1522	1490	1490
q20	690	336	340	336
q21	4870	3106	3882	3106
q22	389	347	337	337
Total cold run time: 118156 ms
Total hot run time: 39896 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4430	4300	4213	4213
q2	381	257	273	257
q3	3039	2884	2986	2884
q4	1965	1669	1749	1669
q5	5570	5537	5459	5459
q6	227	141	140	140
q7	2247	1917	1851	1851
q8	3296	3482	3439	3439
q9	8752	8770	8756	8756
q10	4179	3743	3767	3743
q11	604	504	503	503
q12	861	633	647	633
q13	15960	3174	3211	3174
q14	311	291	281	281
q15	540	484	498	484
q16	498	443	444	443
q17	1846	1565	1541	1541
q18	8098	7997	7828	7828
q19	1753	1665	1772	1665
q20	2154	1881	1870	1870
q21	5195	4957	4613	4613
q22	638	568	566	566
Total cold run time: 72544 ms
Total hot run time: 56012 ms

Copy link
Contributor

github-actions bot commented Jul 4, 2024

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

@doris-robot
Copy link

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

query1	921	379	370	370
query2	6448	2373	2404	2373
query3	6637	200	209	200
query4	19188	17556	17135	17135
query5	3668	502	500	500
query6	254	154	162	154
query7	4551	314	296	296
query8	319	296	279	279
query9	8330	2391	2381	2381
query10	553	314	286	286
query11	10539	9966	10089	9966
query12	115	89	82	82
query13	1599	380	375	375
query14	10144	6408	7814	6408
query15	237	186	185	185
query16	7592	357	306	306
query17	1334	543	535	535
query18	1951	271	273	271
query19	201	151	161	151
query20	92	86	85	85
query21	211	125	127	125
query22	4303	4038	4067	4038
query23	33778	33422	33495	33422
query24	11047	2882	2851	2851
query25	603	390	385	385
query26	709	156	156	156
query27	2302	330	339	330
query28	6050	2190	2180	2180
query29	898	632	661	632
query30	231	161	159	159
query31	982	799	753	753
query32	102	54	55	54
query33	687	285	291	285
query34	909	479	495	479
query35	762	678	633	633
query36	1139	986	977	977
query37	140	80	82	80
query38	2971	2826	2796	2796
query39	889	863	821	821
query40	239	132	131	131
query41	54	51	54	51
query42	104	104	103	103
query43	615	566	558	558
query44	1198	723	729	723
query45	207	170	159	159
query46	1097	714	725	714
query47	1832	1828	1746	1746
query48	371	299	290	290
query49	848	431	423	423
query50	764	385	387	385
query51	6965	6755	6757	6755
query52	104	94	98	94
query53	369	299	295	295
query54	859	473	451	451
query55	75	72	74	72
query56	286	267	273	267
query57	1108	1040	1030	1030
query58	268	253	262	253
query59	3340	3219	3116	3116
query60	335	284	287	284
query61	100	98	96	96
query62	601	445	445	445
query63	317	298	294	294
query64	8528	2289	1791	1791
query65	3147	3077	3143	3077
query66	756	333	345	333
query67	15397	15015	14850	14850
query68	4472	543	548	543
query69	453	326	312	312
query70	1102	1121	1131	1121
query71	375	299	292	292
query72	6913	5411	5574	5411
query73	740	326	329	326
query74	5961	5488	5496	5488
query75	3390	2636	2628	2628
query76	2204	1054	884	884
query77	439	317	312	312
query78	9998	8832	8815	8815
query79	2984	521	521	521
query80	2128	487	491	487
query81	552	227	217	217
query82	1411	109	109	109
query83	334	175	176	175
query84	265	88	86	86
query85	1338	336	279	279
query86	463	321	318	318
query87	3255	3095	3137	3095
query88	3695	2372	2356	2356
query89	472	383	386	383
query90	1719	188	189	188
query91	133	104	104	104
query92	61	48	52	48
query93	2475	530	518	518
query94	1115	214	213	213
query95	402	317	326	317
query96	585	269	263	263
query97	3106	3033	3011	3011
query98	233	200	200	200
query99	1276	857	855	855
Total cold run time: 267319 ms
Total hot run time: 172155 ms

@doris-robot
Copy link

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

query1	0.04	0.03	0.04
query2	0.08	0.04	0.04
query3	0.22	0.05	0.05
query4	1.65	0.10	0.09
query5	0.51	0.50	0.48
query6	1.14	0.73	0.73
query7	0.02	0.02	0.01
query8	0.06	0.04	0.04
query9	0.55	0.49	0.50
query10	0.54	0.54	0.54
query11	0.15	0.11	0.11
query12	0.14	0.11	0.12
query13	0.59	0.61	0.59
query14	0.76	0.78	0.77
query15	0.85	0.81	0.79
query16	0.36	0.36	0.35
query17	1.03	0.95	1.01
query18	0.23	0.21	0.26
query19	1.75	1.68	1.68
query20	0.02	0.01	0.01
query21	15.39	0.75	0.66
query22	4.88	6.49	2.30
query23	18.29	1.38	1.30
query24	2.19	0.22	0.22
query25	0.17	0.08	0.08
query26	0.28	0.17	0.18
query27	0.08	0.09	0.08
query28	13.28	1.01	0.99
query29	12.71	3.29	3.27
query30	0.25	0.05	0.06
query31	2.88	0.41	0.39
query32	3.21	0.48	0.46
query33	2.88	2.90	2.91
query34	17.19	4.44	4.43
query35	4.45	4.42	4.48
query36	0.65	0.46	0.50
query37	0.18	0.16	0.16
query38	0.15	0.14	0.14
query39	0.04	0.03	0.04
query40	0.17	0.13	0.13
query41	0.09	0.05	0.05
query42	0.06	0.06	0.05
query43	0.05	0.04	0.04
Total cold run time: 110.21 s
Total hot run time: 30.85 s

Copy link
Contributor

github-actions bot commented Jul 4, 2024

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

Copy link
Contributor

github-actions bot commented Jul 4, 2024

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

@wangshuo128
Copy link
Contributor Author

run buildall

Copy link
Contributor

github-actions bot commented Jul 4, 2024

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

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	18188	4456	4318	4318
q2	2008	190	185	185
q3	10537	1184	1087	1087
q4	10267	829	826	826
q5	7489	2630	2571	2571
q6	220	139	134	134
q7	955	595	601	595
q8	9230	2099	2070	2070
q9	9017	6456	6509	6456
q10	9050	3693	3699	3693
q11	458	236	241	236
q12	471	233	228	228
q13	18969	2980	3004	2980
q14	277	223	217	217
q15	543	484	486	484
q16	525	384	374	374
q17	987	611	678	611
q18	8167	7485	7394	7394
q19	7331	1604	1488	1488
q20	661	323	323	323
q21	5077	3149	3906	3149
q22	404	333	336	333
Total cold run time: 120831 ms
Total hot run time: 39752 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4391	4223	4275	4223
q2	369	274	271	271
q3	3111	3000	2997	2997
q4	2013	1785	1729	1729
q5	5492	5693	5480	5480
q6	244	136	129	129
q7	2265	1900	1810	1810
q8	3344	3398	3438	3398
q9	8676	8864	8734	8734
q10	4063	3755	3791	3755
q11	597	510	503	503
q12	800	650	645	645
q13	16986	3146	3186	3146
q14	320	273	267	267
q15	547	508	494	494
q16	473	417	422	417
q17	1812	1524	1515	1515
q18	8157	8063	7771	7771
q19	1800	1570	1570	1570
q20	2201	1892	1871	1871
q21	5166	4769	4817	4769
q22	653	574	557	557
Total cold run time: 73480 ms
Total hot run time: 56051 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 172565 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 66dedeb6b6b15c00dfc8966424e6204318504f35, data reload: false

query1	931	377	371	371
query2	6448	2486	2298	2298
query3	6641	203	211	203
query4	19086	17687	17342	17342
query5	3617	491	460	460
query6	271	175	176	175
query7	4594	298	298	298
query8	328	295	309	295
query9	8518	2414	2386	2386
query10	556	287	305	287
query11	10584	10143	10030	10030
query12	120	83	84	83
query13	1629	363	369	363
query14	10112	7574	6894	6894
query15	230	185	192	185
query16	7772	309	302	302
query17	1773	532	516	516
query18	1953	277	285	277
query19	212	154	184	154
query20	88	81	82	81
query21	204	132	127	127
query22	4332	3988	4099	3988
query23	33996	33723	33602	33602
query24	11101	2927	2859	2859
query25	639	378	371	371
query26	1178	156	158	156
query27	2980	318	317	317
query28	7587	2185	2157	2157
query29	930	646	630	630
query30	243	153	156	153
query31	1014	772	792	772
query32	100	53	53	53
query33	751	298	290	290
query34	1026	476	528	476
query35	756	631	624	624
query36	1141	971	990	971
query37	149	78	77	77
query38	2947	2919	2806	2806
query39	898	818	813	813
query40	203	128	120	120
query41	56	51	50	50
query42	118	98	106	98
query43	571	540	551	540
query44	1135	724	725	724
query45	192	166	161	161
query46	1090	715	712	712
query47	1907	1776	1800	1776
query48	375	293	297	293
query49	861	406	407	406
query50	763	379	382	379
query51	6950	6790	6710	6710
query52	105	91	122	91
query53	363	289	288	288
query54	860	451	441	441
query55	75	71	71	71
query56	283	260	268	260
query57	1110	1043	1052	1043
query58	252	239	244	239
query59	3456	3379	3158	3158
query60	316	279	281	279
query61	95	93	97	93
query62	602	458	439	439
query63	326	286	291	286
query64	8884	2218	1765	1765
query65	3160	3108	3110	3108
query66	770	336	324	324
query67	15507	14968	15021	14968
query68	4487	546	555	546
query69	523	371	312	312
query70	1147	1139	1096	1096
query71	416	281	276	276
query72	7420	5149	5753	5149
query73	741	323	323	323
query74	5936	5571	5485	5485
query75	3498	2658	2640	2640
query76	2683	1043	898	898
query77	448	293	289	289
query78	9462	8840	8813	8813
query79	2402	515	514	514
query80	1898	470	477	470
query81	600	221	225	221
query82	902	105	103	103
query83	289	178	168	168
query84	247	85	84	84
query85	2012	290	271	271
query86	481	316	326	316
query87	3271	3123	3141	3123
query88	3635	2349	2355	2349
query89	475	401	376	376
query90	1860	185	185	185
query91	127	102	101	101
query92	56	48	50	48
query93	3189	516	518	516
query94	1163	216	207	207
query95	401	305	310	305
query96	589	262	265	262
query97	3141	3025	2995	2995
query98	221	219	205	205
query99	1138	927	855	855
Total cold run time: 272678 ms
Total hot run time: 172565 ms

@doris-robot
Copy link

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

query1	0.04	0.03	0.03
query2	0.08	0.04	0.04
query3	0.22	0.05	0.05
query4	1.66	0.08	0.09
query5	0.50	0.48	0.47
query6	1.14	0.73	0.72
query7	0.01	0.02	0.01
query8	0.04	0.04	0.05
query9	0.56	0.50	0.47
query10	0.55	0.54	0.54
query11	0.15	0.12	0.11
query12	0.15	0.12	0.12
query13	0.60	0.58	0.59
query14	0.74	0.79	0.77
query15	0.85	0.82	0.81
query16	0.37	0.36	0.38
query17	0.98	0.98	0.98
query18	0.21	0.24	0.27
query19	1.75	1.67	1.69
query20	0.02	0.01	0.01
query21	15.41	0.78	0.65
query22	3.88	7.65	1.65
query23	18.28	1.39	1.22
query24	2.17	0.22	0.22
query25	0.16	0.08	0.08
query26	0.30	0.20	0.22
query27	0.45	0.23	0.23
query28	13.28	1.01	1.00
query29	12.60	3.25	3.22
query30	0.25	0.06	0.05
query31	2.87	0.38	0.39
query32	3.28	0.47	0.46
query33	2.89	2.85	2.95
query34	17.20	4.31	4.38
query35	4.47	4.40	4.36
query36	0.65	0.46	0.49
query37	0.18	0.15	0.14
query38	0.16	0.15	0.15
query39	0.05	0.03	0.04
query40	0.16	0.12	0.12
query41	0.10	0.04	0.04
query42	0.05	0.04	0.05
query43	0.04	0.04	0.04
Total cold run time: 109.5 s
Total hot run time: 30 s

@wangshuo128
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	18322	4649	4327	4327
q2	2020	194	190	190
q3	10523	1234	1093	1093
q4	10251	696	854	696
q5	7520	2684	2630	2630
q6	227	138	136	136
q7	969	596	607	596
q8	9229	2118	2092	2092
q9	8901	6577	6500	6500
q10	9008	3753	3726	3726
q11	466	234	243	234
q12	416	230	229	229
q13	18705	2972	2953	2953
q14	268	233	231	231
q15	536	505	483	483
q16	511	389	367	367
q17	993	736	687	687
q18	8118	7501	7391	7391
q19	4010	1538	1350	1350
q20	653	315	313	313
q21	4959	3353	3874	3353
q22	377	341	333	333
Total cold run time: 116982 ms
Total hot run time: 39910 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4402	4275	4305	4275
q2	362	264	260	260
q3	3001	2948	2927	2927
q4	2001	1659	1766	1659
q5	5642	5518	5491	5491
q6	229	140	128	128
q7	2206	1932	1872	1872
q8	3341	3473	3500	3473
q9	8738	8769	8806	8769
q10	4156	3829	3817	3817
q11	587	493	498	493
q12	833	638	638	638
q13	17184	3170	3226	3170
q14	320	298	279	279
q15	519	494	481	481
q16	500	439	431	431
q17	1854	1534	1522	1522
q18	8287	7990	7890	7890
q19	1854	1684	1613	1613
q20	2142	1937	1863	1863
q21	5085	4845	4835	4835
q22	621	560	585	560
Total cold run time: 73864 ms
Total hot run time: 56446 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 173427 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 66dedeb6b6b15c00dfc8966424e6204318504f35, data reload: false

query1	912	372	366	366
query2	6462	2513	2270	2270
query3	6643	204	221	204
query4	27964	17437	17378	17378
query5	3797	475	480	475
query6	263	171	156	156
query7	4593	297	301	297
query8	319	292	300	292
query9	8459	2459	2433	2433
query10	577	321	284	284
query11	10769	10085	10047	10047
query12	119	86	86	86
query13	1653	391	371	371
query14	9434	7773	6954	6954
query15	231	187	185	185
query16	7554	323	306	306
query17	1791	552	539	539
query18	1745	286	282	282
query19	205	160	158	158
query20	97	83	84	83
query21	215	132	128	128
query22	4383	4163	4029	4029
query23	34172	33835	33796	33796
query24	10655	2906	2874	2874
query25	605	429	422	422
query26	719	161	160	160
query27	2266	341	334	334
query28	5773	2186	2184	2184
query29	895	671	665	665
query30	252	155	156	155
query31	997	754	766	754
query32	102	63	59	59
query33	685	322	317	317
query34	910	486	503	486
query35	769	648	668	648
query36	1148	996	983	983
query37	142	80	82	80
query38	2941	2887	2754	2754
query39	848	805	833	805
query40	210	129	131	129
query41	55	55	53	53
query42	131	101	100	100
query43	600	552	563	552
query44	1124	732	747	732
query45	199	163	165	163
query46	1080	707	715	707
query47	1854	1812	1796	1796
query48	376	318	312	312
query49	944	403	413	403
query50	770	376	373	373
query51	6850	6792	6752	6752
query52	104	93	94	93
query53	371	308	293	293
query54	930	442	439	439
query55	75	76	73	73
query56	282	263	268	263
query57	1093	1045	1073	1045
query58	260	240	238	238
query59	3345	3255	3112	3112
query60	297	282	292	282
query61	95	91	93	91
query62	612	457	457	457
query63	334	288	288	288
query64	9192	2195	1617	1617
query65	3144	3098	3116	3098
query66	755	329	335	329
query67	15735	15035	14936	14936
query68	8370	558	546	546
query69	720	452	349	349
query70	1192	1100	1167	1100
query71	525	274	279	274
query72	9125	5300	5765	5300
query73	1777	323	325	323
query74	6037	5560	5549	5549
query75	5231	2642	2685	2642
query76	4697	953	1017	953
query77	783	304	300	300
query78	12607	9609	8840	8840
query79	11085	526	524	524
query80	1107	483	472	472
query81	595	221	223	221
query82	366	105	104	104
query83	337	168	171	168
query84	279	85	86	85
query85	752	316	296	296
query86	396	297	304	297
query87	3335	3149	3113	3113
query88	4681	2409	2363	2363
query89	495	376	369	369
query90	2117	189	191	189
query91	136	103	100	100
query92	61	48	52	48
query93	3373	528	521	521
query94	1308	205	207	205
query95	397	318	326	318
query96	613	269	271	269
query97	3202	3018	3035	3018
query98	226	200	204	200
query99	1202	866	846	846
Total cold run time: 300008 ms
Total hot run time: 173427 ms

@doris-robot
Copy link

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

query1	0.04	0.03	0.03
query2	0.08	0.04	0.04
query3	0.23	0.04	0.05
query4	1.67	0.07	0.10
query5	0.48	0.50	0.48
query6	1.13	0.72	0.72
query7	0.02	0.01	0.02
query8	0.05	0.04	0.04
query9	0.55	0.49	0.48
query10	0.52	0.54	0.53
query11	0.16	0.11	0.12
query12	0.14	0.12	0.12
query13	0.61	0.60	0.59
query14	0.76	0.78	0.77
query15	0.87	0.83	0.81
query16	0.34	0.36	0.36
query17	1.04	0.97	0.97
query18	0.21	0.24	0.22
query19	1.84	1.83	1.85
query20	0.01	0.01	0.01
query21	15.40	0.79	0.65
query22	4.31	7.20	1.78
query23	18.33	1.36	1.19
query24	2.07	0.23	0.22
query25	0.14	0.08	0.10
query26	0.30	0.21	0.22
query27	0.46	0.25	0.24
query28	13.30	1.02	1.01
query29	12.57	3.30	3.31
query30	0.24	0.06	0.06
query31	2.90	0.39	0.40
query32	3.23	0.48	0.46
query33	2.89	2.96	2.94
query34	17.10	4.33	4.41
query35	4.46	4.44	4.34
query36	0.65	0.47	0.48
query37	0.19	0.16	0.15
query38	0.15	0.15	0.14
query39	0.04	0.04	0.04
query40	0.16	0.12	0.12
query41	0.09	0.04	0.05
query42	0.06	0.05	0.04
query43	0.05	0.04	0.04
Total cold run time: 109.84 s
Total hot run time: 30.47 s

@wangshuo128
Copy link
Contributor Author

run p0

@wangshuo128
Copy link
Contributor Author

run feut

gavinchou
gavinchou previously approved these changes Aug 2, 2024
@gavinchou gavinchou changed the title [Feature](Cloud) Support session variable disable_file_cache in query. [Feature](Cloud) Support session variable disable_file_cache in query Aug 2, 2024
@gavinchou
Copy link
Contributor

run buildall

@gavinchou gavinchou changed the title [Feature](Cloud) Support session variable disable_file_cache in query [Feature](Cloud) Support session variable disable_file_cache and enable_segment_cache in query Aug 2, 2024
@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Aug 2, 2024
Copy link
Contributor

github-actions bot commented Aug 2, 2024

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

Copy link
Contributor

github-actions bot commented Aug 2, 2024

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

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17632	4158	4087	4087
q2	2023	207	201	201
q3	10440	1289	1361	1289
q4	10179	785	939	785
q5	7667	3030	3015	3015
q6	222	138	139	138
q7	1072	626	612	612
q8	9450	1969	2005	1969
q9	8624	6645	6616	6616
q10	8779	3848	3853	3848
q11	434	252	250	250
q12	444	221	227	221
q13	17774	2981	2958	2958
q14	279	243	249	243
q15	529	499	491	491
q16	541	414	397	397
q17	995	973	947	947
q18	8009	7452	7236	7236
q19	1431	1228	1230	1228
q20	550	324	348	324
q21	5400	4781	4918	4781
q22	368	285	280	280
Total cold run time: 112842 ms
Total hot run time: 41916 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4080	4017	4026	4017
q2	325	222	227	222
q3	3011	3020	3185	3020
q4	2044	2071	1955	1955
q5	5640	5471	5484	5471
q6	219	130	128	128
q7	2105	1797	1834	1797
q8	3336	3390	3356	3356
q9	8717	8684	8863	8684
q10	3970	4063	3979	3979
q11	571	470	478	470
q12	769	587	581	581
q13	11125	3172	3155	3155
q14	305	278	274	274
q15	529	484	495	484
q16	494	426	427	426
q17	1803	1754	1766	1754
q18	8146	7753	7804	7753
q19	1784	1728	1719	1719
q20	2053	1890	1829	1829
q21	5699	5462	5552	5462
q22	555	468	478	468
Total cold run time: 67280 ms
Total hot run time: 57004 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 169551 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 2a115b417d19ed33bc472b581160c9476bd9137d, data reload: false

query1	921	393	384	384
query2	6449	1719	1668	1668
query3	6651	213	224	213
query4	19440	17411	17226	17226
query5	3615	529	519	519
query6	287	166	160	160
query7	4599	295	302	295
query8	250	192	194	192
query9	8497	2329	2337	2329
query10	455	283	288	283
query11	10451	9985	10019	9985
query12	123	95	88	88
query13	1638	391	379	379
query14	8340	7001	7649	7001
query15	217	162	162	162
query16	6831	448	467	448
query17	935	549	531	531
query18	1890	279	281	279
query19	189	143	140	140
query20	91	84	84	84
query21	207	102	106	102
query22	4259	4094	3963	3963
query23	33537	33746	33274	33274
query24	10258	3092	3048	3048
query25	698	413	406	406
query26	1774	152	158	152
query27	3099	284	287	284
query28	7535	1990	1985	1985
query29	1299	427	432	427
query30	243	161	158	158
query31	945	781	759	759
query32	109	53	57	53
query33	679	315	315	315
query34	910	498	509	498
query35	835	774	746	746
query36	1024	884	903	884
query37	292	94	88	88
query38	2950	2939	2913	2913
query39	879	864	829	829
query40	275	120	124	120
query41	45	44	45	44
query42	117	108	101	101
query43	469	428	419	419
query44	1195	729	741	729
query45	208	178	176	176
query46	1094	854	787	787
query47	1790	1700	1706	1700
query48	367	294	299	294
query49	942	425	425	425
query50	892	432	433	432
query51	6845	6802	6731	6731
query52	103	88	97	88
query53	253	190	183	183
query54	612	459	464	459
query55	74	74	73	73
query56	272	263	258	258
query57	1131	1064	1046	1046
query58	285	270	271	270
query59	2436	2513	2437	2437
query60	309	265	276	265
query61	95	92	90	90
query62	896	649	669	649
query63	210	176	183	176
query64	5677	1944	1914	1914
query65	3199	3101	3136	3101
query66	1322	358	334	334
query67	15597	14817	14652	14652
query68	4234	579	586	579
query69	448	309	306	306
query70	1051	1052	1095	1052
query71	419	304	280	280
query72	7099	2667	2490	2490
query73	755	329	328	328
query74	6049	5620	5567	5567
query75	3371	2745	2801	2745
query76	2272	1222	1284	1222
query77	411	306	312	306
query78	9462	8906	8821	8821
query79	2001	540	531	531
query80	1157	530	535	530
query81	559	224	223	223
query82	1151	140	138	138
query83	238	176	177	176
query84	270	88	84	84
query85	1317	374	368	368
query86	408	296	317	296
query87	3300	3077	3107	3077
query88	2995	2522	2524	2522
query89	398	294	290	290
query90	1727	198	201	198
query91	137	117	120	117
query92	67	53	54	53
query93	1560	630	628	628
query94	812	303	306	303
query95	398	280	276	276
query96	607	291	292	291
query97	3209	3082	3104	3082
query98	227	208	199	199
query99	1602	1270	1287	1270
Total cold run time: 259822 ms
Total hot run time: 169551 ms

@doris-robot
Copy link

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

query1	0.05	0.04	0.04
query2	0.07	0.04	0.03
query3	0.22	0.04	0.05
query4	1.69	0.06	0.06
query5	0.49	0.50	0.48
query6	1.14	0.71	0.71
query7	0.02	0.01	0.02
query8	0.05	0.04	0.04
query9	0.57	0.55	0.51
query10	0.59	0.58	0.58
query11	0.16	0.12	0.12
query12	0.16	0.13	0.12
query13	0.63	0.60	0.60
query14	0.78	0.78	0.79
query15	0.89	0.86	0.88
query16	0.35	0.36	0.36
query17	0.99	0.97	1.00
query18	0.23	0.24	0.22
query19	1.82	1.69	1.73
query20	0.02	0.01	0.01
query21	15.40	0.76	0.68
query22	3.84	7.19	1.72
query23	18.03	1.30	1.21
query24	2.24	0.23	0.21
query25	0.18	0.08	0.08
query26	0.32	0.22	0.21
query27	0.46	0.24	0.22
query28	13.17	0.99	0.96
query29	12.52	3.28	3.30
query30	0.25	0.06	0.06
query31	2.87	0.41	0.41
query32	3.24	0.48	0.48
query33	2.97	3.01	2.99
query34	15.44	4.28	4.29
query35	4.30	4.29	4.30
query36	0.67	0.49	0.48
query37	0.18	0.18	0.16
query38	0.16	0.15	0.15
query39	0.04	0.04	0.04
query40	0.16	0.13	0.13
query41	0.09	0.04	0.04
query42	0.06	0.05	0.04
query43	0.05	0.04	0.04
Total cold run time: 107.56 s
Total hot run time: 30.39 s

@gavinchou
Copy link
Contributor

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	18278	4239	4169	4169
q2	2437	207	206	206
q3	11296	1433	1361	1361
q4	10788	854	1027	854
q5	8233	3095	3051	3051
q6	232	144	145	144
q7	1061	612	612	612
q8	9459	1792	1962	1792
q9	8609	6618	6601	6601
q10	8746	3834	3840	3834
q11	428	252	250	250
q12	412	229	221	221
q13	17753	2967	2932	2932
q14	275	245	245	245
q15	523	484	496	484
q16	508	402	389	389
q17	983	903	934	903
q18	8037	7308	7297	7297
q19	1506	1225	1214	1214
q20	574	321	339	321
q21	5312	4766	4798	4766
q22	357	289	285	285
Total cold run time: 115807 ms
Total hot run time: 41931 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4080	4039	4009	4009
q2	333	223	217	217
q3	3004	3001	2985	2985
q4	1908	1890	1883	1883
q5	5302	5235	5242	5235
q6	215	130	132	130
q7	2101	1709	1736	1709
q8	3198	3294	3232	3232
q9	8332	8328	8330	8328
q10	3762	3857	3836	3836
q11	551	444	446	444
q12	725	573	540	540
q13	12143	2946	2960	2946
q14	289	257	254	254
q15	522	476	470	470
q16	452	404	400	400
q17	1730	1712	1706	1706
q18	7790	7448	7236	7236
q19	1674	1663	1686	1663
q20	1988	1775	1758	1758
q21	5388	5416	5215	5215
q22	513	454	446	446
Total cold run time: 66000 ms
Total hot run time: 54642 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 168324 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 2a115b417d19ed33bc472b581160c9476bd9137d, data reload: false

query1	909	384	368	368
query2	6486	1691	1696	1691
query3	6672	208	222	208
query4	20264	17395	17126	17126
query5	4314	512	514	512
query6	279	171	181	171
query7	4605	306	285	285
query8	251	198	196	196
query9	8526	2369	2374	2369
query10	431	275	269	269
query11	10491	10030	10047	10030
query12	144	88	89	88
query13	1638	375	373	373
query14	9198	7683	6852	6852
query15	226	165	163	163
query16	7111	457	448	448
query17	955	582	565	565
query18	1831	291	281	281
query19	201	148	146	146
query20	98	89	91	89
query21	205	108	107	107
query22	4138	4144	4057	4057
query23	33831	32973	32832	32832
query24	10548	3088	3077	3077
query25	692	377	370	370
query26	1755	147	148	147
query27	2964	271	281	271
query28	6922	1991	1987	1987
query29	1317	410	410	410
query30	285	147	148	147
query31	941	747	745	745
query32	99	55	56	55
query33	708	300	312	300
query34	905	491	487	487
query35	831	722	718	718
query36	996	870	861	861
query37	303	79	79	79
query38	2858	2790	2776	2776
query39	874	792	804	792
query40	288	113	108	108
query41	44	43	43	43
query42	117	101	96	96
query43	493	420	419	419
query44	1193	726	725	725
query45	203	175	175	175
query46	1074	828	795	795
query47	1800	1723	1719	1719
query48	367	293	287	287
query49	1188	420	420	420
query50	913	437	435	435
query51	6856	6635	6619	6619
query52	105	93	91	91
query53	257	178	175	175
query54	651	451	453	451
query55	79	74	98	74
query56	283	261	259	259
query57	1119	1042	1044	1042
query58	283	271	259	259
query59	2600	2306	2542	2306
query60	314	274	295	274
query61	94	107	94	94
query62	919	661	676	661
query63	224	181	175	175
query64	5852	1957	1868	1868
query65	3165	3093	3079	3079
query66	1418	336	344	336
query67	15314	14842	14754	14754
query68	4365	569	577	569
query69	451	292	297	292
query70	1078	1085	1081	1081
query71	418	279	269	269
query72	7105	2660	2467	2467
query73	815	336	335	335
query74	6068	5647	5695	5647
query75	3386	2741	2703	2703
query76	2516	1238	1265	1238
query77	440	305	320	305
query78	9419	9023	8876	8876
query79	1528	533	542	533
query80	1287	509	498	498
query81	586	228	224	224
query82	1007	132	133	132
query83	265	170	172	170
query84	277	79	85	79
query85	1262	322	298	298
query86	381	304	300	300
query87	3353	3088	3106	3088
query88	2961	2417	2432	2417
query89	393	291	284	284
query90	1805	198	198	198
query91	124	99	100	99
query92	61	50	49	49
query93	1429	628	625	625
query94	893	306	290	290
query95	379	270	267	267
query96	616	283	282	282
query97	3250	3040	3058	3040
query98	230	199	202	199
query99	1613	1283	1296	1283
Total cold run time: 262776 ms
Total hot run time: 168324 ms

@doris-robot
Copy link

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

query1	0.04	0.04	0.04
query2	0.08	0.04	0.04
query3	0.23	0.05	0.04
query4	1.69	0.06	0.07
query5	0.49	0.47	0.49
query6	1.15	0.72	0.71
query7	0.02	0.01	0.01
query8	0.06	0.04	0.04
query9	0.56	0.50	0.51
query10	0.54	0.57	0.55
query11	0.16	0.12	0.12
query12	0.15	0.12	0.12
query13	0.62	0.61	0.59
query14	0.78	0.82	0.78
query15	0.91	0.87	0.86
query16	0.36	0.36	0.35
query17	1.00	1.01	1.01
query18	0.23	0.22	0.21
query19	1.84	1.72	1.70
query20	0.02	0.01	0.01
query21	15.42	0.76	0.67
query22	3.91	6.57	2.28
query23	18.11	1.29	1.28
query24	2.31	0.23	0.22
query25	0.18	0.08	0.08
query26	0.32	0.21	0.22
query27	0.46	0.23	0.22
query28	13.18	1.00	0.97
query29	12.55	3.31	3.30
query30	0.26	0.06	0.05
query31	2.87	0.40	0.40
query32	3.24	0.49	0.48
query33	2.94	2.93	3.02
query34	15.67	4.27	4.23
query35	4.29	4.29	4.31
query36	0.68	0.48	0.48
query37	0.19	0.17	0.16
query38	0.16	0.15	0.15
query39	0.04	0.04	0.03
query40	0.17	0.14	0.13
query41	0.09	0.04	0.05
query42	0.05	0.04	0.05
query43	0.05	0.04	0.04
Total cold run time: 108.07 s
Total hot run time: 30.89 s

@gavinchou gavinchou merged commit 2fb98f5 into apache:master Aug 6, 2024
32 of 34 checks passed
gavinchou added a commit to gavinchou/doris that referenced this pull request Aug 8, 2024
…apache#37141

Session variable `disable_file_cache` is processed as "disposable file cache"
in beta_rowset_reader.cpp.

```
if (_read_context->runtime_state != nullptr) {
    _read_options.io_ctx.query_id = &_read_context->runtime_state->query_id();
    _read_options.io_ctx.read_file_cache =
            _read_context->runtime_state->query_options().enable_file_cache;
    _read_options.io_ctx.is_disposable =
            _read_context->runtime_state->query_options().disable_file_cache;
}
```

We use disposable cache to avoid IO amp and avoid large amount of
eviction from the cached data ("normal cache").

We cannot set the read option cache policy to "no cache" because it may
cause IO amp: every page IO will cause a remote IO, which is a
performance disaster.
gavinchou added a commit that referenced this pull request Aug 9, 2024
…#37141 (#39123)

Session variable `disable_file_cache` is processed as "disposable file
cache" in beta_rowset_reader.cpp.

```
if (_read_context->runtime_state != nullptr) {
    _read_options.io_ctx.query_id = &_read_context->runtime_state->query_id();
    _read_options.io_ctx.read_file_cache =
            _read_context->runtime_state->query_options().enable_file_cache;
    _read_options.io_ctx.is_disposable =
            _read_context->runtime_state->query_options().disable_file_cache;
}
```

We use disposable cache to avoid IO amp and avoid large amount of
eviction from the cached data ("normal cache").

We cannot set the read option cache policy to "no cache" because it may
cause IO amp: every page IO will cause a remote IO, which is a
performance disaster.
wyxxxcat pushed a commit to wyxxxcat/doris that referenced this pull request Aug 14, 2024
…apache#37141 (apache#39123)

Session variable `disable_file_cache` is processed as "disposable file
cache" in beta_rowset_reader.cpp.

```
if (_read_context->runtime_state != nullptr) {
    _read_options.io_ctx.query_id = &_read_context->runtime_state->query_id();
    _read_options.io_ctx.read_file_cache =
            _read_context->runtime_state->query_options().enable_file_cache;
    _read_options.io_ctx.is_disposable =
            _read_context->runtime_state->query_options().disable_file_cache;
}
```

We use disposable cache to avoid IO amp and avoid large amount of
eviction from the cached data ("normal cache").

We cannot set the read option cache policy to "no cache" because it may
cause IO amp: every page IO will cause a remote IO, which is a
performance disaster.
gavinchou added a commit that referenced this pull request Aug 16, 2024
…le_segment_cache in query (#37141)

Currently, whether to read from file cache or remote storage is
controlled by the BE config `enable_file_cache` in cloud mode.
This PR proposed to control the file cache behavior via session
variables when executing queries in cloud mode.
It's more convenient when have such a session variable, cache behavior
could be controlled per query/session without changing BE configs, such
as:
1. **Performance test**. Test the query performance when read from local
file cache or remote storage for queries.
2. **Data correctness**. Check if it's file cache issue for certain
tables or queries.

The read path has three kinds of caches: segment cache, page cache and
file cache.

| module       | cache| BE config    | session variable|
|------------|------|----------| ---- |
| Segment | segment cache | disable_segment_cache |
**enable_segment_cache** (supportted by this PR) |
| PageIO | page cache | disable_storage_page_cache | enable_page_cache |
| FileReader | file cache | enable_file_cache | **disable_file_cache**
(supportted by this PR) |

The modification of the PR:

- **enable_segment_cache**: add a new session variable
enable_segment_cache to control use segment cache or not.
- **disable_file_cache**: disable_file_cache was for write path in cloud
mode. It's supported for read path when executing queries in the PR.

With this PR,  data is read from remote storage without cache:
```sql
set enable_segment_cache=false;
set enable_page_cache=false;
set disable_file_cache=true;
```

Co-authored-by: Gavin Chou <gavineaglechou@gmail.com>
gavinchou added a commit that referenced this pull request Aug 16, 2024
…#37141 (#39123)

Session variable `disable_file_cache` is processed as "disposable file
cache" in beta_rowset_reader.cpp.

```
if (_read_context->runtime_state != nullptr) {
    _read_options.io_ctx.query_id = &_read_context->runtime_state->query_id();
    _read_options.io_ctx.read_file_cache =
            _read_context->runtime_state->query_options().enable_file_cache;
    _read_options.io_ctx.is_disposable =
            _read_context->runtime_state->query_options().disable_file_cache;
}
```

We use disposable cache to avoid IO amp and avoid large amount of
eviction from the cached data ("normal cache").

We cannot set the read option cache policy to "no cache" because it may
cause IO amp: every page IO will cause a remote IO, which is a
performance disaster.
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.2-merged doing meta-change reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants