Cloud-Native Benchmarking With Kubestone
Cloud-Native Benchmarking With Kubestone
This tool is meant to assist your development teams with getting performance metrics from your Kubernetes clusters.
Join the DZone community and get the full member experience.Join For Free
Organizations are increasingly looking to containers and distributed applications to provide the agility and scalability needed to satisfy their clients. While doing so, modern enterprises also need the ability to benchmark their application and be aware of certain metrics in relation to their infrastructure.
In this post, I am introducing you to a cloud-native bench-marking tool known as Kubestone. This tool is meant to assist your development teams with getting performance metrics from your Kubernetes clusters.
How Does Kubestone Work?
At it's core, Kubestone is implemented as a Kubernetes Operator in Go language with the help of Kubebuilder. You can find more info on the Operator Framework via this blog post.
Kubestone leverages Open Source benchmarks to measure Core Kubernetes and Application performance. As benchmarks are executed in Kubernetes, they must be containerized to work on the cluster. A certified set of benchmark containers is provided via xridge's DockerHub space. Here is a list of currently supported benchmarks:
|HTTP Load Tester||drill||Supported|
Let's try installing Kubestone and running a benchmark ourselves and see how it works.
Deploy Kubestone to
kubestone-system namespace with the following command:
Once deployed, Kubestone will listen for Custom Resources created with the
Benchmarks can be executed via Kubestone by creating Custom Resources in your cluster.
It is recommended to create a dedicated namespace for benchmarking.
After the namespace is created, you can use it to post a benchmark request to the cluster.
The resulting benchmark executions will reside in this namespace.
Custom Resource Rendering
The Custom Resource (rendered yaml) looks as follows:
When we create this resource in Kubernetes, the operator interprets it and creates the associated benchmark. The fields of the Custom Resource controls how the benchmark will be executed:
metadata.name: Identifies the Custom Resource. Later, this can be used to query or delete the benchmark in the cluster.
cmdLineArgs: Arguments passed to the benchmark. In this case we are providing the arguments to Fio (a filesystem benchmark). It instructs the benchmark to execute a random write test with 4Mb of block size with an overall transfer size of 256 MB.
image.name: Describes the Docker Image of the benchmark. In case of Fio, we are using xridge's fio Docker Image, which is built from this repository.
volume.persistentVolumeClaimSpec: Given that Fio is a disk benchmark, we can set a PersistentVolumeClaim for the benchmark to be executed. The above setup instructs Kubernetes to take 1GB of space from the default StorageClass and use it for the benchmark.
Running the Benchmark
Now, as we understand the definition of the benchmark, we can try to execute it.
Note: Make sure you installed the kubestone operator and have it running before executing this step.
Since we pipe the output of the
kustomize build command into
kubectl create, it will create the object in our Kubernetes cluster.
The resulting object can be queried using the object's type (
fio) and it's name (
Events section shows, Kubestone has created a
PersistentVolumeClaim and a
Job for the provided Custom Resource. The
Status field tells us that the benchmark has completed.
Inspecting the Benchmark
The created objects related to the benchmark can be listed using
As shown above, Fio controller has created a PersistentVolumeClaim and a ConfigMap which is used by the Fio Job during benchmark execution. The Fio Job has an associated Pod which contains our test execution. The results of the run can be shown with the
kubectl logs command:
We have learned that Kubestone uses Custom Resources to define benchmarks. We can list the installed custom resources using the
kubectl get crds command:
Using the CRD names above, we can list the executed benchmarks in the system.
Kubernetes provides a convenience feature regarding CRDs: one can use the shortened name of the CRD, which is the singular part of the fully qualified CRD name. In our case,
fios.perf.kubestone.xridge.io can be shortened to
fio. Hence, we can list the executed
fio benchmark using the following command:
After a successful benchmark run the resulting objects are stored in the Kubernetes cluster. Given that Kubernetes can hold a limited number of pods in the system, it is advised that the user cleans up the benchmark runs time to time. This can be achieved by deleting the Custom Resource, which initiated the benchmark:
Since the Custom Resource has ownership on the created resources, the underlying pods, jobs, configmaps, pvcs, etc. are also removed by this operation.
Now you are familiar with the key concepts of Kubestone, it is time to explore and benchmark. You can play around with Fio Benchmark via it's
cmdLineArgs, Persistent Volume and Scheduling related settings. You can find more information about that in Fio's benchmark page. Hopefully you gained some valuable knowledge from this post!
This article was originally posted on https://appfleet.com/.
Published at DZone with permission of Sudip Sengupta . See the original article here.
Opinions expressed by DZone contributors are their own.