Cristian Marius Tiutiu, Bikram Gupta, and Anish Singh Walia
Load Testing is a non-functional software testing process in which the performance of a system is tested under a specific expected load. It determines how the system behaves while being put under load. The goal of Load Testing is to improve performance bottlenecks and to ensure stability and smooth functioning of the system. Load testing gives confidence in the system & its reliability and performance.
K-bench is a framework to benchmark a Kubernetes infrastructure’s control and data plane aspects. K-Bench provides a configurable way to prescriptively create and manipulate Kubernetes resources at scale and eventually provide the target infrastructure’s relevant control plane and data plane performance metrics.
K-bench allows users to control the client-side concurrency, the operations, and how these different types of operations are executed sequentially or in parallel. In particular, the user can define, through a config file, a workflow of operations for supported resources.
After a successful run, the benchmark reports metrics (e.g., number of requests, API invoke latency, throughput, etc.) for the executed operations on various resource types.
In this tutorial, you will configure the K-bench. This tool needs to be installed on a droplet, preferably with access to the target cluster for testing. You will be configuring (if not already present) a Prometheus stack for your cluster to observe the results of a test run.
To complete this tutorial, you will need:
master
In this section, you will create a droplet that will serve as your K-bench master. On this droplet, you will clone the K-bench repo, perform the installation, run tests, and/or add any new tests that will fit your use case. The reason for using a droplet is that it is best to have a decoupled resource apart from the cluster, which we can use for just one specific reason, and that is doing load tests and visualizing the results of benchmarks.
Please follow the below steps to create a droplet, install and configure K-bench:
Create
button and select the Droplets
option.Authenticaion
choose the SSH keys option. If no SSH keys are present this article explains how to create one and add it to the DO account.Console
button. After this you will be presented with a screen informing you to Update Droplet Console
, follow those steps to gain SSH access to the droplet.Console
button again. You will be logged in as root into the droplet.git clone https://github.com/vmware-tanzu/k-bench.git
cd k-bench/
GO
and any other dependencies K-Bench
has../install.sh
Download Config File
and copy the contents of the config file. K-bench
needs that information to connect to the cluster.mkdir ~/.kube
vim ~/.kube/config
default
test../run.sh
results_run_<date>
cat results_run_29-Jun-2022-08-06-42-am/default/kbench.log
Note:
The tests are added under the config
folder of k-bench
. To change an existing test, its config.json
file needs to be updated.
The test is run via the -t
flag supplied by k-bench. For example, running the cp_heavy_12client
is done via: ./run.sh -t cp_heavy_12client
K-bench
tests are very easily observable using Grafana. You can create different dashboards to provide observability and understanding of Prometheus metrics. In this section you will explore some useful metrics for Kubernetes and some Dashboards which can offer insight into what is happening with the DOKS cluster under load.
Note: This section can only be completed if the Prometheus stack was created earlier in Step 2 of the Prerequisites section or is installed on the cluster.
Please follow the below steps:
admin/prom-operator
) by port forwarding to the local machine.kubectl --namespace monitoring port-forward svc/kube-prom-stack-grafana 3000:80
http://localhost:3000/
and log in to Grafana.Kubernetes System Api Server
by navigating to http://localhost:3000/dashboard/import
, add the 15761
ID in the box under Import via grafana.com
and add LoadDashboards
menu and click on the Node Exporter Nodes to open a Node
resource-oriented dashboard. You can use this dashboard to monitor the resources available in your nodes during a test.Explore
page, enter the following in the metrics browser: count(kube_pod_info{namespace="kbench-pod-namespace"})
. This will show a graph with the number of pods at any given time.K-bench provides a configurable way for users to create and manipulate Kubernetes resources at scale and generate relevant performance metrics for the target infrastructure. With K-bench, users can control the client-side concurrency, define operations workflows for supported resources, and obtain detailed benchmark reports for various resource types. By using K-bench, users can gain confidence in the reliability and performance of their system, ultimately leading to a better user experience.
Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Sign up for Infrastructure as a Newsletter.
Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.