Skip to content

Commit

Permalink
Addressing Vishnu's feedback
Browse files Browse the repository at this point in the history
Signed-off-by: Joe Talerico aka rook <joe.talerico@gmail.com>
  • Loading branch information
jtaleric committed Sep 9, 2024
1 parent 105e247 commit 5356eb6
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 37 deletions.
16 changes: 6 additions & 10 deletions pkg/drivers/iperf.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,11 @@ func (i *iperf3) Run(c *kubernetes.Clientset,
for i := 0; i <= retry; i++ {
log.Debug("⏰ Waiting for iperf3 to be present on VM")
_, err = sshclient.Run("until iperf3 -h; do sleep 30; done")
if err != nil {
time.Sleep(10 * time.Second)
continue
} else {
if err == nil {
present = true
break
}
time.Sleep(10 * time.Second)
}
if !present {
sshclient.Close()
Expand All @@ -144,15 +142,13 @@ func (i *iperf3) Run(c *kubernetes.Clientset,
ran := false
for i := 0; i <= retry; i++ {
stdout, err = sshclient.Run(strings.Join(cmd[:], " "))
if err != nil {
log.Debugf("Failed running command %s", err)
log.Debugf("⏰ Retrying iperf3 command -- cloud-init still finishing up")
time.Sleep(60 * time.Second)
continue
} else {
if err == nil {
ran = true
break
}
log.Debugf("Failed running command %s", err)
log.Debugf("⏰ Retrying iperf3 command -- cloud-init still finishing up")
time.Sleep(60 * time.Second)
}
sshclient.Close()
if !ran {
Expand Down
16 changes: 6 additions & 10 deletions pkg/drivers/netperf.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,11 @@ func (n *netperf) Run(c *kubernetes.Clientset, rc rest.Config, nc config.Config,
for i := 0; i <= retry; i++ {
log.Debug("⏰ Waiting for netperf to be present on VM")
_, err = sshclient.Run("until which netperf; do sleep 30; done")
if err != nil {
time.Sleep(10 * time.Second)
continue
} else {
if err == nil {
present = true
break
}
time.Sleep(10 * time.Second)
}
if !present {
sshclient.Close()
Expand All @@ -123,15 +121,13 @@ func (n *netperf) Run(c *kubernetes.Clientset, rc rest.Config, nc config.Config,
ran := false
for i := 0; i <= retry; i++ {
_, err = sshclient.Run(fmt.Sprintf("netperf -H %s -l 1 -- %s", serverIP, strconv.Itoa(k8s.NetperfServerDataPort)))
if err != nil {
log.Debugf("Failed running command %s", err)
log.Debugf("⏰ Retrying netperf command -- cloud-init still finishing up")
time.Sleep(60 * time.Second)
continue
} else {
if err == nil {
ran = true
break
}
log.Debugf("Failed running command %s", err)
log.Debugf("⏰ Retrying netperf command -- cloud-init still finishing up")
time.Sleep(60 * time.Second)
}
stdout, err = sshclient.Run(strings.Join(cmd[:], " "))
if err != nil {
Expand Down
27 changes: 10 additions & 17 deletions pkg/drivers/uperf.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,11 @@ func (u *uperf) Run(c *kubernetes.Clientset, rc rest.Config, nc config.Config, c
for i := 0; i <= retry; i++ {
log.Debug("⏰ Waiting for uperf to be present on VM")
_, err = sshclient.Run("until uperf -h; do sleep 30; done")
if err != nil {
time.Sleep(10 * time.Second)
continue
} else {
if err == nil {
present = true
break
}
time.Sleep(10 * time.Second)
}
if !present {
sshclient.Close()
Expand All @@ -231,15 +229,13 @@ func (u *uperf) Run(c *kubernetes.Clientset, rc rest.Config, nc config.Config, c
ran := false
for i := 0; i <= retry; i++ {
stdout, err = sshclient.Run(strings.Join(cmd[:], " "))
if err != nil {
log.Debugf("Failed running command %s", err)
log.Debugf("⏰ Retrying uperf command -- cloud-init still finishing up")
time.Sleep(60 * time.Second)
continue
} else {
if err == nil {
ran = true
break
}
log.Debugf("Failed running command %s", err)
log.Debugf("⏰ Retrying uperf command -- cloud-init still finishing up")
time.Sleep(60 * time.Second)
}
sshclient.Close()
if !ran {
Expand All @@ -252,7 +248,7 @@ func (u *uperf) Run(c *kubernetes.Clientset, rc rest.Config, nc config.Config, c

// ParseResults accepts the stdout from the execution of the benchmark.
// It will return a Sample struct or error
func (u *uperf) ParseResults(stdout *bytes.Buffer, nc config.Config) (sample.Sample, error) {
func (u *uperf) ParseResults(stdout *bytes.Buffer, _ config.Config) (sample.Sample, error) {
sample := sample.Sample{}
sample.Driver = u.driverName
sample.Metric = "Mb/s"
Expand Down Expand Up @@ -285,13 +281,10 @@ func (u *uperf) ParseResults(stdout *bytes.Buffer, nc config.Config) (sample.Sam

}
averageByte, _ := stats.Mean(byteSummary)
if strings.Contains(nc.Profile, "STREAM") {
sample.Throughput = float64(averageByte*8) / 1000000
} else {
sample.Throughput, _ = stats.Mean(opSummary)
}
averageOps, _ := stats.Mean(opSummary)
sample.Throughput = float64(averageByte*8) / 1000000
sample.Latency99ptile, _ = stats.Percentile(latSummary, 99)
log.Debugf("Storing uperf sample Average bytes: %f , P99 Latency %f, Throughput: %f ", averageByte, sample.Latency99ptile, sample.Throughput)
log.Debugf("Storing uperf sample throughput: %f Mbps, P99 Latency %f, Average ops: %f ", sample.Throughput, sample.Latency99ptile, averageOps)

return sample, nil

Expand Down

0 comments on commit 5356eb6

Please sign in to comment.