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

   Fixes https://github.com/apache/pulsar/issues/24894
   
   ### Motivation
   
   Currently the `quietPeriod` parameter in Netty graceful shutdown in 
milliseconds is determined by the minimal value of 5000 and 
`brokerShutdownTimeoutMs` / 4 (default: 15000), which is unnecessarily large 
and could wait for too long with no pending tasks in the executor.
   
   ### Modifications
   
   - Modified the `quietPeriod` argument as a small value (1 ms)
   - Added `BrokerEventLoopShutdownTest` to avoid the regression
   - Added logs for how long that each event loop's gracefully shutdown takes.
   
   It should be noted that setting 1 ms as the `quietPeriod` makes sense. It 
has been explained in 
https://github.com/apache/pulsar/issues/24894#issuecomment-3450985038 and more 
details can be found in 
https://github.com/netty/netty/blob/6bb1a6bcae503423343b9155ac48b161f60368b5/common/src/main/java/io/netty/util/concurrent/SingleThreadEventExecutor.java
   
   Here is the best practice suggested by AI:
   
   > Consider a very short quiet period if applicable: If your application is 
lightweight and you are certain no business logic is left to execute, you can 
use a very small value to terminate the event loop group immediately.
   
   ### Verifying this change
   
   After this change, the `BrokerEventLoopShutdownTest` can pass and the logs 
might look like:
   
   ```
   2025-10-27T20:29:09,129 - INFO  - [globalEventExecutor-9-2:BrokerService] - 
Event loop acceptor shut down after 104 ms
   2025-10-27T20:29:09,130 - INFO  - [globalEventExecutor-9-2:BrokerService] - 
Event loop worker shut down after 105 ms
   ```
   
   
   ### 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: <!-- ENTER URL HERE -->
   
   <!--
   After opening this PR, the build in apache/pulsar will fail and instructions 
will
   be provided for opening a PR in the PR author's forked repository.
   
   apache/pulsar pull requests should be first tested in your own fork since 
the 
   apache/pulsar CI based on GitHub Actions has constrained resources and quota.
   GitHub Actions provides separate quota for pull requests that are executed 
in 
   a forked repository.
   
   The tests will be run in the forked repository until all PR review comments 
have
   been handled, the tests pass and the PR is approved by a reviewer.
   -->
   


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