From b8cb65d8c253663d37db4dad6582ca2273fdb25f Mon Sep 17 00:00:00 2001 From: fengwenzhi Date: Mon, 22 Sep 2025 18:01:34 +0800 Subject: [PATCH 1/5] add pip-444. --- pip/pip-444.md | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 pip/pip-444.md diff --git a/pip/pip-444.md b/pip/pip-444.md new file mode 100644 index 0000000000000..2b8c2e37ec383 --- /dev/null +++ b/pip/pip-444.md @@ -0,0 +1,63 @@ + +# PIP-444: Rate limit for deleting ledger to alleviate the zk pressure. + +# Background knowledge + +Apache Pulsar uses Apache BookKeeper as its storage layer. +Each topic consists of multiple ledgers, which are created periodically based on the configuration. +Each ledger corresponds to a ZooKeeper (ZK) node for metadata storage. When a ledger is deleted, the corresponding ZK node will also be deleted. +Retention policies determine how long messages are retained in a topic. When the retention period is reached, the corresponding ledgers will be deleted. + +# Motivation + +When the retention of a large topic is reduced, a significant number of ledgers need to be deleted. +Since this deletion operation is not rate-limited, it could results in ZooKeeper (ZK) latency of several minutes, +which threatens the stability of the entire Pulsar cluster. + +# Goals + +Add rate limit feature for deleting ledgers. + +# Detailed Design + +Introduce two new configuration parameters: +``` +@FieldContext( + category = CATEGORY_STORAGE_ML, + doc = "Rate limit the amount of deleting ledgers per second at broker level," + + "value of 0 or negative means no rate limit" +) +private double managedLedgerDeleteRateLimit = 1000.0; + +@FieldContext( + category = CATEGORY_STORAGE_ML, + doc = "Concurrency level for deleting ledgers at broker level when rate limiting is enabled" +) +private int managedLedgerDeleteConcurrency = 5; +``` +These parameters can be configured in the `broker.conf` file. + +When the `managedLedgerDeleteRateLimit` is set to a value greater than 0, the broker will limit the rate of ledger deletions to the specified value per second. +The `managedLedgerDeleteConcurrency` parameter specifies the number of concurrent threads that can be used for deleting ledgers when rate limiting is enabled. + + +# Backward & Forward Compatibility + +Fully backward compatible and forward compatible. + +## Upgrade + +New feature is enabled by default with a rate limit of 1000 deletions per second and concurrency of 5. + +## Downgrade / Rollback + +To downgrade or rollback, simply revert the configuration changes in the `broker.conf` file and restart the broker. + + +# Links + + +* Mailing List discussion thread: +* Mailing List voting thread: From ee2cc9ff53495bea073d6bfcad39c711926d4f95 Mon Sep 17 00:00:00 2001 From: fengwenzhi Date: Tue, 23 Sep 2025 15:07:46 +0800 Subject: [PATCH 2/5] update conf name. --- pip/pip-444.md | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/pip/pip-444.md b/pip/pip-444.md index 2b8c2e37ec383..6b8bd87cc0ccc 100644 --- a/pip/pip-444.md +++ b/pip/pip-444.md @@ -22,24 +22,23 @@ Add rate limit feature for deleting ledgers. Introduce two new configuration parameters: ``` -@FieldContext( - category = CATEGORY_STORAGE_ML, - doc = "Rate limit the amount of deleting ledgers per second at broker level," + - "value of 0 or negative means no rate limit" -) -private double managedLedgerDeleteRateLimit = 1000.0; - -@FieldContext( - category = CATEGORY_STORAGE_ML, - doc = "Concurrency level for deleting ledgers at broker level when rate limiting is enabled" -) -private int managedLedgerDeleteConcurrency = 5; + @FieldContext( + category = CATEGORY_STORAGE_ML, + doc = "Max number of concurrent requests for deleting ledgers at broker level" + ) + private int managedLedgerDeleteMaxConcurrentRequests = 1000; + @FieldContext( + category = CATEGORY_STORAGE_ML, + doc = "Number of threads to be used for deleting ledgers at broker level" + ) + private int managedLedgerDeleteThreadPoolSize = 5; ``` These parameters can be configured in the `broker.conf` file. -When the `managedLedgerDeleteRateLimit` is set to a value greater than 0, the broker will limit the rate of ledger deletions to the specified value per second. -The `managedLedgerDeleteConcurrency` parameter specifies the number of concurrent threads that can be used for deleting ledgers when rate limiting is enabled. - +When the `managedLedgerDeleteMaxConcurrentRequests` parameter is set to a value greater than 0, +the concurrency of ledger deletions will be limited to the specified value. +The `managedLedgerDeleteThreadPoolSize` parameter specifies the number of threads that can be used +for deleting ledgers concurrently when the rate limit is enabled. # Backward & Forward Compatibility @@ -59,5 +58,5 @@ To downgrade or rollback, simply revert the configuration changes in the `broker -* Mailing List discussion thread: +* Mailing List discussion thread: https://lists.apache.org/thread/ppmvm4noowlrhr229zf65mc44xqhj8k1 * Mailing List voting thread: From f57307667afe15e1ba7911a7de8a11e2be0b8933 Mon Sep 17 00:00:00 2001 From: fengwenzhi Date: Tue, 30 Sep 2025 14:27:44 +0800 Subject: [PATCH 3/5] update pip. --- pip/pip-444.md | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/pip/pip-444.md b/pip/pip-444.md index 6b8bd87cc0ccc..af2cba4c7801c 100644 --- a/pip/pip-444.md +++ b/pip/pip-444.md @@ -20,25 +20,18 @@ Add rate limit feature for deleting ledgers. # Detailed Design -Introduce two new configuration parameters: +Introduce a new configuration parameter: ``` @FieldContext( category = CATEGORY_STORAGE_ML, doc = "Max number of concurrent requests for deleting ledgers at broker level" ) private int managedLedgerDeleteMaxConcurrentRequests = 1000; - @FieldContext( - category = CATEGORY_STORAGE_ML, - doc = "Number of threads to be used for deleting ledgers at broker level" - ) - private int managedLedgerDeleteThreadPoolSize = 5; ``` These parameters can be configured in the `broker.conf` file. When the `managedLedgerDeleteMaxConcurrentRequests` parameter is set to a value greater than 0, the concurrency of ledger deletions will be limited to the specified value. -The `managedLedgerDeleteThreadPoolSize` parameter specifies the number of threads that can be used -for deleting ledgers concurrently when the rate limit is enabled. # Backward & Forward Compatibility From 3db982e80991412e8a58bec6cc52a00dd993a70c Mon Sep 17 00:00:00 2001 From: fengwenzhi Date: Tue, 30 Sep 2025 14:48:54 +0800 Subject: [PATCH 4/5] add vote thread link. --- pip/pip-444.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pip/pip-444.md b/pip/pip-444.md index af2cba4c7801c..07bdc2197c3aa 100644 --- a/pip/pip-444.md +++ b/pip/pip-444.md @@ -52,4 +52,4 @@ To downgrade or rollback, simply revert the configuration changes in the `broker Updated afterwards --> * Mailing List discussion thread: https://lists.apache.org/thread/ppmvm4noowlrhr229zf65mc44xqhj8k1 -* Mailing List voting thread: +* Mailing List voting thread: https://lists.apache.org/thread/2dop6kyvrpt6ztz9pvylyl8o2syvh9kw From 9910af0304e4dd845afa536431206f8ce7ba0b90 Mon Sep 17 00:00:00 2001 From: Wenzhi Feng Date: Tue, 30 Sep 2025 15:28:42 +0800 Subject: [PATCH 5/5] Update pip/pip-444.md Co-authored-by: Zixuan Liu --- pip/pip-444.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pip/pip-444.md b/pip/pip-444.md index 07bdc2197c3aa..74eb86ae5ec0c 100644 --- a/pip/pip-444.md +++ b/pip/pip-444.md @@ -39,7 +39,7 @@ Fully backward compatible and forward compatible. ## Upgrade -New feature is enabled by default with a rate limit of 1000 deletions per second and concurrency of 5. +New feature is enabled by default with a rate limit of 1000 deletions per second and concurrency of 1. ## Downgrade / Rollback