tju-yxq opened a new issue, #1445:
URL: https://github.com/apache/rocketmq-dashboard/issues/1445

   ## Bug Report
   
   ### Before Creating the Bug Report
   
   - [x] I found a bug, not just asking a question, which should be created in 
[GitHub Discussions](https://github.com/apache/rocketmq/discussions).
   - [x] I have searched the [GitHub 
Issues](https://github.com/apache/rocketmq/issues) and [GitHub 
Discussions](https://github.com/apache/rocketmq/discussions) of this repository 
and believe that this is not a duplicate.
   - [x] I have confirmed that this bug belongs to the current repository, not 
other repositories of RocketMQ.
   
   ### Runtime platform environment
   
   OS: Ubuntu 20.04 / Any OS running RocketMQ Studio
   
   ### RocketMQ version
   
   branch: rocketmq-studio
   version: 5.3.2+
   Git commit id: f727341
   
   ### JDK Version
   
   OpenJDK 21
   
   ### Describe the Bug
   
   `RocketMQMetadataProvider.listConsumerGroups()` calls 
`enrichGroupWithConnectionInfo()` for **every** consumer group in the list. 
Each `enrichGroupWithConnectionInfo()` makes **2 admin API calls** 
(`examineConsumerConnectionInfo` + `examineConsumeStats`). For a cluster with N 
consumer groups, this results in **2N admin API calls** during a single list 
operation.
   
   For a cluster with 100 consumer groups, this means 200 admin API calls to 
the broker, each with a 5-second timeout. In the worst case, the list operation 
could take **several minutes** and may time out the HTTP request.
   
   ```java
   for (RmqGroup entity : groupMapper.selectList(query)) {
       ConsumerGroupVO vo = new ConsumerGroupVO();
       // ... set basic fields ...
       if (hasAdmin()) {
           enrichGroupWithConnectionInfo(vo, entity.getName());  // 2 admin 
calls per group!
       }
       result.add(vo);
   }
   ```
   
   ### Impact
   
   - **Slow page load**: The consumer group list page takes minutes to load for 
clusters with many groups.
   - **Broker load**: 200 admin API calls per page load puts unnecessary load 
on the broker.
   - **HTTP timeout**: The frontend may time out before the backend finishes, 
showing an error.
   
   ### Steps to Reproduce
   
   1. Start a RocketMQ cluster with 50+ consumer groups.
   2. Open RocketMQ Studio consumer group list page.
   3. Observe: the page takes a very long time to load (potentially minutes).
   
   ### What Did You Expect to See?
   
   The list page should load quickly by returning basic group info from the 
database, with live data (online instances, lag) loaded lazily or on-demand 
when the user clicks into a group detail.
   
   ### What Did You See Instead?
   
   The list page blocks for N*2 admin API calls, causing long load times.
   
   ### Additional Context
   
   **Affected file**: 
`server/src/main/java/org/apache/rocketmq/studio/provider/apache/RocketMQMetadataProvider.java`,
 methods `listConsumerGroups()` and `enrichGroupWithConnectionInfo()`.
   
   **Fix approach**: Remove the `enrichGroupWithConnectionInfo` call from the 
list operation. Live data (online instances, total lag) should only be fetched 
when viewing a single group's detail page, not when listing all groups. The 
list should return basic info from the DB (name, type, retry count, timestamps) 
without making any admin API calls.
   
   ```java
   for (RmqGroup entity : groupMapper.selectList(query)) {
       ConsumerGroupVO vo = new ConsumerGroupVO();
       // ... set basic fields from DB ...
       // Do NOT call enrichGroupWithConnectionInfo here - it's too expensive 
for a list operation
       result.add(vo);
   }
   ```
   
   The `getConsumerGroup(name)` method (single group detail) should continue to 
call `enrichGroupWithConnectionInfo` as it does now. This is a ~5 line change 
(remove the if-block and its contents from listConsumerGroups).
   


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