mirror of
https://github.com/minio/minio.git
synced 2025-11-21 02:09:08 -05:00
add network read performance collection support. (#8038)
ReST API on /minio/admin/v1/performance?perfType=net[?size=N]
returns
```
{
"PEER-1": [
{
"addr": ADDR,
"readPerf": DURATION,
"error": ERROR,
},
...
],
...
...
"PEER-N": [
{
"addr": ADDR,
"readPerf": DURATION,
"error": ERROR,
},
...
]
}
```
This commit is contained in:
@@ -22,6 +22,7 @@ import (
|
||||
"crypto/tls"
|
||||
"encoding/gob"
|
||||
"io"
|
||||
"math/rand"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"time"
|
||||
@@ -107,6 +108,37 @@ func (client *peerRESTClient) Close() error {
|
||||
// GetLocksResp stores various info from the client for each lock that is requested.
|
||||
type GetLocksResp map[string][]lockRequesterInfo
|
||||
|
||||
// NetReadPerfInfo - fetch network read performance information for a remote node.
|
||||
func (client *peerRESTClient) NetReadPerfInfo(size int64) (info ServerNetReadPerfInfo, err error) {
|
||||
params := make(url.Values)
|
||||
params.Set(peerRESTNetPerfSize, strconv.FormatInt(size, 10))
|
||||
respBody, err := client.call(
|
||||
peerRESTMethodNetReadPerfInfo,
|
||||
params,
|
||||
rand.New(rand.NewSource(time.Now().UnixNano())),
|
||||
size,
|
||||
)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
defer http.DrainBody(respBody)
|
||||
err = gob.NewDecoder(respBody).Decode(&info)
|
||||
return info, err
|
||||
}
|
||||
|
||||
// CollectNetPerfInfo - collect network performance information of other peers.
|
||||
func (client *peerRESTClient) CollectNetPerfInfo(size int64) (info []ServerNetReadPerfInfo, err error) {
|
||||
params := make(url.Values)
|
||||
params.Set(peerRESTNetPerfSize, strconv.FormatInt(size, 10))
|
||||
respBody, err := client.call(peerRESTMethodCollectNetPerfInfo, params, nil, -1)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
defer http.DrainBody(respBody)
|
||||
err = gob.NewDecoder(respBody).Decode(&info)
|
||||
return info, err
|
||||
}
|
||||
|
||||
// GetLocks - fetch older locks for a remote node.
|
||||
func (client *peerRESTClient) GetLocks() (locks GetLocksResp, err error) {
|
||||
respBody, err := client.call(peerRESTMethodGetLocks, nil, nil, -1)
|
||||
|
||||
Reference in New Issue
Block a user