AlexStocks opened a new issue, #3571:
URL: https://github.com/apache/dubbo-go/issues/3571

   ## 问题描述
   
   `metadata/report/zookeeper/report.go` 的 `ListAppRevisions`(L138–160)先 
`Children(parent)` 列出 revision 子节点,再 **for 循环对每个 revision 单独 
`m.client.Get(path)`**(L150):
   
   ```go
   children, _, err := m.client.Children(parent)
   ...
   for _, rev := range children {
       path := parent + constant.PathSeparator + rev
       data, _, err := m.client.Get(path) // 每个 revision 一次往返
       ...
   }
   ```
   
   etcd 的等价实现(`metadata/report/etcd/report.go` 的 `GetChildren` / 
前缀批量读)是一次前缀批量获取;ZK 这边没有使用 multi-op 或批量接口。
   
   ## 影响
   
   当某个 app 的 revision 数量较多时,ZK 往返次数随 revision 数线性增长,列举延迟升高。
   
   ## 建议修复
   
   - 评估是否可使用 ZK multi-op 合并列举,或在一次调用内获取子节点数据(参考 etcd 实现);
   - 至少明确该路径为已知 N+1,避免在高频列举场景调用。
   
   ## 参考
   
   - `metadata/report/zookeeper/report.go` L138–159
   - etcd 对照实现:`metadata/report/etcd/report.go`
   


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to