Skip to content

[fix](s3) Add S3 rate limit observability#64038

Merged
liaoxin01 merged 5 commits into
apache:masterfrom
gavinchou:gavin-log-s3-rate-limit-observability
Jul 15, 2026
Merged

[fix](s3) Add S3 rate limit observability#64038
liaoxin01 merged 5 commits into
apache:masterfrom
gavinchou:gavin-log-s3-rate-limit-observability

Conversation

@gavinchou

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Add observability for S3 local rate limiting and S3 429 responses so throttling-related performance issues can be diagnosed and alerted more directly.

What is changed?

  • Add explicit S3 local rate limiter bvars for sleep duration, sleep count, and rejected count.
  • Rename the old ambiguous S3 local rate limiter bvars so their meaning is clear.
  • Log the first and every N local S3 rate limiter throttled/rejected requests without reading bvar values for decisions.
  • Add S3 429 retry/failure bvars for S3/Azure object clients.
  • Update S3 rate limiter unit coverage for sleep and rejected metrics.

New or renamed bvar metrics

Renamed local S3 GET limiter metrics:

  • get_rate_limit_ns -> s3_get_rate_limit_sleep_ns
  • get_rate_limit_exceed_req_num -> s3_get_rate_limit_sleep_count

Renamed local S3 PUT limiter metrics:

  • put_rate_limit_ns -> s3_put_rate_limit_sleep_ns
  • put_rate_limit_exceed_req_num -> s3_put_rate_limit_sleep_count

New local S3 limiter rejection metrics:

  • s3_get_rate_limit_rejected_count
  • s3_put_rate_limit_rejected_count

New S3 429 metrics:

  • s3_request_retry_too_many_requests_count
  • s3_request_failed_too_many_requests_count

Metric examples:

s3_get_rate_limit_sleep_ns : 123456789
s3_get_rate_limit_sleep_count : 42
s3_get_rate_limit_rejected_count : 3
s3_put_rate_limit_sleep_ns : 987654321
s3_put_rate_limit_sleep_count : 27
s3_put_rate_limit_rejected_count : 1
s3_request_retry_too_many_requests_count : 8
s3_request_failed_too_many_requests_count : 2

Example local limiter logs:

S3 GET request is throttled by local rate limiter, sleep_ms=12, sleep_count=1000, token_per_second=1000, bucket_tokens=2000, token_limit=5000
S3 PUT request is rejected by local rate limiter, rejected_count=1, token_per_second=1000, bucket_tokens=2000, token_limit=5000

Tests

  • sh run-cloud-ut.sh --run --filter=s3_rate_limiter_test:*
  • sh run-be-ut.sh --run --filter=S3FileWriterTest.*

Note: an earlier BE run used an incorrect lowercase filter (s3_file_writer_test:*), which matched no suite and started running the full BE suite; it was stopped and replaced by the correct S3FileWriterTest.* run above.

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

@gavinchou

Copy link
Copy Markdown
Contributor Author

run buildall

@gavinchou

Copy link
Copy Markdown
Contributor Author

/review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I found coverage gaps in the new S3 throttling observability. The BE object-client path uses the new helper/counters, but the Cloud recycler has parallel S3/Azure object-client paths that still use the old limiter metrics and do not record final 429 failures. This means the new bvars can under-report or completely miss recycler throttling, even though the recycler uses the same retry strategy and is an important object-storage consumer.

Critical checkpoint conclusions:

  • Goal/test: The PR adds S3 local limiter and 429 observability, with unit coverage for the holder metrics, but the goal is only partially met because Cloud recycler paths are not covered.
  • Scope/focus: The change is generally focused, but parallel object-storage paths were missed.
  • Concurrency/lifecycle: New atomic log counters and bvar adders are safe for concurrent updates; no new lock-order risk found.
  • Config: The new mutable log interval has validation and is read dynamically where the BE helper is used.
  • Compatibility: Bvar renames are user-visible; Cloud still exposes old names, so behavior is inconsistent across binaries.
  • Parallel code paths: Cloud recycler S3/Azure clients are parallel paths and need the same accounting.
  • Tests: Existing tests cover only the generic holder metric callback, not BE vs Cloud end-to-end metric coverage.
  • Observability: Needs fixes below so the new observability is complete.

User focus: No additional user-provided review focus was specified.

