From c8243706b40149dd737a87df625a907d9d6f2b2a Mon Sep 17 00:00:00 2001 From: Sidhartha Mani Date: Tue, 31 Mar 2020 17:08:28 -0700 Subject: [PATCH] Add Parallel NetOBD tests to saturate all nodes at once (#9241) --- cmd/admin-handlers.go | 1 + cmd/notification.go | 29 +++++++++++++++++++++++++++++ pkg/madmin/obd.go | 7 ++++--- 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/cmd/admin-handlers.go b/cmd/admin-handlers.go index bd96238ac..6948ee425 100644 --- a/cmd/admin-handlers.go +++ b/cmd/admin-handlers.go @@ -1494,6 +1494,7 @@ func (a adminAPIHandlers) OBDInfoHandler(w http.ResponseWriter, r *http.Request) if net, ok := vars["perfnet"]; ok && net == "true" && globalIsDistXL { obdInfo.Perf.Net = append(obdInfo.Perf.Net, globalNotificationSys.NetOBDInfo(deadlinedCtx)) obdInfo.Perf.Net = append(obdInfo.Perf.Net, globalNotificationSys.DispatchNetOBDInfo(deadlinedCtx)...) + obdInfo.Perf.NetParallel = globalNotificationSys.NetOBDParallelInfo(deadlinedCtx) partialWrite() } diff --git a/cmd/notification.go b/cmd/notification.go index c29d005bf..e95e31c0c 100644 --- a/cmd/notification.go +++ b/cmd/notification.go @@ -992,6 +992,35 @@ func (sys *NotificationSys) DispatchNetOBDInfo(ctx context.Context) []madmin.Ser return serverNetOBDs } +// NetOBDParallelInfo - Performs NetOBD tests +func (sys *NotificationSys) NetOBDParallelInfo(ctx context.Context) madmin.ServerNetOBDInfo { + netOBDs := []madmin.NetOBDInfo{} + wg := sync.WaitGroup{} + + for index, client := range sys.peerClients { + if client == nil { + continue + } + + wg.Add(1) + go func(index int) { + netOBD, err := sys.peerClients[index].NetOBDInfo(ctx) + netOBD.Addr = sys.peerClients[index].host.String() + if err != nil { + netOBD.Error = err.Error() + } + netOBDs = append(netOBDs, netOBD) + wg.Done() + }(index) + } + wg.Wait() + return madmin.ServerNetOBDInfo{ + Net: netOBDs, + Addr: GetLocalPeer(globalEndpoints), + } + +} + // DriveOBDInfo - Drive OBD information func (sys *NotificationSys) DriveOBDInfo(ctx context.Context) []madmin.ServerDrivesOBDInfo { reply := make([]madmin.ServerDrivesOBDInfo, len(sys.peerClients)) diff --git a/pkg/madmin/obd.go b/pkg/madmin/obd.go index 507eb0b72..81ac9ce29 100644 --- a/pkg/madmin/obd.go +++ b/pkg/madmin/obd.go @@ -131,9 +131,10 @@ type MinioOBDInfo struct { // PerfOBDInfo - Includes Drive and Net perf info for the entire MinIO cluster type PerfOBDInfo struct { - DriveInfo []ServerDrivesOBDInfo `json:"drives,omitempty"` - Net []ServerNetOBDInfo `json:"net,omitempty"` - Error string `json:"error,omitempty"` + DriveInfo []ServerDrivesOBDInfo `json:"drives,omitempty"` + Net []ServerNetOBDInfo `json:"net,omitempty"` + NetParallel ServerNetOBDInfo `json:"net_parallel,omitempty"` + Error string `json:"error,omitempty"` } // ServerDrivesOBDInfo - Drive OBD info about all drives in a single MinIO node