poorbarcode opened a new pull request, #24596:
URL: https://github.com/apache/pulsar/pull/24596

   ### Motivation
   
   **Background of `scheduleWithFixedDelay` and `scheduleWithFixedRate`**
   - `scheduleWithFixedRate`: Executes tasks at fixed intervals (period) 
regardless of task execution time, 
     - If task execution time ≤ period: Runs normally at the specified interval 
(e.g., every 1 second).
     - If task execution time > period: New tasks will trigger immediately (or 
queue up), causing backlog (may lead to consecutive executions). 
   - `scheduleWithFixedDelay`: Trigger Mechanism: Waits for the previous task 
to complete, then delays by the fixed interval (delay) before the next 
execution.
     - Regardless of task duration, the interval is always measured from the 
end of the last task.
   
   **Issue: broker ran checkMessageExpiry many times in 1s**
   
   When system resources are tight, it leads to a large backlog of tasks 
`checkMessageExpiry`, which are executed multiple times at the same time, 
causing even greater pressure
   
   
![image](https://github.com/user-attachments/assets/443df028-fb4d-4691-803b-efbdc46cf0b4)
   
   
   ### Modifications
   
   Call `scheduleWithFixedDelay` instead of `scheduleWithFixedRate`
   
   ### Documentation
   
   <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
   
   - [ ] `doc` <!-- Your PR contains doc changes. -->
   - [ ] `doc-required` <!-- Your PR changes impact docs and you will update 
later -->
   - [x] `doc-not-needed` <!-- Your PR changes do not impact docs -->
   - [ ] `doc-complete` <!-- Docs have been already added -->
   
   ### Matching PR in forked repository
   
   PR in forked repository: x


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to