cluster: configuration files to work with a Kubernetes cluster
s1: User service
s2: Music service
s3: Playlist service
db: database service
logs: where logs files are stored
loader: loader service loads the DynamoDB tables, using the files users.csv, music.csv and playlist.csv from the Gatling resources directory.
gatling: used to simulate various users for load test
tools: scripts that are useful in make-files
Gatling: (https://gatling.io/open-source/start-testing/)
Fill in all the required values in tpl-vars-tpl.txt
and save it as tpl-vars.txt
.
Once you have filled in all the details, run
$ make -f k8s-tpl.mak templates
$ tools/shell.sh
This section assumes that all steps in the getting started section has been complete.
Create a cluster with 2 nodes:
$ make -f eks.mak start
You could view the cluster with:
$ kubectl config get-contexts
$ kubectl create ns c756ns
$ kubectl config set-context aws756 --namespace=c756ns
$ make -f k8s.mak provision
$ make -f k8s.mak loader
This inserts data that exists in gatling/resources/*.csv into their respective tables
Check that you have the necessary tables installed by running
$ aws dynamodb list-tables
The resulting output should include tables User
, Music
, and Playlist
.
To print the grafana URL, run:
$ make -f k8s.mak grafana-url
Click the URL and you could login Grafana with username: admin password: prom-operator
Select “Browse” from the left menu. This will bring up a list of dashboards. Click on c756 transactions and you could see the dashboard like below:
To print the Kiali URL, run:
$ make -f k8s.mak kiali-url
To print the Prometheus URL, run:
$ make -f k8s.mak prometheus-url
To generate test load on all three microservices, run:
$ ./gatling-all.sh <Number_of_service_objects> <delay_between_each_request>
For example:
$ ./gatling-all.sh 1000 300
will send 1000 requests to each of the services with a 300 ms delay.
The initial cluster nodes number is 2 (max 16). To adjust cluster nodes number, running:
$ eksctl scale nodegroup --name=worker-nodes --cluster aws756 --nodes <desired_nodes_number>
The initial service replicas is 1. To adjust replicas number, running:
$ kubectl scale deployment/cmpt756db --replicas=<desired_replicas_number>
$ kubectl scale deployment/cmpt756s1 --replicas=<desired_replicas_number>
$ kubectl scale deployment/cmpt756s2-v1 --replicas=<desired_replicas_number>
$ kubectl scale deployment/cmpt756s3 --replicas=<desired_replicas_number>
The initial Dynamodb capacity is 5 units, to adjust capacity, running:
$ aws dynamodb update-table --table-name <your_table_name> --provisioned-throughput ReadCapacityUnits=100,WriteC
apacityUnits=100
$ tools/kill-gatling.sh
$ make -f eks.mak stop