mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-08-16 12:16:36 +00:00
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
This commit is contained in:
@@ -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())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user