Skip to content

Commit

Permalink
Merge branch 'main' into virt
Browse files Browse the repository at this point in the history
  • Loading branch information
jtaleric authored Sep 5, 2024
2 parents 9278164 + 6065e03 commit f4578fd
Show file tree
Hide file tree
Showing 8 changed files with 119 additions and 99 deletions.
152 changes: 77 additions & 75 deletions README.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions cmd/k8s-netperf/k8s-netperf.go
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ func executeWorkload(nc config.Config,
if err != nil {
log.Fatal(err)
}
nr, err = driver.ParseResults(&r)
nr, err = driver.ParseResults(&r, nc)
if err != nil {
log.Error(err)
try := 0
Expand All @@ -433,7 +433,7 @@ func executeWorkload(nc config.Config,
log.Error(err)
continue
}
nr, err = driver.ParseResults(&r)
nr, err = driver.ParseResults(&r, nc)
if err != nil {
log.Error(err)
try++
Expand Down
3 changes: 3 additions & 0 deletions pkg/archive/archive.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ type Doc struct {
AcrossAZ bool `json:"acrossAZ"`
Samples int `json:"samples"`
Messagesize int `json:"messageSize"`
Burst int `json:"burst"`
Throughput float64 `json:"throughput"`
Latency float64 `json:"latency"`
TputMetric string `json:"tputMetric"`
Expand Down Expand Up @@ -99,6 +100,7 @@ func BuildDocs(sr result.ScenarioResults, uuid string) ([]interface{}, error) {
Samples: r.Samples,
Service: r.Service,
Messagesize: r.MessageSize,
Burst: r.Burst,
TputMetric: r.Metric,
LtcyMetric: ltcyMetric,
ServerNodeCPU: r.ServerMetrics,
Expand Down Expand Up @@ -177,6 +179,7 @@ func commonCsvDataFields(row result.Data) []string {
strconv.Itoa(row.Parallelism),
strconv.Itoa(row.Samples),
strconv.Itoa(row.MessageSize),
strconv.Itoa(row.Burst),
strconv.FormatFloat(lo, 'f', -1, 64),
strconv.FormatFloat(hi, 'f', -1, 64),
}
Expand Down
1 change: 1 addition & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ type Config struct {
Profile string `yaml:"profile,omitempty"`
Samples int `yaml:"samples,omitempty"`
MessageSize int `yaml:"messagesize,omitempty"`
Burst int `yaml:"burst,omitempty"`
Service bool `default:"false" yaml:"service,omitempty"`
Metric string
AcrossAZ bool
Expand Down
2 changes: 1 addition & 1 deletion pkg/drivers/iperf.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ func (i *iperf3) Run(c *kubernetes.Clientset,

// ParseResults accepts the stdout from the execution of the benchmark.
// It will return a Sample struct or error
func (i *iperf3) ParseResults(stdout *bytes.Buffer) (sample.Sample, error) {
func (i *iperf3) ParseResults(stdout *bytes.Buffer, _ config.Config) (sample.Sample, error) {
sample := sample.Sample{}
sample.Driver = i.driverName
result := IperfResult{}
Expand Down
19 changes: 15 additions & 4 deletions pkg/drivers/netperf.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,20 @@ func (n *netperf) Run(c *kubernetes.Clientset, rc rest.Config, nc config.Config,
fmt.Sprint(nc.Duration),
"-t", nc.Profile,
"--",
"-k", fmt.Sprint(omniOptions),
"-m", fmt.Sprint(nc.MessageSize),
"-R", "1"}
"-k", fmt.Sprint(omniOptions)}
var additionalOptions []string
if strings.Contains(nc.Profile, "STREAM") {
additionalOptions = []string {
"-m", fmt.Sprint(nc.MessageSize)}
} else {
additionalOptions = []string {
"-r", fmt.Sprint(nc.MessageSize, ",", nc.MessageSize)}
if strings.Contains(nc.Profile, "TCP_RR") && (nc.Burst > 0) {
burst := []string {"-b", fmt.Sprint(nc.Burst)}
additionalOptions = append(additionalOptions, burst...)
}
}
cmd = append(cmd, additionalOptions...)
log.Debug(cmd)
if !perf.VM {
req := c.CoreV1().RESTClient().
Expand Down Expand Up @@ -132,7 +143,7 @@ func (n *netperf) Run(c *kubernetes.Clientset, rc rest.Config, nc config.Config,

// ParseResults accepts the stdout from the execution of the benchmark. It also needs
// It will return a Sample struct or error
func (n *netperf) ParseResults(stdout *bytes.Buffer) (sample.Sample, error) {
func (n *netperf) ParseResults(stdout *bytes.Buffer, _ config.Config) (sample.Sample, error) {
sample := sample.Sample{}
sample.Driver = n.driverName
send := 0.0
Expand Down
11 changes: 7 additions & 4 deletions pkg/drivers/uperf.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,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) (sample.Sample, error) {
func (u *uperf) ParseResults(stdout *bytes.Buffer, nc config.Config) (sample.Sample, error) {
sample := sample.Sample{}
sample.Driver = u.driverName
sample.Metric = "Mb/s"
Expand Down Expand Up @@ -285,10 +285,13 @@ func (u *uperf) ParseResults(stdout *bytes.Buffer) (sample.Sample, error) {

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

return sample, nil

Expand Down
26 changes: 13 additions & 13 deletions pkg/results/result.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,21 +190,21 @@ func calDiff(a float64, b float64) float64 {

// ShowPodCPU accepts ScenarioResults and presents to the user via stdout the PodCPU info
func ShowPodCPU(s ScenarioResults) {
table := initTable([]string{"Result Type", "Driver", "Role", "Scenario", "Parallelism", "Host Network", "Service", "Message Size", "Same node", "Pod", "Utilization"})
table := initTable([]string{"Result Type", "Driver", "Role", "Scenario", "Parallelism", "Host Network", "Service", "Message Size", "Burst", "Same node", "Pod", "Utilization"})
for _, r := range s.Results {
for _, pod := range r.ClientPodCPU.Results {
table.Append([]string{"Pod CPU Utilization", r.Driver, "Client", r.Profile, fmt.Sprintf("%d", r.Parallelism), fmt.Sprintf("%t", r.HostNetwork), fmt.Sprintf("%t", r.Service), fmt.Sprintf("%d", r.MessageSize), fmt.Sprintf("%t", r.SameNode), fmt.Sprintf("%.20s", pod.Name), fmt.Sprintf("%f", pod.Value)})
table.Append([]string{"Pod CPU Utilization", r.Driver, "Client", r.Profile, fmt.Sprintf("%d", r.Parallelism), fmt.Sprintf("%t", r.HostNetwork), fmt.Sprintf("%t", r.Service), fmt.Sprintf("%d", r.MessageSize), fmt.Sprintf("%d", r.Burst), fmt.Sprintf("%t", r.SameNode), fmt.Sprintf("%.20s", pod.Name), fmt.Sprintf("%f", pod.Value)})
}
for _, pod := range r.ServerPodCPU.Results {
table.Append([]string{"Pod CPU Utilization", r.Driver, "Server", r.Profile, fmt.Sprintf("%d", r.Parallelism), fmt.Sprintf("%t", r.HostNetwork), fmt.Sprintf("%t", r.Service), fmt.Sprintf("%d", r.MessageSize), fmt.Sprintf("%t", r.SameNode), fmt.Sprintf("%.20s", pod.Name), fmt.Sprintf("%f", pod.Value)})
table.Append([]string{"Pod CPU Utilization", r.Driver, "Server", r.Profile, fmt.Sprintf("%d", r.Parallelism), fmt.Sprintf("%t", r.HostNetwork), fmt.Sprintf("%t", r.Service), fmt.Sprintf("%d", r.MessageSize), fmt.Sprintf("%d", r.Burst), fmt.Sprintf("%t", r.SameNode), fmt.Sprintf("%.20s", pod.Name), fmt.Sprintf("%f", pod.Value)})
}
}
table.Render()
}

// ShowNodeCPU accepts ScenarioResults and presents to the user via stdout the NodeCPU info
func ShowNodeCPU(s ScenarioResults) {
table := initTable([]string{"Result Type", "Driver", "Role", "Scenario", "Parallelism", "Host Network", "Service", "Message Size", "Same node", "Idle CPU", "User CPU", "System CPU", "Steal CPU", "IOWait CPU", "Nice CPU", "SoftIRQ CPU", "IRQ CPU"})
table := initTable([]string{"Result Type", "Driver", "Role", "Scenario", "Parallelism", "Host Network", "Service", "Message Size", "Burst", "Same node", "Idle CPU", "User CPU", "System CPU", "Steal CPU", "IOWait CPU", "Nice CPU", "SoftIRQ CPU", "IRQ CPU"})
for _, r := range s.Results {
// Skip RR/CRR iperf3 Results
if strings.Contains(r.Profile, "RR") {
Expand All @@ -215,11 +215,11 @@ func ShowNodeCPU(s ScenarioResults) {
ccpu := r.ClientMetrics
scpu := r.ServerMetrics
table.Append([]string{
"Node CPU Utilization", r.Driver, "Client", r.Profile, fmt.Sprintf("%d", r.Parallelism), fmt.Sprintf("%t", r.HostNetwork), fmt.Sprintf("%t", r.Service), fmt.Sprintf("%d", r.MessageSize), fmt.Sprintf("%t", r.SameNode),
"Node CPU Utilization", r.Driver, "Client", r.Profile, fmt.Sprintf("%d", r.Parallelism), fmt.Sprintf("%t", r.HostNetwork), fmt.Sprintf("%t", r.Service), fmt.Sprintf("%d", r.MessageSize), fmt.Sprintf("%d", r.Burst), fmt.Sprintf("%t", r.SameNode),
fmt.Sprintf("%f", ccpu.Idle), fmt.Sprintf("%f", ccpu.User), fmt.Sprintf("%f", ccpu.System), fmt.Sprintf("%f", ccpu.Steal), fmt.Sprintf("%f", ccpu.Iowait), fmt.Sprintf("%f", ccpu.Nice), fmt.Sprintf("%f", ccpu.Softirq), fmt.Sprintf("%f", ccpu.Irq),
})
table.Append([]string{
"Node CPU Utilization", r.Driver, "Server", r.Profile, fmt.Sprintf("%d", r.Parallelism), fmt.Sprintf("%t", r.HostNetwork), fmt.Sprintf("%t", r.Service), fmt.Sprintf("%d", r.MessageSize), fmt.Sprintf("%t", r.SameNode),
"Node CPU Utilization", r.Driver, "Server", r.Profile, fmt.Sprintf("%d", r.Parallelism), fmt.Sprintf("%t", r.HostNetwork), fmt.Sprintf("%t", r.Service), fmt.Sprintf("%d", r.MessageSize), fmt.Sprintf("%d", r.Burst), fmt.Sprintf("%t", r.SameNode),
fmt.Sprintf("%f", scpu.Idle), fmt.Sprintf("%f", scpu.User), fmt.Sprintf("%f", scpu.System), fmt.Sprintf("%f", scpu.Steal), fmt.Sprintf("%f", scpu.Iowait), fmt.Sprintf("%f", scpu.Nice), fmt.Sprintf("%f", scpu.Softirq), fmt.Sprintf("%f", scpu.Irq),
})
}
Expand All @@ -228,23 +228,23 @@ func ShowNodeCPU(s ScenarioResults) {

// ShowSpecificResults
func ShowSpecificResults(s ScenarioResults) {
table := initTable([]string{"Type", "Driver", "Scenario", "Parallelism", "Host Network", "Service", "Message Size", "Same node", "Duration", "Samples", "Avg value"})
table := initTable([]string{"Type", "Driver", "Scenario", "Parallelism", "Host Network", "Service", "Message Size", "Burst", "Same node", "Duration", "Samples", "Avg value"})
for _, r := range s.Results {
if strings.Contains(r.Profile, "TCP_STREAM") {
rt, _ := Average(r.RetransmitSummary)
table.Append([]string{"TCP Retransmissions", r.Driver, r.Profile, strconv.Itoa(r.Parallelism), strconv.FormatBool(r.HostNetwork), strconv.FormatBool(r.Service), strconv.Itoa(r.MessageSize), strconv.FormatBool(r.SameNode), strconv.Itoa(r.Duration), strconv.Itoa(r.Samples), fmt.Sprintf("%f", (rt))})
table.Append([]string{"TCP Retransmissions", r.Driver, r.Profile, strconv.Itoa(r.Parallelism), strconv.FormatBool(r.HostNetwork), strconv.FormatBool(r.Service), strconv.Itoa(r.MessageSize), strconv.Itoa(r.Burst), strconv.FormatBool(r.SameNode), strconv.Itoa(r.Duration), strconv.Itoa(r.Samples), fmt.Sprintf("%f", (rt))})
}
if strings.Contains(r.Profile, "UDP_STREAM") {
loss, _ := Average(r.LossSummary)
table.Append([]string{"UDP Loss Percent", r.Driver, r.Profile, strconv.Itoa(r.Parallelism), strconv.FormatBool(r.HostNetwork), strconv.FormatBool(r.Service), strconv.Itoa(r.MessageSize), strconv.FormatBool(r.SameNode), strconv.Itoa(r.Duration), strconv.Itoa(r.Samples), fmt.Sprintf("%f", (loss))})
table.Append([]string{"UDP Loss Percent", r.Driver, r.Profile, strconv.Itoa(r.Parallelism), strconv.FormatBool(r.HostNetwork), strconv.FormatBool(r.Service), strconv.Itoa(r.MessageSize), strconv.Itoa(r.Burst), strconv.FormatBool(r.SameNode), strconv.Itoa(r.Duration), strconv.Itoa(r.Samples), fmt.Sprintf("%f", (loss))})
}
}
table.Render()
}

// Abstracts out the common code for results
func renderResults(s ScenarioResults, testType string) {
table := initTable([]string{"Result Type", "Driver", "Scenario", "Parallelism", "Host Network", "Service", "Message Size", "Same node", "Duration", "Samples", "Avg value", "95% Confidence Interval"})
table := initTable([]string{"Result Type", "Driver", "Scenario", "Parallelism", "Host Network", "Service", "Message Size", "Burst", "Same node", "Duration", "Samples", "Avg value", "95% Confidence Interval"})
for _, r := range s.Results {
if strings.Contains(r.Profile, testType) {
if len(r.Driver) > 0 {
Expand All @@ -253,7 +253,7 @@ func renderResults(s ScenarioResults, testType string) {
if r.Samples > 1 {
_, lo, hi = ConfidenceInterval(r.ThroughputSummary, 0.95)
}
table.Append([]string{fmt.Sprintf("📊 %s Results", caser.String(strings.ToLower(testType))), r.Driver, r.Profile, strconv.Itoa(r.Parallelism), strconv.FormatBool(r.HostNetwork), strconv.FormatBool(r.Service), strconv.Itoa(r.MessageSize), strconv.FormatBool(r.SameNode), strconv.Itoa(r.Duration), strconv.Itoa(r.Samples), fmt.Sprintf("%f (%s)", avg, r.Metric), fmt.Sprintf("%f-%f (%s)", lo, hi, r.Metric)})
table.Append([]string{fmt.Sprintf("📊 %s Results", caser.String(strings.ToLower(testType))), r.Driver, r.Profile, strconv.Itoa(r.Parallelism), strconv.FormatBool(r.HostNetwork), strconv.FormatBool(r.Service), strconv.Itoa(r.MessageSize), strconv.Itoa(r.Burst), strconv.FormatBool(r.SameNode), strconv.Itoa(r.Duration), strconv.Itoa(r.Samples), fmt.Sprintf("%f (%s)", avg, r.Metric), fmt.Sprintf("%f-%f (%s)", lo, hi, r.Metric)})
}
}
}
Expand Down Expand Up @@ -282,11 +282,11 @@ func ShowRRResult(s ScenarioResults) {
func ShowLatencyResult(s ScenarioResults) {
if checkResults(s, "RR") {
logging.Debug("Rendering RR P99 Latency results")
table := initTable([]string{"Result Type", "Driver", "Scenario", "Parallelism", "Host Network", "Service", "Message Size", "Same node", "Duration", "Samples", "Avg 99%tile value"})
table := initTable([]string{"Result Type", "Driver", "Scenario", "Parallelism", "Host Network", "Service", "Message Size", "Burst", "Same node", "Duration", "Samples", "Avg 99%tile value"})
for _, r := range s.Results {
if strings.Contains(r.Profile, "RR") {
p99, _ := Average(r.LatencySummary)
table.Append([]string{"RR Latency Results", r.Driver, r.Profile, strconv.Itoa(r.Parallelism), strconv.FormatBool(r.HostNetwork), strconv.FormatBool(r.Service), strconv.Itoa(r.MessageSize), strconv.FormatBool(r.SameNode), strconv.Itoa(r.Duration), strconv.Itoa(r.Samples), fmt.Sprintf("%f (%s)", p99, "usec")})
table.Append([]string{"RR Latency Results", r.Driver, r.Profile, strconv.Itoa(r.Parallelism), strconv.FormatBool(r.HostNetwork), strconv.FormatBool(r.Service), strconv.Itoa(r.MessageSize), strconv.Itoa(r.Burst), strconv.FormatBool(r.SameNode), strconv.Itoa(r.Duration), strconv.Itoa(r.Samples), fmt.Sprintf("%f (%s)", p99, "usec")})
}
}
table.Render()
Expand Down

0 comments on commit f4578fd

Please sign in to comment.