Skip to content

Conversation

@wyxxxcat
Copy link
Contributor

pick: #52523

…#52523)

call this api to directly know how many resources need to be recycled at
this time (number and size (bytes)) in brpc metrics, even if
config::enable_recycler_metrics is false

```
// metrics
recycler_instance_to_recycle_num
recycler_instance_to_recycle_bytes
```

usage:
```
// brpc_listen_port is port of recycler
// If instance id is empty, no action will be performed.

// if instance id is "*", it will statistics all instances
curl "127.0.0.1:${brpc_listen_port}/RecyclerService/http/statistics_recycle?token=greedisgood9999" \
    -d '{
    "instance_ids" : ["*"],
    "resource_type" : ["recycle_indexes"]
}'

// if "resource_type" is empty or it is "*", it will statistics all resource types in all instances
curl "127.0.0.1:${brpc_listen_port}/RecyclerService/http/statistics_recycle?token=xxxx" \
    -d '{
    "instance_ids" : ["default_instance_id", "default_instance_id_0", ...]
}'
curl "127.0.0.1:${brpc_listen_port}/RecyclerService/http/statistics_recycle?token=greedisgood9999" \
    -d '{
    "instance_ids" : ["*"]
}'

// else it is not empty, it will only stastics specified resource type
// such as rowset, index, partition
curl "127.0.0.1:${brpc_listen_port}/RecyclerService/http/statistics_recycle?token=xxxx" \
    -d '{
    "instance_ids" : ["default_instance_id", "default_instance_id_0", ...],
    "resource_type" : ["recycle_rowsets", "recycle_indexes", "recycle_partitions", ...]
}'

// invalid arg
curl "127.0.0.1:5271/RecyclerService/http/statistics_recycle?token=xxx" \
    -d '{
    "instance_ids" : ["default_instance_id"],
    "resource_type" : ["11"]
}'
invalid resource type: invalid_resource_type, valid resource_type have [recycle_indexes, recycle_partitions, recycle_tmp_rowsets, recycle_rowsets, abort_timeout_txn, recycle_expired_txn_label, recycle_versions, recycle_copy_jobs, recycle_stage, recycle_expired_stage_objects, recycle_tablet, recycle_segment]

curl "127.0.0.1:5271/RecyclerService/http/statistics_recycle?token=xxx" \
    -d '{
    "instance_ids" : ["invalid_instance_id"]
}'
invalid instance id: invalid_instance_id

```
eg.
```
curl "127.0.0.1:5271/RecyclerService/http/statistics_recycle?token=greedisgood9999" \
    -d '{
    "instance_ids" : ["*"],
    "resource_type" : ["*"]
}'

Instance ID: default_instance_id
----------------------------------------
Task Type: abort_timeout_txn
  • Need to abort timeout txn count: 0 items
  • Need to recycle timeout txn size: 0 bytes
----------------------------------------
Task Type: recycle_copy_jobs
  • Need to recycle copy job count: 0 items
  • Need to recycle copy job size: 0 bytes
----------------------------------------
Task Type: recycle_expired_stage_objects
  • Need to recycle expired stage object count: 0 items
  • Need to recycle expired stage object size: 0 bytes
----------------------------------------
Task Type: recycle_expired_txn_label
  • Need to recycle expired txn label count: 24 items
  • Need to recycle expired txn label size: 0 bytes
----------------------------------------
Task Type: recycle_indexes
  • Need to recycle index count: 4 items
  • Need to recycle index size: 16195 bytes
----------------------------------------
Task Type: recycle_partitions
  • Need to recycle partition count: 0 items
  • Need to recycle partition size: 0 bytes
----------------------------------------
Task Type: recycle_rowsets
  • Need to recycle rowset count: 9 items
  • Need to recycle rowset size: 7573 bytes
----------------------------------------
Task Type: recycle_segment
  • Need to recycle segment count: 48 items
  • Need to recycle segment size: 55604 bytes
----------------------------------------
Task Type: recycle_stage
  • Need to recycle stage count: 0 items
  • Need to recycle stage size: 0 bytes
----------------------------------------
Task Type: recycle_tablet
  • Need to recycle tablet count: 30 items
  • Need to recycle tablet size: 16195 bytes
----------------------------------------
Task Type: recycle_tmp_rowsets
  • Need to recycle tmp rowset count: 0 items
  • Need to recycle tmp rowset size: 0 bytes
----------------------------------------
Task Type: recycle_versions
  • Need to recycle version count: 0 items
  • Need to recycle version size: 0 bytes
----------------------------------------
```
```
curl "127.0.0.1:5271/RecyclerService/http/statistics_recycle?token=greedisgood9999" \
    -d '{
    "instance_ids" : ["*"],
    "resource_type" : ["recycle_indexes","recycle_tablet","recycle_segment","recycle_rowsets"]
}'

Instance ID: default_instance_id
----------------------------------------
Task Type: recycle_indexes
  • Need to recycle index count: 4 items
  • Need to recycle index size: 16195 bytes
----------------------------------------
Task Type: recycle_rowsets
  • Need to recycle rowset count: 9 items
  • Need to recycle rowset size: 7573 bytes
----------------------------------------
Task Type: recycle_segment
  • Need to recycle segment count: 48 items
  • Need to recycle segment size: 55604 bytes
----------------------------------------
Task Type: recycle_tablet
  • Need to recycle tablet count: 30 items
  • Need to recycle tablet size: 16195 bytes
----------------------------------------
```
@wyxxxcat wyxxxcat requested a review from morrySnow as a code owner July 11, 2025 09:04
@Thearas
Copy link
Contributor

Thearas commented Jul 11, 2025

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?

@wyxxxcat
Copy link
Contributor Author

run buildall

@hello-stephen
Copy link
Contributor

Cloud UT Coverage Report

Increment line coverage 16.95% (169/997) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 81.18% (1182/1456)
Line Coverage 65.25% (20435/31319)
Region Coverage 66.72% (10395/15579)
Branch Coverage 56.55% (5493/9714)

@doris-robot
Copy link

BE UT Coverage Report

Increment line coverage 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 45.21% (12504/27659)
Line Coverage 36.11% (111050/307500)
Region Coverage 35.24% (57461/163034)
Branch Coverage 32.35% (31198/96444)

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17821	6783	6614	6614
q2	2099	208	173	173
q3	10648	1139	1127	1127
q4	10539	774	773	773
q5	7755	2951	2859	2859
q6	220	140	135	135
q7	998	623	604	604
q8	9355	1942	1976	1942
q9	6734	6426	6425	6425
q10	7022	2302	2310	2302
q11	464	263	267	263
q12	428	212	203	203
q13	17783	2956	3000	2956
q14	244	222	208	208
q15	507	467	471	467
q16	484	377	377	377
q17	1007	554	554	554
q18	7361	6570	6734	6570
q19	1362	1008	903	903
q20	489	195	196	195
q21	3871	3029	3168	3029
q22	1085	997	974	974
Total cold run time: 108276 ms
Total hot run time: 39653 ms

----- Round 2, with runtime_filter_mode=off -----
q1	6708	6569	6529	6529
q2	327	229	235	229
q3	2868	2977	2962	2962
q4	2059	1835	1815	1815
q5	5698	5744	5721	5721
q6	209	128	129	128
q7	2216	1785	1838	1785
q8	3378	3530	3572	3530
q9	8702	8977	8929	8929
q10	3563	3510	3509	3509
q11	594	489	473	473
q12	801	596	627	596
q13	9497	3164	3123	3123
q14	298	265	271	265
q15	519	464	462	462
q16	485	433	442	433
q17	1866	1626	1633	1626
q18	8326	7754	7855	7754
q19	1713	1594	1571	1571
q20	2035	1846	1853	1846
q21	5249	4981	4964	4964
q22	1121	1059	1062	1059
Total cold run time: 68232 ms
Total hot run time: 59309 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 197294 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 8f152997b6333df630adcb30ef0ef8663830a0d9, data reload: false

query1	1284	921	897	897
query2	6363	1917	1883	1883
query3	10802	4594	4395	4395
query4	33487	23838	23652	23652
query5	4441	479	467	467
query6	268	195	202	195
query7	4002	318	329	318
query8	303	232	232	232
query9	9519	2585	2580	2580
query10	478	261	265	261
query11	18119	15262	15488	15262
query12	163	105	104	104
query13	1595	431	433	431
query14	9935	6624	6682	6624
query15	264	186	197	186
query16	7867	455	483	455
query17	1617	621	621	621
query18	2187	353	321	321
query19	240	169	167	167
query20	138	115	117	115
query21	209	110	112	110
query22	4875	4876	4679	4679
query23	35152	34394	34284	34284
query24	12357	2944	2854	2854
query25	692	435	437	435
query26	1470	172	173	172
query27	3410	364	352	352
query28	7347	2215	2186	2186
query29	919	489	446	446
query30	256	157	156	156
query31	1029	832	858	832
query32	93	55	58	55
query33	777	309	308	308
query34	960	504	500	500
query35	887	717	719	717
query36	1111	967	1009	967
query37	141	64	71	64
query38	4150	3951	4041	3951
query39	1538	1456	1465	1456
query40	253	103	106	103
query41	47	47	48	47
query42	115	101	101	101
query43	517	478	492	478
query44	1300	813	819	813
query45	186	171	177	171
query46	1168	736	765	736
query47	2055	1915	2001	1915
query48	457	335	356	335
query49	952	388	393	388
query50	848	420	412	412
query51	7487	7369	7165	7165
query52	105	93	94	93
query53	256	187	181	181
query54	1032	462	464	462
query55	77	79	76	76
query56	270	261	245	245
query57	1349	1229	1238	1229
query58	250	218	231	218
query59	3341	3145	3112	3112
query60	304	273	263	263
query61	109	114	113	113
query62	851	683	718	683
query63	220	187	188	187
query64	4086	671	659	659
query65	3557	3296	3191	3191
query66	1025	294	300	294
query67	16104	15569	15592	15569
query68	4526	574	593	574
query69	443	260	261	260
query70	1149	1133	1093	1093
query71	342	262	252	252
query72	6377	4045	4105	4045
query73	777	342	369	342
query74	10368	9241	8949	8949
query75	3412	2605	2677	2605
query76	2698	948	1071	948
query77	380	272	277	272
query78	10654	9719	9605	9605
query79	1823	591	590	590
query80	1116	429	435	429
query81	543	222	223	222
query82	927	87	91	87
query83	231	145	139	139
query84	239	81	87	81
query85	1310	316	307	307
query86	408	292	297	292
query87	4369	4275	4266	4266
query88	3603	2394	2361	2361
query89	420	289	289	289
query90	1919	187	182	182
query91	137	106	105	105
query92	61	50	56	50
query93	2014	557	547	547
query94	884	290	284	284
query95	362	247	250	247
query96	608	285	287	285
query97	3337	3150	3220	3150
query98	212	200	193	193
query99	1514	1314	1320	1314
Total cold run time: 305929 ms
Total hot run time: 197294 ms

@doris-robot
Copy link

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

query1	0.04	0.03	0.02
query2	0.08	0.05	0.05
query3	0.23	0.05	0.05
query4	1.64	0.07	0.08
query5	0.53	0.51	0.51
query6	1.12	0.75	0.75
query7	0.02	0.02	0.02
query8	0.05	0.05	0.05
query9	0.55	0.50	0.49
query10	0.55	0.57	0.58
query11	0.16	0.12	0.12
query12	0.15	0.13	0.13
query13	0.62	0.60	0.60
query14	0.80	0.79	0.83
query15	0.84	0.86	0.83
query16	0.38	0.37	0.38
query17	1.08	1.03	1.07
query18	0.18	0.19	0.17
query19	1.98	1.78	1.87
query20	0.02	0.01	0.02
query21	15.39	0.67	0.67
query22	3.72	7.12	1.96
query23	18.26	1.37	1.37
query24	2.20	0.22	0.22
query25	0.16	0.09	0.09
query26	0.27	0.18	0.18
query27	0.09	0.08	0.08
query28	13.32	0.61	0.57
query29	12.66	3.32	3.38
query30	0.25	0.06	0.05
query31	2.90	0.41	0.39
query32	3.22	0.48	0.48
query33	3.01	3.00	3.06
query34	16.71	4.51	4.54
query35	4.58	4.59	4.61
query36	0.66	0.47	0.48
query37	0.21	0.18	0.17
query38	0.16	0.16	0.16
query39	0.05	0.04	0.04
query40	0.17	0.13	0.12
query41	0.10	0.05	0.05
query42	0.07	0.05	0.05
query43	0.05	0.05	0.04
Total cold run time: 109.23 s
Total hot run time: 30.99 s

@morrySnow morrySnow merged commit ad1ec0e into apache:branch-3.1 Jul 14, 2025
20 of 22 checks passed
@morrySnow morrySnow changed the title [branch-3.1] [feat](recycler) Add http api for statistics recycler metrics #52523 branch-3.1: [feat](recycler) Add http api for statistics recycler metrics #52523 Jul 14, 2025
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.

5 participants