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

branch-3.0: [improvement](memory) Storage page cache use LRU-K cache, K=2 #45719 #45879

Closed
wants to merge 1 commit into from

Conversation

github-actions[bot]
Copy link
Contributor

Cherry-picked from #45719

### What problem does this PR solve?

Storage page cache uses plain LRU Cache, occasional batch operations can
cause "cache pollution" in plain LRU Cache. This will cause hotspot data
to be squeezed out of the cache by non-hotspot data, reduce cache hit
rate.

In extreme cases, if the number of pages inserted each time is greater
than the cache capacity, the cache hit rate will be 0.

Introducing LRU-K Cache avoids "cache pollution" in most cases.

Last submitted #28794
Similar PR: #23546

Performance test on branch-2.1:
1-FE, 3-BE (32 Core, 128GB Memory) Doris cluster
`ssb_sf_1000` all query cost: 18.85s -> 14.44s, 23% improvement
`ssb_flat_1000` all query cost: 12.21s -> 8.54s, 30% improvement, cache
hit rate 1% -> 40%
@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?

@dataroaring dataroaring reopened this Dec 24, 2024
@hello-stephen
Copy link
Contributor

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17726	6316	6133	6133
q2	2616	287	156	156
q3	11558	1284	711	711
q4	10834	896	473	473
q5	7726	2445	2162	2162
q6	206	181	147	147
q7	917	755	609	609
q8	9392	1485	1182	1182
q9	5507	5033	4906	4906
q10	6846	2298	1833	1833
q11	487	276	264	264
q12	335	365	206	206
q13	17790	3539	2959	2959
q14	237	221	206	206
q15	569	512	516	512
q16	651	627	611	611
q17	593	882	355	355
q18	7172	6563	6292	6292
q19	4094	1061	639	639
q20	306	317	191	191
q21	2825	2174	1972	1972
q22	1084	1023	996	996
Total cold run time: 109471 ms
Total hot run time: 33515 ms

----- Round 2, with runtime_filter_mode=off -----
q1	6558	6222	6277	6222
q2	232	332	223	223
q3	2194	2610	2210	2210
q4	1353	1747	1279	1279
q5	4461	5307	5031	5031
q6	177	170	134	134
q7	2042	1860	1789	1789
q8	2556	2788	2698	2698
q9	7230	7191	7067	7067
q10	2955	3256	2775	2775
q11	596	511	500	500
q12	670	758	602	602
q13	3331	3803	3132	3132
q14	280	303	298	298
q15	574	518	530	518
q16	662	727	660	660
q17	1205	1774	1216	1216
q18	7575	7318	7031	7031
q19	798	972	1102	972
q20	1879	1921	1792	1792
q21	7353	4956	4613	4613
q22	1087	1083	988	988
Total cold run time: 55768 ms
Total hot run time: 51750 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 189437 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 1f9b0799b03f5ff163a83fa7461de712f3ce50a6, data reload: false

query1	967	381	363	363
query2	6514	2082	2112	2082
query3	6708	215	215	215
query4	33717	23727	23478	23478
query5	4332	593	439	439
query6	257	186	178	178
query7	4613	517	310	310
query8	299	239	226	226
query9	9390	2688	2667	2667
query10	479	329	280	280
query11	18109	15273	15060	15060
query12	144	100	98	98
query13	1623	526	399	399
query14	10041	6437	6841	6437
query15	212	186	181	181
query16	7806	630	514	514
query17	1526	736	554	554
query18	1986	415	326	326
query19	200	177	151	151
query20	118	119	116	116
query21	62	50	49	49
query22	4490	4311	4437	4311
query23	35061	33553	33951	33553
query24	7672	2620	2647	2620
query25	509	467	401	401
query26	1222	276	164	164
query27	2074	428	296	296
query28	5568	2477	2445	2445
query29	726	570	435	435
query30	260	198	163	163
query31	993	885	791	791
query32	71	60	58	58
query33	515	343	289	289
query34	717	828	503	503
query35	753	806	731	731
query36	988	1047	934	934
query37	109	99	71	71
query38	3887	3919	3871	3871
query39	1514	1446	1448	1446
query40	146	100	85	85
query41	53	52	48	48
query42	112	101	96	96
query43	525	532	493	493
query44	1285	782	780	780
query45	184	177	169	169
query46	855	1029	654	654
query47	1865	1908	1853	1853
query48	429	444	397	397
query49	779	470	392	392
query50	617	648	399	399
query51	7221	7134	7030	7030
query52	106	101	90	90
query53	234	254	188	188
query54	546	535	468	468
query55	77	75	78	75
query56	264	263	245	245
query57	1152	1163	1099	1099
query58	235	216	211	211
query59	3210	3107	3120	3107
query60	290	265	259	259
query61	133	127	129	127
query62	817	735	666	666
query63	227	186	183	183
query64	4521	961	623	623
query65	3261	3181	3191	3181
query66	1047	420	298	298
query67	15895	15788	15362	15362
query68	8922	776	540	540
query69	465	292	256	256
query70	1154	1126	1134	1126
query71	427	271	236	236
query72	5655	3685	3754	3685
query73	633	745	336	336
query74	9514	8881	8911	8881
query75	4507	3078	2613	2613
query76	4689	1157	732	732
query77	777	352	268	268
query78	10481	11470	9587	9587
query79	11015	819	574	574
query80	699	521	401	401
query81	508	270	237	237
query82	684	154	112	112
query83	177	161	142	142
query84	287	94	76	76
query85	802	359	293	293
query86	346	322	283	283
query87	4401	4325	4245	4245
query88	5151	2332	2368	2332
query89	444	327	293	293
query90	1944	182	183	182
query91	174	175	145	145
query92	62	53	48	48
query93	4313	925	521	521
query94	659	377	302	302
query95	330	249	246	246
query96	476	599	278	278
query97	3278	3303	3208	3208
query98	224	206	193	193
query99	1583	1423	1283	1283
Total cold run time: 307099 ms
Total hot run time: 189437 ms

@doris-robot
Copy link

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

query1	0.03	0.03	0.03
query2	0.06	0.04	0.03
query3	0.23	0.07	0.07
query4	1.66	0.10	0.10
query5	0.53	0.53	0.54
query6	1.13	0.73	0.72
query7	0.03	0.02	0.01
query8	0.05	0.04	0.03
query9	0.58	0.50	0.50
query10	0.55	0.55	0.55
query11	0.14	0.10	0.10
query12	0.13	0.12	0.11
query13	0.60	0.59	0.58
query14	2.98	3.03	2.98
query15	0.88	0.82	0.81
query16	0.38	0.38	0.38
query17	1.01	1.01	0.96
query18	0.24	0.22	0.21
query19	1.97	1.86	2.02
query20	0.02	0.01	0.01
query21	15.36	0.97	0.55
query22	0.75	0.78	0.55
query23	15.38	1.42	0.55
query24	2.68	1.52	1.26
query25	0.18	0.15	0.07
query26	0.21	0.15	0.13
query27	0.07	0.04	0.05
query28	13.82	1.51	1.03
query29	12.52	3.80	3.17
query30	0.26	0.09	0.06
query31	2.82	0.57	0.37
query32	3.22	0.54	0.47
query33	2.96	3.02	3.11
query34	16.84	5.20	4.53
query35	4.51	4.48	4.50
query36	0.65	0.51	0.48
query37	0.09	0.07	0.06
query38	0.05	0.04	0.04
query39	0.04	0.02	0.02
query40	0.16	0.13	0.12
query41	0.08	0.03	0.03
query42	0.03	0.02	0.02
query43	0.04	0.03	0.03
Total cold run time: 105.92 s
Total hot run time: 31.65 s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants