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](compaction) Add an http action for visibility of compaction score on each tablet #38489

Merged

Conversation

TangSiyang2001
Copy link
Collaborator

@TangSiyang2001 TangSiyang2001 commented Jul 29, 2024

Proposed changes

As title.

Usage:

  1. curl http://be_ip:be_host/api/compaction_score?top_n=10
    Returns a json object contains compaction score for top n, n=top_n.
[
    {
        "compaction_score": "5",
        "tablet_id": "42595"
    },
    {
        "compaction_score": "5",
        "tablet_id": "42587"
    },
    {
        "compaction_score": "5",
        "tablet_id": "42593"
    },
    {
        "compaction_score": "5",
        "tablet_id": "42597"
    },
    {
        "compaction_score": "5",
        "tablet_id": "42589"
    },
    {
        "compaction_score": "5",
        "tablet_id": "42599"
    },
    {
        "compaction_score": "5",
        "tablet_id": "42601"
    },
    {
        "compaction_score": "5",
        "tablet_id": "42591"
    },
    {
        "compaction_score": "5",
        "tablet_id": "42585"
    },
    {
        "compaction_score": "4",
        "tablet_id": "10034"
    }
]

If top_n is not specified, return all compaction score for all tablets.
If top_n is illegal, raise an error.

invalid argument: top_n=wrong
  1. curl http://be_ip:be_host/api/compaction_score?sync_meta=true
    sync_meta is only available on cloud mode, will sync meta from meta service. It can cooperate with top_n.
    If add param sync_meta on non-cloud mode, will raise an error.
sync meta is only available for cloud mode
  1. In the future, this endpoint may extend other utility, like fetching tablet compaction score by table id, 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.

@TangSiyang2001 TangSiyang2001 changed the title [feature](compaction) Add a http action for visibility of compaction score on each tablet [feature](compaction) Add an http action for visibility of compaction score on each tablet Jul 29, 2024
Copy link
Contributor

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

Copy link
Contributor

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

@TangSiyang2001 TangSiyang2001 force-pushed the tablet-compaction-score-http branch 3 times, most recently from 1302446 to 2caa8c2 Compare July 29, 2024 11:40
Copy link
Contributor

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

1 similar comment
Copy link
Contributor

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

@TangSiyang2001
Copy link
Collaborator Author

run compile

Copy link
Contributor

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

@TangSiyang2001
Copy link
Collaborator Author

run compile

Copy link
Contributor

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

1 similar comment
Copy link
Contributor

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

Copy link
Contributor

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

@TangSiyang2001
Copy link
Collaborator Author

run buildall

@TangSiyang2001 TangSiyang2001 marked this pull request as ready for review July 30, 2024 10:00
@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	18376	4237	4171	4171
q2	2763	220	212	212
q3	12142	1262	1361	1262
q4	10556	812	971	812
q5	7874	3023	2964	2964
q6	225	139	142	139
q7	1048	620	612	612
q8	9449	1857	1916	1857
q9	8613	6631	6622	6622
q10	8721	3837	3810	3810
q11	433	266	254	254
q12	412	228	228	228
q13	17752	2962	2959	2959
q14	274	243	244	243
q15	524	484	474	474
q16	485	400	385	385
q17	961	921	925	921
q18	8233	7425	7224	7224
q19	1388	1215	1215	1215
q20	575	311	335	311
q21	5325	4754	4640	4640
q22	347	281	279	279
Total cold run time: 116476 ms
Total hot run time: 41594 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4088	4052	4047	4047
q2	332	229	227	227
q3	2977	3022	2997	2997
q4	1896	1879	1871	1871
q5	5272	5259	5243	5243
q6	219	131	131	131
q7	2082	1716	1706	1706
q8	3245	3276	3287	3276
q9	8338	8289	8322	8289
q10	3730	3815	3834	3815
q11	540	462	455	455
q12	726	544	524	524
q13	14418	2958	2967	2958
q14	283	276	262	262
q15	514	475	482	475
q16	468	398	408	398
q17	1740	1711	1708	1708
q18	7765	7289	7288	7288
q19	1680	1666	1674	1666
q20	1998	1788	1770	1770
q21	5520	5261	5216	5216
q22	527	467	451	451
Total cold run time: 68358 ms
Total hot run time: 54773 ms

@doris-robot
Copy link

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

query1	925	378	385	378
query2	6468	1665	1644	1644
query3	6679	213	225	213
query4	20333	17544	17318	17318
query5	4295	518	503	503
query6	287	172	162	162
query7	4600	287	311	287
query8	263	200	190	190
query9	8555	2379	2363	2363
query10	440	267	263	263
query11	10517	10064	10038	10038
query12	139	93	87	87
query13	1645	384	372	372
query14	9736	8577	7846	7846
query15	221	164	169	164
query16	7099	467	441	441
query17	967	560	573	560
query18	1927	297	290	290
query19	200	151	147	147
query20	97	87	88	87
query21	207	103	101	101
query22	4095	3908	4064	3908
query23	33855	33027	33163	33027
query24	10579	3105	3052	3052
query25	727	408	402	402
query26	1746	152	150	150
query27	2891	274	274	274
query28	6901	1956	1949	1949
query29	1362	430	432	430
query30	286	151	153	151
query31	961	763	764	763
query32	107	57	58	57
query33	715	333	320	320
query34	926	473	491	473
query35	857	730	736	730
query36	1004	864	857	857
query37	289	79	80	79
query38	2880	2772	2776	2772
query39	856	822	811	811
query40	290	118	115	115
query41	54	48	47	47
query42	129	103	106	103
query43	477	402	414	402
query44	1202	722	751	722
query45	208	180	186	180
query46	1076	806	796	796
query47	1815	1700	1708	1700
query48	368	298	293	293
query49	1218	432	525	432
query50	919	433	426	426
query51	6839	6672	6650	6650
query52	104	96	95	95
query53	251	178	178	178
query54	647	453	462	453
query55	77	73	76	73
query56	280	257	253	253
query57	1127	1026	1039	1026
query58	292	282	269	269
query59	2769	2306	2437	2306
query60	292	274	275	274
query61	99	97	96	96
query62	926	674	663	663
query63	223	184	187	184
query64	5873	1913	1899	1899
query65	3152	3109	3113	3109
query66	1462	338	362	338
query67	15572	14682	14719	14682
query68	7123	561	584	561
query69	680	378	315	315
query70	1130	1037	1087	1037
query71	519	277	268	268
query72	7630	2713	2521	2521
query73	978	323	359	323
query74	5990	5655	5622	5622
query75	3899	2723	2735	2723
query76	5418	1404	1414	1404
query77	677	305	306	305
query78	9512	8848	8848	8848
query79	3197	528	537	528
query80	1241	504	498	498
query81	562	223	223	223
query82	751	131	136	131
query83	208	167	171	167
query84	274	85	77	77
query85	1438	378	306	306
query86	430	281	298	281
query87	3277	3110	3107	3107
query88	3626	2402	2412	2402
query89	436	289	287	287
query90	2047	192	193	192
query91	128	107	103	103
query92	67	49	48	48
query93	3915	611	600	600
query94	952	294	262	262
query95	388	266	267	266
query96	611	279	284	279
query97	3216	3065	3031	3031
query98	223	195	191	191
query99	1664	1304	1281	1281
Total cold run time: 276585 ms
Total hot run time: 169610 ms

@doris-robot
Copy link

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

query1	0.04	0.04	0.03
query2	0.07	0.03	0.04
query3	0.22	0.04	0.05
query4	1.68	0.07	0.07
query5	0.48	0.48	0.48
query6	1.13	0.71	0.72
query7	0.02	0.02	0.01
query8	0.05	0.04	0.05
query9	0.57	0.51	0.52
query10	0.57	0.58	0.57
query11	0.16	0.12	0.11
query12	0.15	0.12	0.13
query13	0.61	0.60	0.59
query14	0.78	0.80	0.80
query15	0.89	0.86	0.86
query16	0.35	0.35	0.36
query17	1.02	1.02	0.99
query18	0.21	0.21	0.22
query19	1.86	1.74	1.78
query20	0.01	0.02	0.01
query21	15.80	0.80	0.65
query22	3.59	7.53	1.63
query23	18.01	1.33	1.40
query24	2.26	0.23	0.22
query25	0.18	0.08	0.09
query26	0.31	0.22	0.21
query27	0.45	0.23	0.24
query28	13.18	0.99	0.97
query29	12.55	3.28	3.25
query30	0.26	0.05	0.05
query31	2.86	0.41	0.38
query32	3.27	0.48	0.48
query33	2.91	2.99	2.96
query34	15.44	4.27	4.21
query35	4.27	4.30	4.32
query36	0.67	0.47	0.49
query37	0.19	0.16	0.16
query38	0.17	0.15	0.16
query39	0.04	0.03	0.03
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.64 s
Total hot run time: 30.28 s

score_key.SetString(key_name.data(), key_name.size());

rapidjson::Value score_val;
auto score =
Copy link
Contributor

Choose a reason for hiding this comment

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

no need to distinguish between base and cumu

@TangSiyang2001 TangSiyang2001 marked this pull request as draft August 2, 2024 09:41
Copy link
Contributor

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

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

be/src/http/action/compaction_score_action.h Show resolved Hide resolved
@TangSiyang2001
Copy link
Collaborator Author

run buildall

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 36.81% (9385/25496)
Line Coverage: 28.22% (77415/274329)
Region Coverage: 27.62% (39972/144704)
Branch Coverage: 24.26% (20339/83842)
Coverage Report: http://coverage.selectdb-in.cc/coverage/356ef167fe27f1e6ad6dc0288decf1e81d84a30b_356ef167fe27f1e6ad6dc0288decf1e81d84a30b/report/index.html

@TangSiyang2001
Copy link
Collaborator Author

run performance

gavinchou
gavinchou previously approved these changes Sep 10, 2024
Copy link
Contributor

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

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Sep 10, 2024
@github-actions github-actions bot removed the approved Indicates a PR has been approved by one committer. label Sep 10, 2024
@TangSiyang2001
Copy link
Collaborator Author

run buildall

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 36.81% (9385/25496)
Line Coverage: 28.21% (77376/274328)
Region Coverage: 27.62% (39966/144704)
Branch Coverage: 24.26% (20338/83842)
Coverage Report: http://coverage.selectdb-in.cc/coverage/0b936bd3fb0c4632dbdde93a73fe9e46641e26fb_0b936bd3fb0c4632dbdde93a73fe9e46641e26fb/report/index.html

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17961	4531	4391	4391
q2	2034	194	197	194
q3	11740	977	1207	977
q4	10500	751	727	727
q5	7750	2910	2867	2867
q6	231	140	141	140
q7	969	628	613	613
q8	9343	2112	2133	2112
q9	7033	6578	6617	6578
q10	7052	2189	2267	2189
q11	535	248	249	248
q12	394	227	230	227
q13	18968	3131	3113	3113
q14	287	239	243	239
q15	542	497	490	490
q16	551	415	436	415
q17	987	745	792	745
q18	7497	7014	6898	6898
q19	1390	1073	1070	1070
q20	688	341	350	341
q21	4022	3295	3172	3172
q22	1153	1032	1028	1028
Total cold run time: 111627 ms
Total hot run time: 38774 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4391	4913	4387	4387
q2	397	278	269	269
q3	2912	2678	2663	2663
q4	1980	1755	1795	1755
q5	5792	5769	5771	5769
q6	236	139	139	139
q7	2218	1826	1858	1826
q8	3280	3586	3494	3494
q9	8938	8815	8848	8815
q10	3666	3361	3323	3323
q11	626	529	510	510
q12	882	696	624	624
q13	15464	3289	3266	3266
q14	323	299	292	292
q15	542	493	490	490
q16	565	487	477	477
q17	1868	1553	1557	1553
q18	8281	7922	7912	7912
q19	1784	1755	1453	1453
q20	2148	1937	1927	1927
q21	5915	5580	5410	5410
q22	1113	1036	1041	1036
Total cold run time: 73321 ms
Total hot run time: 57390 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 192876 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 0b936bd3fb0c4632dbdde93a73fe9e46641e26fb, data reload: false

query1	1264	888	874	874
query2	6443	1976	1980	1976
query3	10711	4155	4104	4104
query4	59847	24259	23300	23300
query5	5384	481	481	481
query6	409	176	158	158
query7	5770	301	293	293
query8	337	272	220	220
query9	8826	2532	2539	2532
query10	488	284	264	264
query11	18313	15127	15422	15127
query12	164	101	102	101
query13	1565	430	405	405
query14	10826	7025	7161	7025
query15	226	179	170	170
query16	7543	506	493	493
query17	1218	605	553	553
query18	2006	292	289	289
query19	297	166	149	149
query20	119	108	114	108
query21	213	110	103	103
query22	4650	4418	4791	4418
query23	34245	33955	33499	33499
query24	5959	2855	2882	2855
query25	492	368	400	368
query26	670	156	159	156
query27	1750	282	280	280
query28	3823	2048	2039	2039
query29	639	401	410	401
query30	233	155	159	155
query31	928	714	773	714
query32	101	49	56	49
query33	426	279	284	279
query34	865	478	466	466
query35	850	710	724	710
query36	1087	938	945	938
query37	145	82	84	82
query38	4113	3886	3887	3886
query39	1429	1481	1385	1385
query40	190	116	113	113
query41	47	43	44	43
query42	115	95	96	95
query43	532	489	483	483
query44	1064	737	738	737
query45	194	162	164	162
query46	1091	767	753	753
query47	1883	1776	1802	1776
query48	383	296	300	296
query49	782	417	425	417
query50	848	416	416	416
query51	7051	6817	6762	6762
query52	98	84	84	84
query53	249	182	182	182
query54	578	466	454	454
query55	77	75	77	75
query56	292	251	260	251
query57	1200	1084	1060	1060
query58	221	227	221	221
query59	2965	2877	3012	2877
query60	290	273	262	262
query61	101	101	101	101
query62	744	651	650	650
query63	217	194	184	184
query64	2704	679	674	674
query65	3232	3189	3143	3143
query66	668	343	336	336
query67	15352	15104	15267	15104
query68	2999	595	605	595
query69	398	286	273	273
query70	1135	1125	1111	1111
query71	347	277	272	272
query72	5135	4074	4013	4013
query73	743	332	335	332
query74	9229	8933	8804	8804
query75	3361	2714	2722	2714
query76	1389	981	1058	981
query77	525	322	334	322
query78	9612	9052	9623	9052
query79	1059	551	530	530
query80	703	499	503	499
query81	536	230	229	229
query82	277	140	136	136
query83	175	149	151	149
query84	263	74	77	74
query85	666	277	279	277
query86	298	301	294	294
query87	4558	4241	4347	4241
query88	3170	2360	2334	2334
query89	373	291	286	286
query90	1694	194	188	188
query91	135	112	110	110
query92	60	51	51	51
query93	1051	551	551	551
query94	548	308	275	275
query95	336	261	267	261
query96	584	269	267	267
query97	3221	3079	3046	3046
query98	219	211	207	207
query99	1534	1286	1312	1286
Total cold run time: 303875 ms
Total hot run time: 192876 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 0b936bd3fb0c4632dbdde93a73fe9e46641e26fb, data reload: false

query1	0.04	0.04	0.04
query2	0.08	0.04	0.04
query3	0.23	0.05	0.06
query4	1.67	0.08	0.08
query5	0.51	0.49	0.48
query6	1.13	0.74	0.73
query7	0.02	0.01	0.01
query8	0.06	0.05	0.05
query9	0.54	0.49	0.49
query10	0.54	0.57	0.55
query11	0.16	0.12	0.12
query12	0.15	0.13	0.12
query13	0.61	0.59	0.59
query14	1.42	1.40	1.42
query15	0.84	0.86	0.83
query16	0.35	0.36	0.37
query17	1.07	1.01	1.01
query18	0.21	0.20	0.20
query19	1.80	1.77	1.89
query20	0.01	0.02	0.01
query21	15.38	0.69	0.68
query22	4.55	6.76	1.99
query23	18.32	1.36	1.36
query24	2.09	0.25	0.23
query25	0.16	0.08	0.08
query26	0.27	0.18	0.18
query27	0.07	0.07	0.08
query28	13.21	1.02	1.00
query29	12.59	3.31	3.29
query30	0.24	0.05	0.06
query31	2.88	0.39	0.40
query32	3.25	0.49	0.48
query33	2.98	2.98	3.01
query34	17.03	4.42	4.42
query35	4.49	4.43	4.51
query36	0.66	0.49	0.48
query37	0.18	0.16	0.16
query38	0.15	0.16	0.16
query39	0.05	0.04	0.04
query40	0.16	0.12	0.13
query41	0.10	0.05	0.05
query42	0.06	0.05	0.04
query43	0.05	0.04	0.04
Total cold run time: 110.36 s
Total hot run time: 31.65 s

