Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat:mc support site-replication ttfb #4739

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion cmd/speedtest-spinner.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,14 +232,15 @@ func (m *speedTestUI) View() string {
table.AppendBulk(data)
table.Render()
} else if sres != nil {
table.SetHeader([]string{"Endpoint", "RX", "TX", ""})
table.SetHeader([]string{"Endpoint", "RX", "TX", "TTFB", ""})
data := make([][]string, 0, len(sres.NodeResults))
if len(sres.NodeResults) == 0 {
data = append(data, []string{
"...",
whiteStyle.Render("-- MiB"),
whiteStyle.Render("-- MiB"),
"",
"",
})
} else {
for _, nodeResult := range sres.NodeResults {
Expand Down Expand Up @@ -269,6 +270,14 @@ func (m *speedTestUI) View() string {
} else {
dataItem = append(dataItem, whiteStyle.Render(humanize.IBytes(nodeResult.TX/uint64(nodeResult.TXTotalDuration.Seconds())))+"/s")
}
// show TTFB
if uint64(nodeResult.RX) == 0 {
dataError += "- N/A"
dataItem = append(dataItem, crossTickCell)
} else {
ttfb := int64((float64(nodeResult.TXTotalSpentDuration) / float64(nodeResult.RX)))
dataItem = append(dataItem, whiteStyle.Render(time.Duration(ttfb).String()))
}
// show message
dataItem = append(dataItem, dataError)
data = append(data, dataItem)
Expand Down
22 changes: 12 additions & 10 deletions cmd/support-perf.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,12 @@ type ClientResult struct {

// SiteNetStats - status for siteNet
type SiteNetStats struct {
TX uint64 `json:"tx"` // transfer rate in bytes
TXTotalDuration time.Duration `json:"txTotalDuration"`
RX uint64 `json:"rx"` // received rate in bytes
RXTotalDuration time.Duration `json:"rxTotalDuration"`
TotalConn uint64 `json:"totalConn"`
TX uint64 `json:"tx"` // transfer rate in bytes
TXTotalDuration time.Duration `json:"txTotalDuration"`
TXTotalSpentDuration time.Duration `json:"txTotalSpentDuration"`
RX uint64 `json:"rx"` // received rate in bytes
RXTotalDuration time.Duration `json:"rxTotalDuration"`
TotalConn uint64 `json:"totalConn"`
}

// SiteReplicationTestNodeResult - result of the network performance test for site-replication
Expand Down Expand Up @@ -341,11 +342,12 @@ func convertSiteReplicationTestResults(netResults *madmin.SiteNetPerfResult) *Si
Endpoint: nr.Endpoint,
Error: nr.Error,
Perf: SiteNetStats{
TX: nr.TX,
TXTotalDuration: nr.TXTotalDuration,
RX: nr.RX,
RXTotalDuration: nr.RXTotalDuration,
TotalConn: nr.TotalConn,
TX: nr.TX,
TXTotalDuration: nr.TXTotalDuration,
TXTotalSpentDuration: nr.TXTotalSpentDuration,
RX: nr.RX,
RXTotalDuration: nr.RXTotalDuration,
TotalConn: nr.TotalConn,
},
})
}
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,5 @@ require (
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
)

replace github.com/minio/madmin-go/v3 => github.com/jiuker/madmin-go/v3 v3.0.0-20231031103307-d17929c5d046
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/jedib0t/go-pretty/v6 v6.4.7 h1:lwiTJr1DEkAgzljsUsORmWsVn5MQjt1BPJdPCtJ6KXE=
github.com/jedib0t/go-pretty/v6 v6.4.7/go.mod h1:Ndk3ase2CkQbXLLNf5QDHoYb6J9WtVfmHZu9n8rk2xs=
github.com/jiuker/madmin-go/v3 v3.0.0-20231031103307-d17929c5d046 h1:Oo0OfHCPECGKtxD0uVbY/TPB2H0XGq3U6R82xjj8hOQ=
github.com/jiuker/madmin-go/v3 v3.0.0-20231031103307-d17929c5d046/go.mod h1:4QN2NftLSV7MdlT50dkrenOMmNVHluxTvlqJou3hte8=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/juju/ratelimit v1.0.2 h1:sRxmtRiajbvrcLQT7S+JbqU0ntsb9W2yhSdNN8tWfaI=
Expand Down Expand Up @@ -140,8 +142,6 @@ github.com/minio/colorjson v1.0.6 h1:m7TUvpvt0u7FBmVIEQNIa0T4NBQlxrcMBp4wJKsg2Ik
github.com/minio/colorjson v1.0.6/go.mod h1:LUXwS5ZGNb6Eh9f+t+3uJiowD3XsIWtsvTriUBeqgYs=
github.com/minio/filepath v1.0.0 h1:fvkJu1+6X+ECRA6G3+JJETj4QeAYO9sV43I79H8ubDY=
github.com/minio/filepath v1.0.0/go.mod h1:/nRZA2ldl5z6jT9/KQuvZcQlxZIMQoFFQPvEXx9T/Bw=
github.com/minio/madmin-go/v3 v3.0.29 h1:3bNLArtxIFud5wyb5/DnF5DGLBvcSJyzCA44EclX1Ow=
github.com/minio/madmin-go/v3 v3.0.29/go.mod h1:4QN2NftLSV7MdlT50dkrenOMmNVHluxTvlqJou3hte8=
github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34=
github.com/minio/md5-simd v1.1.2/go.mod h1:MzdKDxYpY2BT9XQFocsiZf/NKVtR7nkE4RoEpN+20RM=
github.com/minio/minio-go/v7 v7.0.63 h1:GbZ2oCvaUdgT5640WJOpyDhhDxvknAJU2/T3yurwcbQ=
Expand Down