From 9f1e21e73f2bc87a5a2000b6ddfe3f0878fa38ec Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Fri, 7 Aug 2026 01:10:57 -0700 Subject: [PATCH] perf(weed/topology): preallocate the per-disk VolumeList payload (#10614) ToDiskInfo builds a protobuf message per volume and per ec shard on the disk, growing both lists from nil. Every VolumeList call runs it for every disk in the cluster, and the admin dashboard, the plugin worker, several shell commands and the s3 gateway's per-minute bucket metrics all call VolumeList. Both counts are already in hand. ToTopologyInfo over 550k volumes 202.2 MB -> 184.6 MB --- weed/topology/disk.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/weed/topology/disk.go b/weed/topology/disk.go index f2bd0f9f2..cec5ffe28 100644 --- a/weed/topology/disk.go +++ b/weed/topology/disk.go @@ -311,9 +311,11 @@ func (d *Disk) ToDiskInfo() *master_pb.DiskInfo { DiskTotalBytes: uint64(max(0, diskUsage.diskTotalBytes)), DiskFreeBytes: uint64(max(0, diskUsage.diskFreeBytes)), } + m.VolumeInfos = make([]*master_pb.VolumeInformationMessage, 0, len(volumes)) for _, v := range volumes { m.VolumeInfos = append(m.VolumeInfos, v.ToVolumeInformationMessage()) } + m.EcShardInfos = make([]*master_pb.VolumeEcShardInformationMessage, 0, len(ecShards)) for _, ecv := range ecShards { m.EcShardInfos = append(m.EcShardInfos, ecv.ToVolumeEcShardInformationMessage()) }