Load Testing in Kubernetes using Siege


In this article, I will show you how to simulate traffic to your Kubernetes cluster using a tool called Siege and then verify the increased traffic/load using Prometheus.

Load Testing in Kubernetes

Siege is an excellent open source command line tool to get started with load testing your application. It allows you to hit a webpage in your server with a configurable number of simulated users. It evaluates the amount of Data Transferred, Response time of the server, Transaction Rate, Throughput, Concurrency, Failed Transaction count, Average duration of the transactions.

Siege can help you to simulate traffic as well let you know how much traffic your application can handle. It is great for Performance Testing as well.

Prometheus is an open-source tool for monitoring your system. You can determine the overall health and metrics of your Kubernetes cluster by querying Prometheus.
PromQL is the Prometheus Query Language. It allows for a wide range of operations including aggregation, slicing and dicing, prediction and joins.

Siege Github Repo –
https://github.com/JoeDog/siege

Siege can be installed in MacOS via Homebrew —

$ brew install siege

There are a number of options which you can use to make your tests mimic a real world production environment.

$ siege –help

Now let us create a sample test using Siege. Let us simulate 50 users hitting the ProductPage simultaneously, with no delay between request and for a total time period of 20 seconds –

siege -c50 -b -t20S testwebsite.com/productpage

Perf Test Seige 50

Next let us open the Prometheus UI. Let us execute the port forward it to my localhost port 9090 —

kubectl -n istio-system port-forward $(kubectl -n istio-system get pod -l app=prometheus -o jsonpath='{.items[0].metadata.name}’) 9090:9090 &

Let’s open http://localhost:9090/graph in the web browser.

Let us now execute a Prometheus Query to verify the total count of requests to the ProductPage —

sum(increase(istio_request_count{destination_service=”productpage.default.svc.cluster.local”,destination_version=”v1″}[1m]))

As expected, you see a spike in the requests once the Siege query was executed —

Perf Testing Increased load

 

Performance Testing with Siege

You can get a quick overview of your application performance, by running Siege with a different number of concurrent users and compare the results – say ‘response time’.

siege -c50 -b -t10S testwebsite.com/productpage

siege -c10 -b -t10S testwebsite.com/productpage

Perf Test Seige 10

From the summary results above, you can see that as the number of concurrent users decreased from 50 to 10, the response time of the application improved from 0.17 sec to 0.06 sec.

The Prometheus graph correctly shows the spike in traffic when the above command is run to generate traffic.

Perf Testing Prometheus Graph

 

In this article, I demonstrated how to quickly load test and performance test your application using Siege and verify the increased traffic in Prometheus. Let me know if you have any questions on this by adding a comment below, and I would be happy to discuss.



Categories: Kubernetes, Load Testing

2 replies

Trackbacks

  1. Crash Loop Detection in Kubernetes – dotnetvibes
  2. Kubernetes Architecture – dotnetvibes

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: