ShixiongQi / loadtest

Runs a load test on the selected URL. Easy to extend minimally for your own ends.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Installation

git clone https://github.com/ShixiongQi/loadtest.git
cd loadtest

# install dependencies
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt install -y nodejs
npm install stdio
npm install log
npm install testing
npm install websocket
npm install confinode
npm install agentkeepalive
npm install https-proxy-agent

Usage

  1. Assume you have installed Kubernetes and Knative Serving (including the Istio Ingress)
  2. The following commands were tested with Kubernetes v1.19.0 and Knative v0.22.0
# First deploy two Knative services, make sure you are at the loadtest directory.
# You may need to modify the requested resources for each service based on your testing environment.
kubectl apply -f azure_wrk/example_service/example-service.yaml

# Make sure the services are successfully deployed before moving forward.

# Assume you will execute the load generator on Master node
node azure_wrk/workload-1-generator.js # Sending workload 1 to service 1
node azure_wrk/workload-2-generator.js # Sending workload 2 to service 2

# You can observe the change in the number of active instances per service
kubectl get deploy -w

Notes

  1. If you want to execute the load generator script (i.e., workload-1-generator.js) on Worker nodes, please comment out line 19 to line 23 as you cannot execute kubectl on worker node. Instead, you need to specify the IP and Port of your ingress gateway manually in the script. Go to the Master node, then please do kubectl get po -l istio=ingressgateway -n istio-system -o jsonpath='{.items[0].status.hostIP}' and kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="http2")].nodePort}' to retrieve the IP and port number of ingress gateway and then modify line 27 url: 'http://' + IH + ':' + IP + '?sleep=500',, e.g., if the IP and port number you get are 10.10.1.1 and 30521, then modify the line 27 as url: 'http://10.10.1.1:30521?sleep=500',
  2. If you run your own Knative service and want to specify the Knative service name in the load generator script, please modify line 29 headers: { 'Host': 'autoscale-go-2.default.example.com' }, and replace the Knative service name autoscale-go-2.default.example.com.

About

Runs a load test on the selected URL. Easy to extend minimally for your own ends.

License:MIT License


Languages

Language:JavaScript 100.0%