-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #117 from fuweid/weifu/10kpods
*: init node100_dp5_pod10k for runkperf bench
- Loading branch information
Showing
15 changed files
with
402 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
108 changes: 108 additions & 0 deletions
108
contrib/cmd/runkperf/commands/bench/node100_dp5_pod10k.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
package bench | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"sync" | ||
"time" | ||
|
||
internaltypes "github.com/Azure/kperf/contrib/internal/types" | ||
"github.com/Azure/kperf/contrib/internal/utils" | ||
|
||
"github.com/urfave/cli" | ||
) | ||
|
||
var benchNode100Deployment5Pod10KCase = cli.Command{ | ||
Name: "node100_dp5_pod10k", | ||
Usage: ` | ||
The test suite is to setup 100 virtual nodes and deploy 5 deployments for 10k | ||
pods on that nodes. It repeats to rolling-update deployments one by one during | ||
benchmark. | ||
`, | ||
Flags: []cli.Flag{ | ||
cli.IntFlag{ | ||
Name: "total", | ||
Usage: "Total requests per runner (There are 10 runners totally and runner's rate is 10)", | ||
Value: 36000, | ||
}, | ||
cli.IntFlag{ | ||
Name: "podsize", | ||
Usage: "Add <key=data, value=randomStringByLen(podsize)> in pod's annotation to increase pod size. The value is close to pod's size", | ||
Value: 0, | ||
}, | ||
}, | ||
Action: func(cliCtx *cli.Context) error { | ||
_, err := renderBenchmarkReportInterceptor( | ||
addAPIServerCoresInfoInterceptor(benchNode100Deployment5Pod10KRun), | ||
)(cliCtx) | ||
return err | ||
}, | ||
} | ||
|
||
// benchNode100Deployment5Pod10KCase is for subcommand benchNode100Deployment5Pod10KCase. | ||
func benchNode100Deployment5Pod10KRun(cliCtx *cli.Context) (*internaltypes.BenchmarkReport, error) { | ||
ctx := context.Background() | ||
kubeCfgPath := cliCtx.GlobalString("kubeconfig") | ||
|
||
rgCfgFile, rgSpec, rgCfgFileDone, err := newLoadProfileFromEmbed(cliCtx, | ||
"loadprofile/node100_dp5_pod10k.yaml") | ||
if err != nil { | ||
return nil, err | ||
} | ||
defer func() { _ = rgCfgFileDone() }() | ||
|
||
vcDone, err := deployVirtualNodepool(ctx, cliCtx, "node100dp5pod10k", 100, 150) | ||
if err != nil { | ||
return nil, fmt.Errorf("failed to deploy virtual node: %w", err) | ||
} | ||
defer func() { _ = vcDone() }() | ||
|
||
var wg sync.WaitGroup | ||
wg.Add(1) | ||
|
||
restartInterval := 10 * time.Second | ||
dpCtx, dpCancel := context.WithCancel(ctx) | ||
|
||
podSize := cliCtx.Int("podsize") | ||
rollingUpdateFn, err := utils.RepeatRollingUpdate10KPod(dpCtx, kubeCfgPath, "dp5pod10k", podSize, restartInterval) | ||
if err != nil { | ||
dpCancel() | ||
return nil, fmt.Errorf("failed to setup workload: %w", err) | ||
} | ||
|
||
go func() { | ||
defer wg.Done() | ||
|
||
// FIXME(weifu): | ||
// | ||
// DeployRunnerGroup should return ready notification. | ||
// The rolling update should run after runners. | ||
rollingUpdateFn() | ||
}() | ||
|
||
rgResult, derr := utils.DeployRunnerGroup(ctx, | ||
cliCtx.GlobalString("kubeconfig"), | ||
cliCtx.GlobalString("runner-image"), | ||
rgCfgFile, | ||
cliCtx.GlobalString("runner-flowcontrol"), | ||
cliCtx.GlobalString("rg-affinity"), | ||
) | ||
dpCancel() | ||
wg.Wait() | ||
|
||
if derr != nil { | ||
return nil, derr | ||
} | ||
|
||
return &internaltypes.BenchmarkReport{ | ||
Description: fmt.Sprintf(` | ||
Environment: 100 virtual nodes managed by kwok-controller, | ||
Workload: Deploy 5 deployments with 10,000 pods. Rolling-update deployments one by one and the interval is %v`, restartInterval), | ||
LoadSpec: *rgSpec, | ||
Result: *rgResult, | ||
Info: map[string]interface{}{ | ||
"podSizeInBytes": podSize, | ||
}, | ||
}, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package manifests | ||
|
||
import ( | ||
rootmainfests "github.com/Azure/kperf/manifests" | ||
|
||
"helm.sh/helm/v3/pkg/chart" | ||
) | ||
|
||
// LoadChart returns chart from current package's embed filesystem. | ||
func LoadChart(componentName string) (*chart.Chart, error) { | ||
return rootmainfests.LoadChartFromEmbedFS(FS, componentName) | ||
} |
40 changes: 40 additions & 0 deletions
40
contrib/internal/manifests/loadprofile/node100_dp5_pod10k.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
count: 10 | ||
loadProfile: | ||
version: 1 | ||
description: "node100-deployment5-pod10k" | ||
spec: | ||
rate: 10 | ||
total: 36000 | ||
conns: 10 | ||
client: 100 | ||
contentType: json | ||
disableHTTP2: false | ||
maxRetries: 0 | ||
requests: | ||
- staleList: | ||
version: v1 | ||
resource: pods | ||
# NOTE: Please align with ../../utils/utils.go#RepeatRollingUpdate10KPod | ||
seletor: "app=benchmark" | ||
# NOTE: Please align with ../../../cmd/runkperf/commands/bench/node100_dp5_pod10k.go. | ||
# And there are only 100 nodes and each node can run 150 pods. It should | ||
# have items in the response. | ||
fieldSelector: "spec.nodeName=node100dp5pod10k-49" | ||
shares: 1000 # 1000 / (1000 + 100 + 200) * 10 = 7.7 req/s | ||
- staleList: | ||
version: v1 | ||
resource: pods | ||
shares: 100 # 100 / (1000 + 100 + 200) * 10 = 0.7 req/s | ||
- quorumList: | ||
version: v1 | ||
resource: pods | ||
namespace: benchmark-0 | ||
# NOTE: It's to simulate the request created by daemonset to get pods, | ||
# including kubelet, when they want to get pods from ETCD. The limit | ||
# is 100 because it's close to MaxPods value. | ||
limit: 100 | ||
# NOTE: Please align with ../../../cmd/runkperf/commands/bench/node100_dp5_pod10k.go. | ||
fieldSelector: "spec.nodeName=node100dp5pod10k-49" | ||
# And there are only 100 nodes and each node can run 150 pods. It should | ||
# have items in the response. | ||
shares: 200 # 200 / (1000 + 100 + 200) * 10 = 1.5 req/s |
3 changes: 3 additions & 0 deletions
3
contrib/internal/manifests/workload/2kpodper1deployment/Chart.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
apiVersion: v1 | ||
name: "2k-pods-per-1-deployment" | ||
version: "0.0.1" |
53 changes: 53 additions & 0 deletions
53
contrib/internal/manifests/workload/2kpodper1deployment/templates/deployments.tpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
{{- $pattern := .Values.pattern }} | ||
{{- $podSizeInBytes := int .Values.podSizeInBytes }} | ||
{{- range $index := (untilStep 0 (int .Values.total) 1) }} | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: {{ $pattern }}-{{ $index }} | ||
labels: | ||
name: benchmark-testing | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ $pattern }}-{{ $index }} | ||
namespace: {{ $pattern }}-{{ $index }} | ||
labels: | ||
app: {{ $pattern }} | ||
spec: | ||
replicas: 2000 | ||
strategy: | ||
rollingUpdate: | ||
maxSurge: 100 | ||
type: RollingUpdate | ||
selector: | ||
matchLabels: | ||
app: {{ $pattern }} | ||
index: "{{ $index }}" | ||
template: | ||
metadata: | ||
labels: | ||
app: {{ $pattern }} | ||
index: "{{ $index }}" | ||
annotations: | ||
data: "{{ randAlphaNum $podSizeInBytes | nospace }}" | ||
spec: | ||
affinity: | ||
nodeAffinity: | ||
requiredDuringSchedulingIgnoredDuringExecution: | ||
nodeSelectorTerms: | ||
- matchExpressions: | ||
- key: type | ||
operator: In | ||
values: | ||
- kperf-virtualnodes | ||
tolerations: | ||
- key: "kperf.io/nodepool" | ||
operator: "Exists" | ||
effect: "NoSchedule" | ||
containers: | ||
- name: fake-container | ||
image: fake-image | ||
--- | ||
{{- end}} |
3 changes: 3 additions & 0 deletions
3
contrib/internal/manifests/workload/2kpodper1deployment/values.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
pattern: "benchmark" | ||
total: 5 | ||
podSizeInBytes: 2048 |
Oops, something went wrong.