Copy link
Contributor

@dataroaring dataroaring left a comment

Choose a reason for hiding this comment

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

LGTM

@dataroaring dataroaring merged commit 140857f into apache:master Sep 10, 2024
22 of 27 checks passed
@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Sep 10, 2024
Copy link
Contributor

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

@dataroaring dataroaring added dev/2.1.x and removed approved Indicates a PR has been approved by one committer. labels Sep 10, 2024
TangSiyang2001 added a commit to TangSiyang2001/doris that referenced this pull request Sep 13, 2024
… score on each tablet (apache#38489)

As title.

Usage:
1. `curl http://be_ip:be_host/api/compaction_score?top_n=10`
Returns a json object contains compaction score for top n, n=top_n.
```
[
    {
        "compaction_score": "5",
        "tablet_id": "42595"
    },
    {
        "compaction_score": "5",
        "tablet_id": "42587"
    },
    {
        "compaction_score": "5",
        "tablet_id": "42593"
    },
    {
        "compaction_score": "5",
        "tablet_id": "42597"
    },
    {
        "compaction_score": "5",
        "tablet_id": "42589"
    },
    {
        "compaction_score": "5",
        "tablet_id": "42599"
    },
    {
        "compaction_score": "5",
        "tablet_id": "42601"
    },
    {
        "compaction_score": "5",
        "tablet_id": "42591"
    },
    {
        "compaction_score": "5",
        "tablet_id": "42585"
    },
    {
        "compaction_score": "4",
        "tablet_id": "10034"
    }
]
```
If top_n is not specified, return all compaction score for all tablets.
If top_n is illegal, raise an error.
```
invalid argument: top_n=wrong
```

2. `curl http://be_ip:be_host/api/compaction_score?sync_meta=true`
`sync_meta` is only available on cloud mode, will sync meta from meta
service. It can cooperate with top_n.
If add param `sync_meta` on non-cloud mode, will raise an error.
```
sync meta is only available for cloud mode
```

3. In the future, this endpoint may extend other utility, like fetching
tablet compaction score by table id, etc.
yiguolei pushed a commit that referenced this pull request Sep 21, 2024
… score on each tablet (#38489) (#40826)

pick: #38489 

Usage:
1. `curl http://be_ip:be_host/api/compaction_score?top_n=10` Returns a
json object contains compaction score for top n, n=top_n.
```
[
    {
        "compaction_score": "5",
        "tablet_id": "42595"
    },
    {
        "compaction_score": "5",
        "tablet_id": "42587"
    },
    {
        "compaction_score": "5",
        "tablet_id": "42593"
    },
    {
        "compaction_score": "5",
        "tablet_id": "42597"
    },
    {
        "compaction_score": "5",
        "tablet_id": "42589"
    },
    {
        "compaction_score": "5",
        "tablet_id": "42599"
    },
    {
        "compaction_score": "5",
        "tablet_id": "42601"
    },
    {
        "compaction_score": "5",
        "tablet_id": "42591"
    },
    {
        "compaction_score": "5",
        "tablet_id": "42585"
    },
    {
        "compaction_score": "4",
        "tablet_id": "10034"
    }
]
```
If top_n is not specified, return all compaction score for all tablets.
If top_n is illegal, raise an error.
```
invalid argument: top_n=wrong
```

2. `curl http://be_ip:be_host/api/compaction_score?sync_meta=true`
`sync_meta` is only available on cloud mode, will sync meta from meta
service. It can cooperate with top_n.
If add param `sync_meta` on non-cloud mode, will raise an error.
```
sync meta is only available for cloud mode
```

3. In the future, this endpoint may extend other utility, like fetching
tablet compaction score by table id, etc.

## Proposed changes

Issue Number: close #xxx

<!--Describe your changes.-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants