RongtongJin opened a new issue, #9677:
URL: https://github.com/apache/rocketmq/issues/9677

   ### Before Creating the Enhancement Request
   
   - [x] I have confirmed that this should be classified as an enhancement 
rather than a bug/feature.
   
   
   ### Summary
   
   In BrokerContainer mode, multiple broker instances share static metrics 
variables from `BrokerMetricsManager` and `DefaultStoreMetricsManager`, leading 
to data conflicts and resource leaks during dynamic broker operations.
   
   
   ### Motivation
   
   ## Root Cause
   Static metrics variables in `BrokerMetricsManager` and 
`DefaultStoreMetricsManager` are shared across all broker instances in the same 
JVM, causing:
   
   1. **Metrics Data Conflicts**: Multiple broker instances write to the same 
static metrics variables
   2. **Resource Leaks**: Frequent `addBroker`/`removeBroker` operations don't 
properly clean up metrics resources
   3. **Incorrect Aggregation**: Metrics from different brokers are incorrectly 
mixed together
   4. **Memory Leaks**: Static references prevent proper garbage collection
   
   ## 🚨 Impact
   
   - **Data Integrity**: Inaccurate metrics reporting for individual brokers
   - **Resource Management**: Memory leaks in long-running container 
environments
   - **Operational Issues**: Incorrect monitoring and alerting based on mixed 
metrics
   - **Scalability**: Prevents proper isolation in multi-tenant scenarios
   
   ## 🔧 Expected Behavior
   
   1. Each broker instance should maintain independent metrics
   2. Metrics should be properly isolated between different brokers
   3. Dynamic broker addition/removal should not cause resource leaks
   4. Metrics collection should work correctly in BrokerContainer mode
   
   ### Describe the Solution You'd Like
   
   Resolve critical metrics conflicts and resource leaks in BrokerContainer 
mode by converting static metrics variables to instance-level variables, 
ensuring proper isolation between multiple broker instances.
   
   ### Describe Alternatives You've Considered
   
   No
   
   ### Additional Context
   
   No


-- 
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: commits-unsubscr...@rocketmq.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to