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

Init runner sub command #2

Merged
merged 7 commits into from
Dec 8, 2023
Merged

Conversation

fuweid
Copy link
Collaborator

@fuweid fuweid commented Dec 7, 2023

This pull request is to implement kperf runner run sub-command.

How to build

# cd into repo
$ make build
$ ls -al ./bin
total 40404
drwxrwxr-x 2 weifu weifu     4096 Dec  8 07:16 .
drwxrwxr-x 9 weifu weifu     4096 Dec  8 02:55 ..
-rwxrwxr-x 1 weifu weifu 41364238 Dec  8 07:16 kperf

$ ./bin/kperf runner run -h
NAME:
   kperf runner run - run a benchmark test to kube-apiserver

USAGE:
   kperf runner run [command options] [arguments...]

OPTIONS:
   --kubeconfig value  Path to the kubeconfig file
   --config value      Path to the configuration file
   --conns value       Total number of connections. It can override corresponding value defined by --config (default: 1)
   --rate value        Maximum requests per second (Zero means no limitation). It can override corresponding value defined by --config (default: 0)
   --total value       Total number of requests. It can override corresponding value defined by --config (default: 1000)
   --user-agent value  User Agent

How to install

The user can install the binary into /usr/local/bin by default.

$ make install

The user can change the path by PREFIX.

# install binaries into /tmp/bin
$ PREFIX=/tmp make install

How to build binary into image

Default image name is localhost:5000/kperf:latest.

$ make image-build

The users can use IMAGE_REPO and IMAGE_TAG to change the image name.
For instance,

$ IMAGE_REPO=examplee2e.azurecr.io/public IMAGE_TAG=v1 make image-build
building examplee2e.azurecr.io/public/kperf:v1
....

How to push image

Both IMAGE_REPO and IMAGE_TAG also apply to image-push recipe.

$ make image-push

How to run benchmark test?

  • Step 1: Prepare load test profile

The profile is defined at api/types/load_profile.go. There is an example.

$ cat /tmp/xx.yaml
version: 1
description: test
spec:
  rate: 100
  total: 10
  conns: 10
  requests:
  - staleList:
      version: v1
      resource: pods
      limit: 500
    shares: 100
  - quorumList:
      version: v1
      resource: pods
      limit: 1000
    shares: 150
  • Step 2: Prepare cluster

  • Step 3: Run that load test with kubeconfig.

$ bin/kperf runner run --kubeconfig /home/weifu/.kube/config --config /tmp/xx.yaml --user-agent testing --total=10
Response stat:
  Total: 10
  Failures: 0
  Duration: 1.93187487s
  Requests/sec: 5.18
  Latency Distribution:
    [0.00] 0.138s
    [0.50] 0.141s
    [0.90] 0.144s
    [0.95] 0.663s
    [0.99] 0.663s
    [1.00] 0.663s

The kperf runner run will use service account if there is no kubeconfig.
If you use it in pod, please ensure that service account has permission to access.

The client-go requires GroupVersion to generate request so that this
patch is to update the KubeMetaType into KubeGroupVersionResources.

And add ResponseStats as benchmark result.

Signed-off-by: Wei Fu <[email protected]>
This package is used to collect metrics and gather info into target type.
In this patch, it adds ResponseMetric to collect latencies and failure
information.

Signed-off-by: Wei Fu <[email protected]>
That package is used to schedule random request and file that request to
apiserver.

Signed-off-by: Wei Fu <[email protected]>
Signed-off-by: Wei Fu <[email protected]>
@fuweid fuweid force-pushed the init-runner-sub-command branch from 8640015 to 82e36b2 Compare December 7, 2023 12:21
And the binary will be built with static tag.

Signed-off-by: Wei Fu <[email protected]>
@fuweid
Copy link
Collaborator Author

fuweid commented Dec 8, 2023

Merged it since CI is green.

@fuweid fuweid merged commit 5084b23 into Azure:main Dec 8, 2023
4 checks passed
@fuweid fuweid deleted the init-runner-sub-command branch December 8, 2023 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant