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

   ### Motivation
   
   As the `brokerAvgResourceUsageWithWeight`  stored the broker's history 
resource usage, if a broker is high load before restart, after the broker 
restart always show a high load history resource usage, and 
`loadBalancerHistoryResourcePercentage = 0.9`, which will cause the first few  
times the broker can not be select as best broker to load  bundles. Only when 
`selectBrokerForAssignment` invoke few time's ,  the 
`brokerAvgResourceUsageWithWeight` could be neutralized by the current 
resourceUsage.
   But bundles unload is not a frequently operator if not enable 
`doLoadShedding`,it will wait a long time;  So if a broker restarted we can 
clean the brokers history resource usage to guaranty the no bundles or no 
msgRate broker can be select as the one of  best brokers.
   
   
https://github.com/apache/pulsar/blob/bc94643bc1a7f365dfb75e389ac3e1156770a119/pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/LeastResourceUsageWithWeight.java#L99-L100
   
   ### Modifications
   1. If the broker not own bundles or the msgRate is 0, use current 
resourceUsage to cover the historyUsage.
   2. add some unit test.
   
   
   ### Documentation
   
   - [X] `doc-not-needed` 
   (Please explain why)
   


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