From 2a2ff96ee1cb263058e7bfcc553e99054a1e9000 Mon Sep 17 00:00:00 2001 From: Bala FA Date: Thu, 26 Sep 2019 18:31:18 +0000 Subject: [PATCH] change `ReadPerf` into `ReadThroughput` in NetPerfInfo. (#8316) Previously `ReadPerf` was in time.Duration is changed to `ReadThroughput` in uint64. --- cmd/admin-handlers.go | 6 +++--- cmd/peer-rest-server.go | 5 +++-- pkg/madmin/README.md | 10 +++++----- pkg/madmin/info-commands.go | 6 +++--- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/cmd/admin-handlers.go b/cmd/admin-handlers.go index 33b5fa936..443d4743d 100644 --- a/cmd/admin-handlers.go +++ b/cmd/admin-handlers.go @@ -334,9 +334,9 @@ type ServerMemUsageInfo struct { // ServerNetReadPerfInfo network read performance information. type ServerNetReadPerfInfo struct { - Addr string `json:"addr"` - ReadPerf time.Duration `json:"readPerf"` - Error string `json:"error,omitempty"` + Addr string `json:"addr"` + ReadThroughput uint64 `json:"readThroughput"` + Error string `json:"error,omitempty"` } // PerfInfoHandler - GET /minio/admin/v1/performance?perfType={perfType} diff --git a/cmd/peer-rest-server.go b/cmd/peer-rest-server.go index d8f28d6ac..2c6c90610 100644 --- a/cmd/peer-rest-server.go +++ b/cmd/peer-rest-server.go @@ -106,9 +106,10 @@ func (s *peerRESTServer) NetReadPerfInfoHandler(w http.ResponseWriter, r *http.R addr = GetLocalPeer(globalEndpoints) } + d := end.Sub(start) info := ServerNetReadPerfInfo{ - Addr: addr, - ReadPerf: end.Sub(start), + Addr: addr, + ReadThroughput: uint64(int64(time.Second) * size / int64(d)), } ctx := newContext(r, w, "NetReadPerfInfo") diff --git a/pkg/madmin/README.md b/pkg/madmin/README.md index 57d59b187..feaebe9a1 100644 --- a/pkg/madmin/README.md +++ b/pkg/madmin/README.md @@ -280,11 +280,11 @@ Fetches Mem utilization for all cluster nodes. Fetches network performance of all cluster nodes using given sized payload. Returned value is a map containing each node indexed list of performance of other nodes. -| Param | Type | Description | -|------------|------------------|--------------------------------------------------------------------| -| `Addr` | _string_ | Address of the server the following information is retrieved from. | -| `Error` | _string_ | Errors (if any) encountered while reaching this node | -| `ReadPerf` | _time.Duration_ | Network read performance of the server | +| Param | Type | Description | +|------------------|-----------|--------------------------------------------------------------------| +| `Addr` | _string_ | Address of the server the following information is retrieved from. | +| `Error` | _string_ | Errors (if any) encountered while reaching this node | +| `ReadThroughput` | _uint64_ | Network read throughput of the server in bytes per second | ## 5. Heal operations diff --git a/pkg/madmin/info-commands.go b/pkg/madmin/info-commands.go index bbcd8caed..f50d4e673 100644 --- a/pkg/madmin/info-commands.go +++ b/pkg/madmin/info-commands.go @@ -305,9 +305,9 @@ func (adm *AdminClient) ServerMemUsageInfo() ([]ServerMemUsageInfo, error) { // NetPerfInfo network performance information. type NetPerfInfo struct { - Addr string `json:"addr"` - ReadPerf time.Duration `json:"readPerf"` - Error string `json:"error,omitempty"` + Addr string `json:"addr"` + ReadThroughput uint64 `json:"readThroughput"` + Error string `json:"error,omitempty"` } // NetPerfInfo - Returns network performance information of all cluster nodes.