return [&](int64_t ns) {
inline auto metric_func_factory(bvar::Adder<int64_t>& sleep_ns_bvar,
bvar::Adder<int64_t>& sleep_count_bvar,
bvar::Adder<int64_t>* rejected_count_bvar = nullptr) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Making the rejected counter optional leaves an existing S3 limiter path without the new metric. cloud/src/recycler/s3_accessor.cpp still constructs its AccessorRateLimiter with the old two-argument call (get_rate_limit_ns, get_rate_limit_exceed_req_num, etc.), and cloud/src/recycler/s3_obj_client.cpp / azure_obj_client.cpp call AccessorRateLimiter::instance().rate_limiter(op)->add(1) directly. As a result, recycler local limiter rejections still do not increment s3_get_rate_limit_rejected_count / s3_put_rate_limit_rejected_count, and the newly added throttled/rejected logging in apply_s3_rate_limit() is bypassed there. This contradicts the PR's stated metric rename/new rejection metric behavior for S3 local limiting. Please update the Cloud recycler accessor path to use the renamed bvars and pass rejection counters, or route it through a shared helper with the same logging/accounting.

bvar::Adder<int64_t> s3_request_failed_too_many_requests_count(
"s3_request_failed_too_many_requests_count");

void record_object_request_failed(int http_code) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The new final-429 failure counter is common, but only the BE object clients call record_object_request_failed(). The Cloud recycler also installs S3CustomRetryStrategy / AzureRetryRecordPolicy in cloud/src/recycler/s3_accessor.cpp, so retry 429s from recycler requests are counted, but final 429 failures in cloud/src/recycler/s3_obj_client.cpp and azure_obj_client.cpp just log/return without calling this function. That makes s3_request_failed_too_many_requests_count under-report exactly the recycler failures that still exhausted retries. Please add the same failure recording to the Cloud S3/Azure non-success paths (excluding expected not-found handling) so the retry and failed 429 metrics cover the same object-client paths.

@hello-stephen

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

------ Round 1 ----------------------------------
orders	Doris	NULL	NULL	0	0	0	NULL	0	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	17860	4113	4073	4073
q2	q3	10749	1532	844	844
q4	4721	474	347	347
q5	7809	882	596	596
q6	215	173	135	135
q7	848	839	665	665
q8	10541	1575	1598	1575
q9	7317	4567	4551	4551
q10	6789	1849	1555	1555
q11	426	289	257	257
q12	644	429	298	298
q13	18148	3397	2783	2783
q14	271	256	242	242
q15	q16	822	801	711	711
q17	974	907	966	907
q18	6963	5704	5549	5549
q19	1181	1312	1082	1082
q20	527	401	258	258
q21	5698	2594	2531	2531
q22	438	361	302	302
Total cold run time: 102941 ms
Total hot run time: 29261 ms

----- Round 2, with runtime_filter_mode=off -----
orders	Doris	NULL	NULL	150000000	42	6422171781	NULL	22778155	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	4368	4269	4263	4263
q2	q3	4530	4993	4341	4341
q4	2084	2224	1372	1372
q5	4443	4316	4358	4316
q6	226	171	129	129
q7	2174	1861	1708	1708
q8	2573	2178	2109	2109
q9	8036	7944	8065	7944
q10	4891	4850	4493	4493
q11	569	420	386	386
q12	748	755	587	587
q13	3270	3660	3003	3003
q14	309	317	281	281
q15	q16	716	732	653	653
q17	1372	1321	1371	1321
q18	7945	7142	6890	6890
q19	1207	1118	1105	1105
q20	2291	2219	1954	1954
q21	5272	4580	4405	4405
q22	523	463	412	412
Total cold run time: 57547 ms
Total hot run time: 51672 ms

@hello-stephen

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

query5	4322	648	475	475
query6	440	197	181	181
query7	4866	565	292	292
query8	361	214	193	193
query9	8769	4008	3981	3981
query10	463	314	252	252
query11	5921	2362	2220	2220
query12	158	103	100	100
query13	1264	568	425	425
query14	6441	5433	5067	5067
query14_1	4423	4423	4443	4423
query15	212	199	182	182
query16	1032	460	438	438
query17	1126	731	592	592
query18	2506	529	328	328
query19	198	176	137	137
query20	119	104	102	102
query21	213	145	122	122
query22	13626	13573	13416	13416
query23	17403	16524	16098	16098
query23_1	16230	16223	16376	16223
query24	7551	1797	1289	1289
query24_1	1316	1306	1313	1306
query25	550	441	381	381
query26	1294	303	164	164
query27	2705	582	342	342
query28	4457	2023	2007	2007
query29	1064	627	487	487
query30	308	236	200	200
query31	1153	1071	966	966
query32	110	60	62	60
query33	514	307	257	257
query34	1199	1158	676	676
query35	749	780	702	702
query36	1416	1401	1209	1209
query37	150	103	89	89
query38	3234	3150	3048	3048
query39	945	925	902	902
query39_1	890	912	898	898
query40	218	123	135	123
query41	66	65	61	61
query42	96	93	93	93
query43	318	323	274	274
query44	
query45	194	184	179	179
query46	1078	1260	777	777
query47	2377	2416	2213	2213
query48	406	405	291	291
query49	634	483	372	372
query50	1015	347	249	249
query51	4405	4305	4249	4249
query52	87	87	76	76
query53	243	273	188	188
query54	270	215	194	194
query55	79	75	67	67
query56	233	233	217	217
query57	1443	1395	1296	1296
query58	242	225	206	206
query59	1578	1668	1433	1433
query60	285	243	232	232
query61	159	156	159	156
query62	694	678	592	592
query63	229	186	184	184
query64	2527	798	615	615
query65	
query66	1802	481	352	352
query67	29753	29626	29629	29626
query68	
query69	415	297	302	297
query70	942	979	919	919
query71	291	219	212	212
query72	3003	2659	2373	2373
query73	858	760	452	452
query74	5147	4945	4785	4785
query75	2668	2558	2208	2208
query76	2305	1156	785	785
query77	355	389	282	282
query78	12371	12300	11740	11740
query79	1280	1021	751	751
query80	534	469	386	386
query81	452	284	240	240
query82	247	163	125	125
query83	356	275	247	247
query84	271	142	115	115
query85	952	612	520	520
query86	334	303	270	270
query87	3377	3374	3207	3207
query88	3618	2744	2742	2742
query89	416	390	335	335
query90	2040	183	184	183
query91	207	159	141	141
query92	60	62	58	58
query93	1425	1510	880	880
query94	538	357	310	310
query95	688	470	359	359
query96	1051	779	341	341
query97	2682	2674	2556	2556
query98	219	205	202	202
query99	1183	1159	1034	1034
Total cold run time: 250858 ms
Total hot run time: 168900 ms

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 21.82% (12/55) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 73.92% (28251/38218)
Line Coverage 57.86% (307415/531330)
Region Coverage 54.52% (257263/471853)
Branch Coverage 56.06% (111632/199144)

@wyxxxcat

wyxxxcat commented Jun 3, 2026

Copy link
Copy Markdown
Collaborator

Consider supporting recyclers as well? A general framework could be written in doris/common

@gavinchou
gavinchou force-pushed the gavin-log-s3-rate-limit-observability branch from e989d8a to ac67923 Compare June 4, 2026 14:54
@gavinchou

Copy link
Copy Markdown
Contributor Author

/review

@gavinchou

Copy link
Copy Markdown
Contributor Author

run buildall

@gavinchou

Copy link
Copy Markdown
Contributor Author

Addressed the review comments in ac67923.

  • For github-actions: Cloud recycler S3/Azure paths now use the shared S3 local rate limiter accounting from common, expose the renamed sleep/rejected bvars, use sampled throttled/rejected logging, and record final 429 failures on non-success paths while excluding expected not-found handling.
  • For wyxxxcat: moved the shared S3 rate limiter metric/log helper into common/cpp/token_bucket_rate_limiter so BE and recycler use the same framework instead of separate BE-only logic.

Validation:

  • Passed: sh run-cloud-ut.sh --run --filter=s3_rate_limiter_test:*
  • BE rerun note: sh run-be-ut.sh --run --filter=S3FileWriterTest.* is currently blocked before test execution by an unrelated third-party apache-orc/protobuf build error (PROTOBUF_* previously defined). The same command passed before these review fixes, and the current failure occurs while compiling contrib/apache-orc, not changed Doris sources.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I found one blocking concurrency issue in the new S3 rate-limiter logging path. The existing recycler metric coverage comments are already-known context and appear addressed in this revision, so I did not duplicate them.

Critical checkpoint conclusions:

  • Goal/test: the PR adds S3/Azure retry/final-429 metrics and local limiter sleep/rejection metrics/logging, with unit coverage for metric accounting. The goal is mostly met, but the logging implementation introduces an unsafe concurrent access.
  • Scope/focus: the change is focused on object-storage retry/rate-limit accounting.
  • Concurrency: affected. reset_s3_rate_limiter() can replace TokenBucketRateLimiterHolder::rate_limiter under the write lock while request threads call apply_s3_rate_limit(). The new log code reads holder state after add() releases the read lock, creating a race/use-after-free risk.
  • Lifecycle/static initialization: no additional cross-TU static initialization issue found beyond existing global bvars.
  • Configuration: s3_rate_limiter_log_interval is added with validation and is read dynamically at call sites.
  • Compatibility: no storage/protocol compatibility issue found.
  • Parallel paths: BE S3/Azure and Cloud recycler S3/Azure paths were reviewed; prior missing Cloud paths are covered in this revision.
  • Conditional checks/error handling: expected not-found handling is preserved for the reviewed object-client paths.
  • Test coverage: metric unit coverage exists, but no concurrent reset/logging coverage protects the race below.
  • Observability/performance: new metrics/logging are useful, but the log state reads must be made concurrency-safe.
  • Transactions/persistence/data writes/FE-BE variables: not applicable to this PR.

User focus response: no additional user-provided focus was specified.

<< ", sleep_ms=" << sleep_duration / 1000000 << ", sleep_count=" << count
<< ", token_per_second=" << rate_limiter->get_max_speed()
<< ", bucket_tokens=" << rate_limiter->get_max_burst()
<< ", token_limit=" << rate_limiter->get_limit();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This log path now reads rate_limiter->get_max_speed() / get_max_burst() / get_limit() after TokenBucketRateLimiterHolder::add() has returned and released its shared_lock. Both BE and Cloud expose reset_s3_rate_limiter() paths that take the holder write lock and replace the underlying unique_ptr (rate_limiter = std::make_unique<...>). A request thread that reaches this log branch can therefore race with a dynamic reset and dereference the replaced/freed limiter through these unlocked getters. Please keep the logged configuration snapshot under the same holder lock as add() (or return/snapshot the values from add() while locked) before logging.

@hello-stephen

Copy link
Copy Markdown
Contributor

Cloud UT Coverage Report

Increment line coverage 19.23% (5/26) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 78.65% (1919/2440)
Line Coverage 64.80% (34061/52561)
Region Coverage 65.36% (17568/26878)
Branch Coverage 53.97% (9318/17266)

@hello-stephen

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

------ Round 1 ----------------------------------
orders	Doris	NULL	NULL	0	0	0	NULL	0	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	17660	4169	4173	4169
q2	q3	10760	1400	854	854
q4	4689	494	354	354
q5	7556	910	580	580
q6	189	197	144	144
q7	800	908	644	644
q8	9375	1663	1616	1616
q9	5754	4532	4561	4532
q10	6813	1813	1535	1535
q11	433	287	259	259
q12	627	444	302	302
q13	18127	3469	2830	2830
q14	273	263	252	252
q15	q16	836	780	720	720
q17	1000	950	1007	950
q18	6897	5763	5628	5628
q19	1324	1318	1109	1109
q20	511	400	268	268
q21	6372	2889	2730	2730
q22	478	401	341	341
Total cold run time: 100474 ms
Total hot run time: 29817 ms

----- Round 2, with runtime_filter_mode=off -----
orders	Doris	NULL	NULL	150000000	42	6422171781	NULL	22778155	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	5412	4966	4952	4952
q2	q3	4960	5250	4755	4755
q4	2227	2349	1435	1435
q5	4968	5005	4790	4790
q6	242	186	137	137
q7	1963	1766	1669	1669
q8	2660	2321	2284	2284
q9	8016	7803	7469	7469
q10	4799	4758	4286	4286
q11	573	424	389	389
q12	753	748	576	576
q13	3052	3454	2823	2823
q14	275	283	268	268
q15	q16	706	718	631	631
q17	1301	1285	1293	1285
q18	7594	6849	6844	6844
q19	1156	1097	1092	1092
q20	2258	2240	1967	1967
q21	5407	4696	4601	4601
q22	529	475	420	420
Total cold run time: 58851 ms
Total hot run time: 52673 ms

@hello-stephen

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

query5	4333	645	504	504
query6	456	218	201	201
query7	4827	601	321	321
query8	372	228	215	215
query9	8777	4079	4100	4079
query10	451	324	262	262
query11	5909	2375	2180	2180
query12	158	104	104	104
query13	1275	626	448	448
query14	6443	5473	5183	5183
query14_1	4493	4515	4508	4508
query15	210	201	180	180
query16	1009	456	386	386
query17	948	707	597	597
query18	2454	493	385	385
query19	207	184	148	148
query20	114	107	105	105
query21	224	149	124	124
query22	13643	13642	13426	13426
query23	17269	16580	16183	16183
query23_1	16227	16273	16315	16273
query24	7545	1775	1341	1341
query24_1	1333	1303	1332	1303
query25	562	481	405	405
query26	1328	344	172	172
query27	2667	549	351	351
query28	4528	2026	2064	2026
query29	1109	637	497	497
query30	310	241	207	207
query31	1137	1105	955	955
query32	112	66	66	66
query33	536	342	267	267
query34	1246	1201	646	646
query35	758	791	680	680
query36	1365	1368	1237	1237
query37	158	107	87	87
query38	3198	3170	3100	3100
query39	926	902	896	896
query39_1	878	866	869	866
query40	220	125	103	103
query41	69	64	64	64
query42	98	93	93	93
query43	333	324	283	283
query44	
query45	197	188	183	183
query46	1100	1206	735	735
query47	2342	2325	2226	2226
query48	419	402	294	294
query49	634	471	356	356
query50	994	376	256	256
query51	4328	4294	4350	4294
query52	89	91	81	81
query53	242	273	196	196
query54	268	221	207	207
query55	77	75	76	75
query56	243	239	222	222
query57	1427	1380	1283	1283
query58	241	218	215	215
query59	1642	1756	1533	1533
query60	296	254	240	240
query61	164	159	164	159
query62	699	641	593	593
query63	242	186	184	184
query64	2616	806	646	646
query65	
query66	1803	465	363	363
query67	29842	29723	28999	28999
query68	
query69	416	307	269	269
query70	944	995	966	966
query71	298	229	210	210
query72	3052	2742	2390	2390
query73	866	791	431	431
query74	5127	4965	4813	4813
query75	2653	2609	2261	2261
query76	2343	1166	767	767
query77	355	379	299	299
query78	12411	12478	11848	11848
query79	1421	1034	790	790
query80	617	479	386	386
query81	453	291	242	242
query82	589	165	123	123
query83	355	286	252	252
query84	308	144	116	116
query85	872	542	438	438
query86	372	301	301	301
query87	3384	3375	3201	3201
query88	3674	2769	2720	2720
query89	431	381	330	330
query90	1928	199	188	188
query91	182	171	142	142
query92	64	60	69	60
query93	1528	1479	884	884
query94	550	361	336	336
query95	692	476	365	365
query96	1025	831	353	353
query97	2730	2700	2533	2533
query98	213	206	209	206
query99	1141	1180	1027	1027
Total cold run time: 251629 ms
Total hot run time: 169463 ms

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 43.48% (10/23) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 71.91% (27512/38261)
Line Coverage 55.45% (294603/531289)
Region Coverage 52.18% (245741/470967)
Branch Coverage 53.34% (106252/199199)

@wyxxxcat

wyxxxcat commented Jun 7, 2026

Copy link
Copy Markdown
Collaborator

run buildall

@hello-stephen

Copy link
Copy Markdown
Contributor

Cloud UT Coverage Report

Increment line coverage 19.23% (5/26) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 78.65% (1919/2440)
Line Coverage 64.85% (34085/52561)
Region Coverage 65.37% (17569/26878)
Branch Coverage 53.99% (9322/17266)

@hello-stephen

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

------ Round 1 ----------------------------------
orders	Doris	NULL	NULL	0	0	0	NULL	0	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	17648	4106	4027	4027
q2	q3	10771	1402	850	850
q4	4713	486	344	344
q5	7735	872	610	610
q6	203	171	137	137
q7	805	834	650	650
q8	10434	1653	1666	1653
q9	7467	4554	4512	4512
q10	6777	1842	1560	1560
q11	446	277	257	257
q12	647	425	291	291
q13	18118	3427	2825	2825
q14	280	263	251	251
q15	q16	824	794	720	720
q17	954	1001	950	950
q18	7020	5733	5742	5733
q19	1175	1262	1079	1079
q20	521	551	303	303
q21	6108	2793	2646	2646
q22	464	379	320	320
Total cold run time: 103110 ms
Total hot run time: 29718 ms

----- Round 2, with runtime_filter_mode=off -----
orders	Doris	NULL	NULL	150000000	42	6422171781	NULL	22778155	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	4877	4739	5097	4739
q2	q3	4914	5218	4703	4703
q4	2199	2175	1428	1428
q5	4971	4740	4795	4740
q6	231	179	132	132
q7	1921	1766	1587	1587
q8	2240	1964	1951	1951
q9	7380	7430	7360	7360
q10	4764	4670	4239	4239
q11	535	386	356	356
q12	735	746	545	545
q13	3050	3430	2798	2798
q14	274	291	252	252
q15	q16	672	710	602	602
q17	1287	1255	1255	1255
q18	7341	7026	6654	6654
q19	1147	1099	1084	1084
q20	2234	2221	1945	1945
q21	5310	4594	4495	4495
q22	529	456	409	409
Total cold run time: 56611 ms
Total hot run time: 51274 ms

@hello-stephen

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

query5	4335	657	477	477
query6	438	219	181	181
query7	5006	551	303	303
query8	359	216	206	206
query9	8787	4014	4001	4001
query10	453	335	258	258
query11	5969	2354	2173	2173
query12	161	103	100	100
query13	1273	560	414	414
query14	6413	5469	5027	5027
query14_1	4358	4349	4359	4349
query15	206	195	180	180
query16	1058	457	420	420
query17	1125	707	566	566
query18	2422	487	347	347
query19	199	182	144	144
query20	110	106	104	104
query21	210	141	115	115
query22	13617	13602	13341	13341
query23	17439	16476	16121	16121
query23_1	16390	16286	16418	16286
query24	7480	1753	1317	1317
query24_1	1287	1309	1330	1309
query25	574	466	421	421
query26	1294	316	169	169
query27	2698	576	337	337
query28	4475	1993	2001	1993
query29	1089	609	489	489
query30	319	235	197	197
query31	1129	1068	972	972
query32	114	61	61	61
query33	526	314	243	243
query34	1177	1147	638	638
query35	763	772	687	687
query36	1401	1443	1246	1246
query37	163	105	93	93
query38	3229	3121	3032	3032
query39	945	898	902	898
query39_1	893	892	893	892
query40	215	122	102	102
query41	67	70	64	64
query42	97	95	94	94
query43	313	325	289	289
query44	
query45	200	185	188	185
query46	1068	1177	743	743
query47	2360	2411	2275	2275
query48	399	391	303	303
query49	631	474	363	363
query50	946	352	253	253
query51	4420	4313	4232	4232
query52	88	96	78	78
query53	246	266	201	201
query54	279	228	197	197
query55	83	74	72	72
query56	246	231	228	228
query57	1457	1416	1351	1351
query58	274	237	233	233
query59	1590	1699	1477	1477
query60	303	268	255	255
query61	192	172	182	172
query62	707	675	581	581
query63	225	207	193	193
query64	2642	838	675	675
query65	
query66	1841	484	356	356
query67	29789	29696	29540	29540
query68	
query69	442	320	280	280
query70	958	995	921	921
query71	306	231	222	222
query72	3078	2868	2379	2379
query73	889	756	407	407
query74	5127	4984	4773	4773
query75	2657	2613	2244	2244
query76	2316	1143	752	752
query77	354	365	269	269
query78	12375	12542	11939	11939
query79	1488	1017	782	782
query80	716	481	396	396
query81	480	276	241	241
query82	563	156	123	123
query83	343	279	246	246
query84	262	144	112	112
query85	924	528	485	485
query86	421	304	285	285
query87	3419	3339	3182	3182
query88	3612	2725	2698	2698
query89	436	377	328	328
query90	1801	182	175	175
query91	183	165	137	137
query92	65	64	62	62
query93	1561	1421	879	879
query94	600	353	274	274
query95	679	399	340	340
query96	1037	785	324	324
query97	2708	2744	2545	2545
query98	211	211	200	200
query99	1177	1175	1059	1059
Total cold run time: 252101 ms
Total hot run time: 169618 ms

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 43.48% (10/23) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 73.82% (28250/38269)
Line Coverage 57.86% (307471/531384)
Region Coverage 54.73% (257805/471068)
Branch Coverage 56.11% (111791/199244)

liaoxin01
liaoxin01 previously approved these changes Jun 7, 2026

@liaoxin01 liaoxin01 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@gavinchou

Copy link
Copy Markdown
Contributor Author

run buildall

@gavinchou

Copy link
Copy Markdown
Contributor Author

/review

@github-actions github-actions Bot removed the approved Indicates a PR has been approved by one committer. label Jul 6, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Requesting changes for one remaining observability gap: BE Azure batch delete subresponse failures can still bypass the new final-429 failure counter.

Critical checkpoint conclusions:

  • Goal/test coverage: the PR adds S3 local limiter and 429 observability, but the accepted inline issue leaves one BE Azure final-failure path undercounted. The added unit coverage checks limiter sleep/rejected metrics; I did not find coverage for this BE Azure batch failure path.
  • Scope/focus: the implementation is otherwise focused on S3/Azure rate-limiter logging, bvars, retry/failure accounting, config, and a Cloud rate-limiter unit test.
  • Concurrency/lifecycle: the known unlocked limiter logging/reset race remains duplicate of existing thread discussion_r3356989298, so I did not duplicate it.
  • Config/compatibility: the new BE and Cloud log interval configs are mutable and read at request time. Metric renames are user-visible observability changes but do not affect storage or FE/BE protocol compatibility.
  • Parallel paths: BE and Cloud S3/Azure paths were compared. Cloud Azure batch deferred failures record the helper; the BE Azure batch path is the remaining gap called out inline.
  • Transaction/persistence/data correctness: not applicable to this PR; no Doris transaction, storage-format, or persisted metadata path is changed.
  • Performance/observability: logging is interval-gated; the inline issue affects observability accuracy for 429 failures.

User focus: no additional user-provided review focus was supplied.

Subagent conclusions: optimizer-rewrite found no optimizer/planner relevance and no new findings. tests-session-config marked the unlocked logging race as duplicate of existing thread discussion_r3356989298 and independently confirmed the BE Azure batch issue as duplicate of MAIN-001. Convergence round 1 ended with both live subagents replying NO_NEW_VALUABLE_FINDINGS for the final ledger/comment set.

Comment thread be/src/io/fs/azure_obj_storage_client.cpp
@hello-stephen

Copy link
Copy Markdown
Contributor

Cloud UT Coverage Report

Increment line coverage 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 77.39% (1896/2450)
Line Coverage 64.46% (34073/52862)
Region Coverage 64.87% (17535/27032)
Branch Coverage 54.06% (9401/17390)

@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	13691	4056	4081	4056
q2	1828	320	204	204
q3	9853	1609	853	853
q4	4542	471	343	343
q5	2011	864	566	566
q6	195	185	139	139
q7	749	821	634	634
q8	1450	1267	1324	1267
q9	4505	4379	4385	4379
q10	1937	1807	1523	1523
q11	482	346	318	318
q12	510	556	433	433
q13	3030	3432	2752	2752
q14	269	278	239	239
q15	q16	761	782	722	722
q17	1019	1044	962	962
q18	6832	5834	5565	5565
q19	1069	1386	1027	1027
q20	731	668	555	555
q21	3098	2331	2624	2331
q22	426	362	297	297
Total cold run time: 58988 ms
Total hot run time: 29165 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	4436	4398	4384	4384
q2	303	334	209	209
q3	4602	5006	4419	4419
q4	2051	2165	1384	1384
q5	4490	4309	4328	4309
q6	235	177	127	127
q7	1730	1661	1465	1465
q8	2294	1986	1973	1973
q9	7327	7301	7329	7301
q10	4695	4630	4263	4263
q11	542	406	372	372
q12	742	753	593	593
q13	3003	3409	2765	2765
q14	295	290	267	267
q15	q16	686	705	615	615
q17	1299	1279	1267	1267
q18	7292	6841	6753	6753
q19	1135	1101	1112	1101
q20	2238	2244	1928	1928
q21	5299	4642	4487	4487
q22	530	475	413	413
Total cold run time: 55224 ms
Total hot run time: 50395 ms

@hello-stephen

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

query5	4345	623	505	505
query6	455	212	201	201
query7	4837	586	352	352
query8	342	193	177	177
query9	8782	4114	4082	4082
query10	478	361	291	291
query11	6052	2419	2182	2182
query12	154	100	103	100
query13	1267	617	448	448
query14	7148	5315	4949	4949
query14_1	4324	4294	4290	4290
query15	227	207	178	178
query16	1027	486	448	448
query17	1100	708	563	563
query18	2699	462	342	342
query19	204	182	142	142
query20	112	108	110	108
query21	238	161	141	141
query22	13769	13720	13442	13442
query23	17520	16527	16315	16315
query23_1	16309	16329	16354	16329
query24	7521	1794	1322	1322
query24_1	1330	1340	1330	1330
query25	552	459	396	396
query26	1319	359	213	213
query27	2521	619	368	368
query28	4407	2039	2065	2039
query29	1075	654	506	506
query30	334	251	233	233
query31	1133	1098	1001	1001
query32	99	64	63	63
query33	536	337	266	266
query34	1149	1121	646	646
query35	784	783	673	673
query36	1391	1397	1219	1219
query37	159	114	92	92
query38	1887	1713	1660	1660
query39	923	927	901	901
query39_1	890	892	890	890
query40	246	164	147	147
query41	75	70	71	70
query42	97	94	95	94
query43	327	324	284	284
query44	1458	798	778	778
query45	204	194	183	183
query46	1127	1235	787	787
query47	2349	2368	2217	2217
query48	422	444	300	300
query49	590	424	325	325
query50	1029	442	330	330
query51	10789	10636	10905	10636
query52	89	93	78	78
query53	272	297	212	212
query54	295	261	239	239
query55	80	74	69	69
query56	310	325	288	288
query57	1424	1386	1318	1318
query58	292	281	269	269
query59	1595	1659	1470	1470
query60	300	264	242	242
query61	156	150	150	150
query62	705	655	603	603
query63	258	208	204	204
query64	2443	749	584	584
query65	4855	4790	4781	4781
query66	1744	512	390	390
query67	29942	29555	29386	29386
query68	3390	1603	990	990
query69	408	306	270	270
query70	1100	996	976	976
query71	360	313	282	282
query72	2860	2669	2357	2357
query73	865	815	430	430
query74	5145	4957	4745	4745
query75	2614	2603	2223	2223
query76	2342	1206	794	794
query77	358	389	292	292
query78	12319	12336	11772	11772
query79	1389	1166	793	793
query80	1314	539	467	467
query81	522	327	293	293
query82	600	162	121	121
query83	381	328	295	295
query84	268	163	132	132
query85	999	586	513	513
query86	410	297	280	280
query87	1850	1825	1746	1746
query88	3760	2829	2801	2801
query89	452	406	355	355
query90	1900	201	205	201
query91	202	185	163	163
query92	68	61	59	59
query93	1596	1563	960	960
query94	727	354	285	285
query95	790	608	483	483
query96	1077	871	352	352
query97	2695	2681	2535	2535
query98	220	202	202	202
query99	1165	1158	1015	1015
Total cold run time: 267416 ms
Total hot run time: 179958 ms

@hello-stephen

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

query1	0.00	0.00	0.01
query2	0.10	0.05	0.05
query3	0.26	0.14	0.14
query4	1.60	0.14	0.14
query5	0.24	0.22	0.21
query6	1.23	1.11	1.05
query7	0.04	0.01	0.01
query8	0.06	0.04	0.04
query9	0.38	0.32	0.31
query10	0.52	0.54	0.54
query11	0.19	0.15	0.15
query12	0.17	0.15	0.15
query13	0.47	0.47	0.50
query14	1.03	1.02	1.01
query15	0.62	0.60	0.59
query16	0.32	0.33	0.32
query17	1.09	1.13	1.09
query18	0.22	0.20	0.21
query19	2.15	1.92	1.98
query20	0.02	0.02	0.01
query21	15.45	0.22	0.15
query22	4.81	0.05	0.06
query23	16.16	0.31	0.12
query24	2.99	0.42	0.30
query25	0.12	0.04	0.04
query26	0.76	0.20	0.14
query27	0.04	0.04	0.03
query28	3.49	0.97	0.53
query29	12.54	4.07	3.25
query30	0.27	0.16	0.18
query31	2.78	0.60	0.32
query32	3.23	0.59	0.48
query33	3.22	3.17	3.32
query34	15.71	4.29	3.51
query35	3.52	3.56	3.54
query36	0.57	0.42	0.42
query37	0.09	0.07	0.06
query38	0.06	0.05	0.03
query39	0.03	0.03	0.03
query40	0.18	0.16	0.15
query41	0.08	0.03	0.03
query42	0.04	0.03	0.03
query43	0.04	0.04	0.04
Total cold run time: 96.89 s
Total hot run time: 24.98 s

@gavinchou

Copy link
Copy Markdown
Contributor Author

run buildall

@gavinchou

Copy link
Copy Markdown
Contributor Author

/review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I found one remaining correctness issue in the observability path: Azure 429 retries can still be under-counted when the first 429 is retried successfully.

Critical checkpoint conclusions:

  • Goal/test proof: the PR mostly achieves the S3 local limiter and final 429 observability goal, and the current head fixes the earlier Cloud/BE accounting and logging-race comments. The remaining gap is the Azure retry-success path; the added tests do not cover that pipeline case.
  • Scope/focus: the change is focused on object-storage rate limiting, retry metrics, configs, and tests.
  • Concurrency/lifecycle: the previous unlocked limiter logging snapshot race is addressed by add_with_config() taking the holder lock while reading limiter config.
  • Config: the new mutable log interval is read at request time; existing token/bucket/limit reset paths are preserved.
  • Compatibility: no storage or wire-format compatibility issue found. Metric renames are user-visible and documented in the PR body.
  • Parallel paths: BE S3, BE Azure, Cloud S3, Cloud Azure, and batch-delete final-failure paths were checked. Existing review threads cover and appear resolved for the prior propagation/final-failure/race issues; MAIN-001 is distinct.
  • Error handling/status: final non-not-found S3/Azure failures now call the new failure recorder in the reviewed paths. No ignored Status issue was found in the changed code.
  • Testing/validation: I did not run BE/Cloud tests locally because this grafted CI checkout is missing .worktree_initialized and thirdparty/installed. This is a static review against the live GitHub patch and checked-out head.
  • Observability: the new bvars and logs are mostly wired through, but the Azure retry counter still misses a successful-retry throttling pattern.
  • User focus: no additional user-provided focus was supplied.

Subagent conclusions:

  • optimizer-rewrite: no optimizer/rewrite, semantic-equivalence, or parallel join/aggregate issue found.
  • tests-session-config: no additional non-duplicate test/config/style issue found.
  • Convergence round 1 ended with both live subagents replying NO_NEW_VALUABLE_FINDINGS for the final ledger/comment set containing only MAIN-001.

@@ -65,6 +78,10 @@ std::unique_ptr<Azure::Core::Http::RawResponse> AzureRetryRecordPolicy::Send(
static_cast<int>(response->GetStatusCode()) < 200) {
if (retry_count > 0) {
object_request_retry_count << 1;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This still misses the common Azure throttling case where the first attempt returns 429 and the SDK retry succeeds. AzureRetryRecordPolicy is installed in PerRetryPolicies, which run downstream of RetryPolicy for each attempt; on the first 429 response, GetRetryCount(context) is still 0, so this if (retry_count > 0) block does not increment s3_request_retry_too_many_requests_count. If the next attempt succeeds, no later non-2xx response passes through this block, so the new 429 retry metric stays flat while S3 increments it from ShouldRetry on the first retryable 429. Please record the 429 before this retry-count gate, or otherwise hook the Azure retry decision path, so successful retries after an initial 429 are counted consistently.

@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	17651	4116	4005	4005
q2	2035	318	203	203
q3	10304	1438	837	837
q4	4703	473	336	336
q5	7634	864	548	548
q6	210	173	137	137
q7	765	837	617	617
q8	9944	1577	1604	1577
q9	6002	4468	4428	4428
q10	6820	1807	1512	1512
q11	501	338	311	311
q12	698	550	425	425
q13	18079	3320	2735	2735
q14	270	267	246	246
q15	q16	792	769	707	707
q17	950	984	1103	984
q18	6934	5750	5498	5498
q19	1395	1258	981	981
q20	795	702	561	561
q21	5942	2577	2498	2498
q22	430	347	293	293
Total cold run time: 102854 ms
Total hot run time: 29439 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	4414	4356	4290	4290
q2	298	308	208	208
q3	4588	4968	4379	4379
q4	2040	2120	1595	1595
q5	4457	4310	4326	4310
q6	238	177	127	127
q7	1969	1919	1700	1700
q8	2579	2247	2088	2088
q9	7959	7874	7908	7874
q10	4747	4776	4294	4294
q11	738	406	392	392
q12	781	748	536	536
q13	3309	3607	2999	2999
q14	327	329	275	275
q15	q16	736	726	645	645
q17	1374	1290	1316	1290
q18	8161	7520	6795	6795
q19	1112	1082	1101	1082
q20	2206	2188	1940	1940
q21	5232	4551	4410	4410
q22	509	483	422	422
Total cold run time: 57774 ms
Total hot run time: 51651 ms

@hello-stephen

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

query5	4309	646	501	501
query6	462	220	207	207
query7	4833	586	343	343
query8	327	185	174	174
query9	8768	4113	4055	4055
query10	468	344	291	291
query11	5896	2361	2116	2116
query12	155	116	127	116
query13	1240	571	423	423
query14	6218	5253	4925	4925
query14_1	4337	4282	4262	4262
query15	213	209	174	174
query16	1039	468	440	440
query17	1093	707	565	565
query18	2480	474	324	324
query19	204	184	141	141
query20	112	106	103	103
query21	233	150	137	137
query22	13539	13671	13349	13349
query23	17233	16521	16098	16098
query23_1	16278	16259	16213	16213
query24	7695	1819	1305	1305
query24_1	1356	1335	1325	1325
query25	597	486	406	406
query26	1332	378	210	210
query27	2560	633	377	377
query28	4464	2029	2004	2004
query29	1096	641	503	503
query30	333	264	229	229
query31	1114	1089	1003	1003
query32	104	65	63	63
query33	560	329	255	255
query34	1170	1156	663	663
query35	782	785	683	683
query36	1387	1345	1202	1202
query37	161	107	97	97
query38	1874	1704	1653	1653
query39	923	928	895	895
query39_1	877	883	911	883
query40	258	174	148	148
query41	73	70	70	70
query42	94	92	95	92
query43	323	324	295	295
query44	1482	786	785	785
query45	207	191	179	179
query46	1069	1225	750	750
query47	2421	2341	2270	2270
query48	423	414	314	314
query49	595	441	326	326
query50	1047	429	340	340
query51	10965	10862	10909	10862
query52	88	93	77	77
query53	268	280	206	206
query54	309	258	231	231
query55	77	73	71	71
query56	294	305	298	298
query57	1443	1442	1341	1341
query58	289	285	270	270
query59	1632	1675	1481	1481
query60	323	293	267	267
query61	187	211	147	147
query62	690	647	582	582
query63	248	205	203	203
query64	2792	1022	856	856
query65	4839	4746	4788	4746
query66	1820	514	379	379
query67	29478	29428	29286	29286
query68	3148	1543	938	938
query69	415	309	263	263
query70	1086	985	965	965
query71	358	320	313	313
query72	3059	2743	2420	2420
query73	813	823	451	451
query74	5108	4968	4718	4718
query75	2622	2599	2235	2235
query76	2342	1218	807	807
query77	354	392	285	285
query78	12329	12251	11762	11762
query79	1912	1215	754	754
query80	1351	531	485	485
query81	545	322	282	282
query82	603	164	128	128
query83	356	325	297	297
query84	319	156	131	131
query85	969	591	518	518
query86	424	293	286	286
query87	1831	1824	1729	1729
query88	3768	2801	2801	2801
query89	453	411	350	350
query90	1876	200	199	199
query91	199	196	163	163
query92	62	67	57	57
query93	1730	1519	918	918
query94	712	351	301	301
query95	767	490	462	462
query96	1093	826	351	351
query97	2668	2664	2571	2571
query98	218	211	199	199
query99	1140	1177	1048	1048
Total cold run time: 266579 ms
Total hot run time: 179820 ms

@hello-stephen

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

query1	0.01	0.01	0.00
query2	0.10	0.05	0.05
query3	0.25	0.14	0.12
query4	1.60	0.15	0.14
query5	0.25	0.22	0.24
query6	1.26	1.05	1.06
query7	0.04	0.00	0.00
query8	0.05	0.03	0.04
query9	0.39	0.31	0.32
query10	0.56	0.58	0.58
query11	0.19	0.14	0.14
query12	0.18	0.14	0.14
query13	0.48	0.47	0.47
query14	1.00	1.00	1.02
query15	0.61	0.60	0.61
query16	0.32	0.32	0.31
query17	1.14	1.15	1.15
query18	0.23	0.21	0.20
query19	2.11	1.96	2.04
query20	0.01	0.01	0.01
query21	15.44	0.23	0.14
query22	4.91	0.05	0.06
query23	16.12	0.32	0.12
query24	3.02	0.41	0.32
query25	0.11	0.05	0.05
query26	0.73	0.21	0.15
query27	0.04	0.04	0.04
query28	3.59	0.94	0.54
query29	12.50	4.19	3.33
query30	0.27	0.15	0.15
query31	2.77	0.60	0.31
query32	3.21	0.60	0.48
query33	3.13	3.27	3.29
query34	15.46	4.26	3.54
query35	3.53	3.54	3.55
query36	0.56	0.43	0.43
query37	0.09	0.07	0.07
query38	0.04	0.04	0.03
query39	0.04	0.03	0.03
query40	0.17	0.17	0.16
query41	0.09	0.03	0.03
query42	0.04	0.02	0.02
query43	0.05	0.04	0.04
Total cold run time: 96.69 s
Total hot run time: 25.32 s

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 41.67% (10/24) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 74.82% (30210/40376)
Line Coverage 58.82% (331727/563976)
Region Coverage 55.60% (278414/500762)
Branch Coverage 56.84% (122998/216395)

@liaoxin01 liaoxin01 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@github-actions github-actions Bot added the approved Indicates a PR has been approved by one committer. label Jul 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

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

@liaoxin01
liaoxin01 merged commit 68938c5 into apache:master Jul 15, 2026
32 of 33 checks passed
0AyanamiRei added a commit to 0AyanamiRei/doris that referenced this pull request Jul 15, 2026
### What problem does this PR solve?

Issue Number: None

Related PR: apache#64038

Related PR: apache#65420

Problem Summary: PR apache#64038 refactored S3 rate limiting around a common observability helper and added throttling and 429 metrics, while this branch added CPU-aware QPS and byte limits, cloud traffic provenance, and non-blocking dynamic reset. Merge master and combine both designs so each request is charged once, the new observability remains active, and CPU-aware and internal traffic semantics are preserved.

### Release note

None

### Check List (For Author)

- Test: Unit Test
    - ./run-be-ut.sh --run --filter=S3UTILTest.*:S3ClientFactoryTest.*:S3FileWriterTest.* -j48
    - ./run-cloud-ut.sh --run --filter=s3_rate_limiter_test:* -j48
    - ./build-support/check-format.sh
- Behavior changed: No. This resolves integration with the latest S3 limiter observability refactor while preserving the PR behavior.
- Does this need documentation: No
yiguolei pushed a commit that referenced this pull request Jul 24, 2026
### What problem does this PR solve?

Backport #64038 to `branch-4.1`.

Add observability for S3 local rate limiting and S3/Azure 429 responses
so throttling-related performance issues can be diagnosed and alerted
more directly.

### What is changed?

- Add explicit S3 local rate limiter bvars for sleep duration, sleep
count, and rejected count.
- Rename the old ambiguous S3 local rate limiter bvars so their meaning
is clear.
- Log the first and every N local S3 rate limiter throttled/rejected
requests without reading bvar values for decisions.
- Add S3 429 retry/failure bvars for S3/Azure object clients, including
Azure batch delete failures.
- Capture the limiter configuration and result under the limiter lock to
avoid concurrent reset races.
- Adapt the Cloud configuration change to `branch-4.1` without bringing
in unrelated master-only fault-injection settings.

### New or renamed bvar metrics

Renamed local S3 GET limiter metrics:

- `get_rate_limit_ns` -> `s3_get_rate_limit_sleep_ns`
- `get_rate_limit_exceed_req_num` -> `s3_get_rate_limit_sleep_count`

Renamed local S3 PUT limiter metrics:

- `put_rate_limit_ns` -> `s3_put_rate_limit_sleep_ns`
- `put_rate_limit_exceed_req_num` -> `s3_put_rate_limit_sleep_count`

New local S3 limiter rejection metrics:

- `s3_get_rate_limit_rejected_count`
- `s3_put_rate_limit_rejected_count`

New S3/Azure 429 metrics:

- `s3_request_retry_too_many_requests_count`
- `s3_request_failed_too_many_requests_count`

Metric examples:

```text
s3_get_rate_limit_sleep_ns : 123456789
s3_get_rate_limit_sleep_count : 42
s3_get_rate_limit_rejected_count : 3
s3_put_rate_limit_sleep_ns : 987654321
s3_put_rate_limit_sleep_count : 27
s3_put_rate_limit_rejected_count : 1
s3_request_retry_too_many_requests_count : 8
s3_request_failed_too_many_requests_count : 2
```

Example local limiter logs:

```text
S3 GET request is throttled by local rate limiter, sleep_ms=12, sleep_count=1000, token_per_second=1000, bucket_tokens=2000, token_limit=5000
S3 PUT request is rejected by local rate limiter, rejected_count=1, token_per_second=1000, bucket_tokens=2000, token_limit=5000
```

### Tests

- `sh run-cloud-ut.sh --run --filter='s3_rate_limiter_test:*'` (7/7
passed)
- `sh run-be-ut.sh --run --filter='S3UTILTest.*:S3FileWriterTest.*'`
(24/24 passed)
- `sh run-be-ut.sh --run
--filter='AzureObjStorageClientTlsHelperTest.*'` (2/2 passed)

Co-authored-by: gavinchou <gavinchou@apache.org>
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/4.1.4-merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants