Skip to content

[improvement](metrics) Export file cache remote index byte metrics#65398

Open
hoshinojyunn wants to merge 1 commit into
apache:masterfrom
hoshinojyunn:feat/profile
Open

[improvement](metrics) Export file cache remote index byte metrics#65398
hoshinojyunn wants to merge 1 commit into
apache:masterfrom
hoshinojyunn:feat/profile

Conversation

@hoshinojyunn

@hoshinojyunn hoshinojyunn commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Issue Number: None

Related PR: None

Problem Summary:

File cache statistics already track the remote-read bytes for inverted index and segment footer
index data, but BE Doris metrics only export the aggregate cache/local/remote/peer byte counters.
As a result, these two index-specific remote read costs are visible in query profile internals but
not exposed from the BE /metrics endpoint, which makes them harder to monitor and alert on in
cloud/file-cache scenarios.

This PR exposes the following two BE metrics:

  • doris_be_inverted_index_bytes_read_from_remote
  • doris_be_segment_footer_index_bytes_read_from_remote

The change keeps the existing file cache metrics aggregation path and extends it in three places:

  1. Register the two counters in DorisMetrics
  2. Extend FileCacheMetrics::AtomicStatistics and the aggregation/update path to accumulate them
  3. Export them from the existing metrics hook and cover the behavior with a BE unit test

Release note

Add two new BE metrics for file cache remote index read bytes:

  • doris_be_inverted_index_bytes_read_from_remote
  • doris_be_segment_footer_index_bytes_read_from_remote

Check List (For Author)

  • Test

    • Regression test
      • ./run-regression-test.sh --run -d cloud_p0 -s test_file_cache_remote_index_byte_metrics -runMode=cloud
    • Unit Test
      • ./run-be-ut.sh --run --filter=DorisMetricsTest.*:FileCacheProfileReporterTest.*
    • 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
Copy Markdown
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?

@hoshinojyunn

Copy link
Copy Markdown
Contributor Author

run buildall

Issue Number: None

Related PR: None

Problem Summary: File cache profile statistics already track `inverted_index_bytes_read_from_remote` and `segment_footer_index_bytes_read_from_remote`, but BE Doris metrics only exported aggregate cache, remote, and peer read bytes. That made these index-specific remote read costs visible in query profile only, not in the BE metrics endpoint. This change registers two new Doris metrics, extends the existing `FileCacheMetrics` aggregation path to accumulate them, and exports them through the normal metrics hook. The update also extends the existing file cache profile unit test helpers so segment footer index statistics are covered and adds a test for the new metric export path.

Expose `inverted_index_bytes_read_from_remote` and `segment_footer_index_bytes_read_from_remote` in BE Doris metrics.

- Test: Manual compile verification
    - Started `./run-be-ut.sh --run --filter=FileCacheProfileReporterTest.*`, but it triggered a large `doris_be_test` rebuild and was interrupted after the changed objects compiled successfully
    - Recompiled changed objects with `ninja -C be/ut_build_ASAN src/common/CMakeFiles/Common.dir/metrics/doris_metrics.cpp.o src/io/CMakeFiles/IO.dir/cache/block_file_cache_profile.cpp.o test/CMakeFiles/doris_be_test.dir/io/cache/block_file_cache_profile_reporter_test.cpp.o`
- Behavior changed: Yes (adds two new BE metrics for file cache remote index bytes)
- Does this need documentation: No
@hoshinojyunn

Copy link
Copy Markdown
Contributor Author

run buildall

@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	17589	4150	4107	4107
q2	1995	371	212	212
q3	10284	1529	851	851
q4	4719	515	346	346
q5	7708	874	563	563
q6	225	182	144	144
q7	795	843	618	618
q8	10376	1480	1544	1480
q9	6266	4430	4398	4398
q10	6811	1831	1554	1554
q11	526	357	310	310
q12	711	587	443	443
q13	18164	3451	2719	2719
q14	279	276	241	241
q15	q16	793	789	703	703
q17	952	994	1089	994
q18	6988	5886	5684	5684
q19	1189	1294	1086	1086
q20	775	640	524	524
q21	5921	2682	2611	2611
q22	450	374	303	303
Total cold run time: 103516 ms
Total hot run time: 29891 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	4509	4467	4448	4448
q2	306	350	226	226
q3	4741	5063	4466	4466
q4	2359	2418	1386	1386
q5	4687	4565	5057	4565
q6	286	223	151	151
q7	2143	1841	1624	1624
q8	2695	2361	2346	2346
q9	8187	8011	8135	8011
q10	5059	5135	4345	4345
q11	624	455	398	398
q12	819	803	567	567
q13	3266	3922	2968	2968
q14	321	327	283	283
q15	q16	795	751	659	659
q17	1428	1399	1356	1356
q18	8458	7578	6986	6986
q19	1079	1057	1043	1043
q20	2267	2242	1948	1948
q21	5703	4903	4834	4834
q22	566	498	417	417
Total cold run time: 60298 ms
Total hot run time: 53027 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-DS: Total hot run time: 181241 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 da72c65c497598542fd89c30fb6bab9510eb0e55, data reload: false

query5	4355	632	479	479
query6	459	215	200	200
query7	4833	548	341	341
query8	334	188	174	174
query9	8787	4149	4134	4134
query10	478	359	314	314
query11	5927	2354	2160	2160
query12	152	105	100	100
query13	1268	630	446	446
query14	6554	5315	4973	4973
query14_1	4326	4343	4330	4330
query15	213	201	182	182
query16	1056	495	479	479
query17	1154	738	598	598
query18	2716	510	363	363
query19	213	189	155	155
query20	119	118	108	108
query21	232	159	138	138
query22	13592	13604	13425	13425
query23	17301	16488	16303	16303
query23_1	16259	16347	16378	16347
query24	7520	1801	1296	1296
query24_1	1333	1315	1325	1315
query25	584	470	392	392
query26	1189	345	207	207
query27	2589	625	395	395
query28	4441	2064	2045	2045
query29	1100	638	514	514
query30	342	261	229	229
query31	1114	1104	990	990
query32	111	74	71	71
query33	549	338	263	263
query34	1188	1134	675	675
query35	773	799	669	669
query36	1425	1401	1277	1277
query37	154	110	95	95
query38	1869	1705	1642	1642
query39	923	932	903	903
query39_1	886	871	910	871
query40	243	167	135	135
query41	66	61	65	61
query42	93	91	91	91
query43	324	328	287	287
query44	1444	784	781	781
query45	204	183	177	177
query46	1093	1230	774	774
query47	2364	2357	2311	2311
query48	408	379	298	298
query49	586	463	319	319
query50	998	429	331	331
query51	10869	10723	10844	10723
query52	84	90	77	77
query53	257	281	207	207
query54	274	232	222	222
query55	75	74	65	65
query56	291	276	282	276
query57	1425	1402	1348	1348
query58	279	277	260	260
query59	1563	1631	1453	1453
query60	327	269	251	251
query61	161	151	153	151
query62	714	655	592	592
query63	244	201	210	201
query64	2488	1032	877	877
query65	4859	4793	4820	4793
query66	1720	516	392	392
query67	29540	29406	29298	29298
query68	3347	1512	962	962
query69	452	309	273	273
query70	1083	1004	985	985
query71	356	334	310	310
query72	3089	2731	2307	2307
query73	848	803	440	440
query74	5142	4931	4750	4750
query75	2605	2584	2239	2239
query76	2315	1186	787	787
query77	360	385	293	293
query78	12431	12242	11923	11923
query79	1446	1232	778	778
query80	1273	531	474	474
query81	538	332	287	287
query82	596	156	126	126
query83	362	321	294	294
query84	278	157	129	129
query85	936	625	506	506
query86	443	287	290	287
query87	1828	1824	1767	1767
query88	3755	2794	2796	2794
query89	477	402	358	358
query90	1883	206	204	204
query91	204	189	163	163
query92	66	62	59	59
query93	1687	1640	1064	1064
query94	739	360	310	310
query95	772	496	485	485
query96	1063	759	342	342
query97	2697	2679	2577	2577
query98	228	207	201	201
query99	1134	1165	1034	1034
Total cold run time: 266311 ms
Total hot run time: 181241 ms

@hello-stephen

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

query1	0.00	0.00	0.00
query2	0.09	0.05	0.05
query3	0.26	0.14	0.13
query4	1.61	0.14	0.15
query5	0.24	0.22	0.23
query6	1.23	1.05	1.14
query7	0.04	0.01	0.00
query8	0.05	0.03	0.03
query9	0.37	0.33	0.32
query10	0.55	0.57	0.54
query11	0.19	0.14	0.14
query12	0.19	0.14	0.14
query13	0.47	0.48	0.47
query14	1.02	1.01	1.00
query15	0.63	0.60	0.60
query16	0.31	0.34	0.33
query17	1.13	1.17	1.14
query18	0.23	0.22	0.22
query19	2.03	1.99	1.94
query20	0.02	0.01	0.02
query21	15.43	0.19	0.14
query22	4.94	0.06	0.05
query23	16.14	0.30	0.12
query24	2.89	0.41	0.33
query25	0.11	0.06	0.04
query26	0.71	0.20	0.14
query27	0.05	0.04	0.03
query28	3.54	0.96	0.56
query29	12.45	4.08	3.28
query30	0.28	0.15	0.16
query31	2.77	0.60	0.31
query32	3.22	0.60	0.50
query33	3.19	3.26	3.29
query34	15.68	4.23	3.52
query35	3.58	3.55	3.59
query36	0.56	0.42	0.43
query37	0.09	0.06	0.07
query38	0.04	0.04	0.04
query39	0.04	0.03	0.02
query40	0.18	0.17	0.16
query41	0.09	0.04	0.03
query42	0.04	0.03	0.03
query43	0.04	0.04	0.03
Total cold run time: 96.72 s
Total hot run time: 25.24 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.

2 participants