My bachelor thesis in Hasanuddin University as an Informatics Engineer Student.
The main purpose of this thesis is to Compare the performance of microservice use gRPC and REST APIs for academic management system. So this project has 3 services:
- KRS Service use golang.
- Auth Service uses nodejs and also golang.
- Payment Service use golang.
To store data in the database, I use Redis. Then use k6 to test the performance of each service and use Datadog to monitor the performance. Additionaly i also try use Jmeter to load test. All the services are deployed in different EC2 AWS as well as the test agent then use private IP to communicate.
- Golang 1.17.1
- Nodejs 4.17.6
- Redis 5.0.7
- EC2 AWS
- K6
- Datadog 0.36.0
- Jmeter 5.4.1
- Linux ubuntu 20.4
$ IP_AUTH=localhost IP_PAYMENT=localhost IP_REDIS=localhost KRS-service/main
$ cd auth-service-nodejs && npm install && IP_REDIS=localhost npm start
$ IP_REDIS=localhost auth-service-go/main
$ IP_REDIS=localhost payment-service/main
run the cpu watch tool to watch the cpu usage.
$ cpu-watch-tool/main -p <pid server> -o <output file>
$ IP_KRS=localhost IP_AUTH=localhost IP_PAYMENT=localhost proxy/main
DOCKER_CONTENT_TRUST=1 \
sudo docker run -d \
--name datadog \
-v /var/run/docker.sock:/var/run/docker.sock:ro \
-v /proc/:/host/proc/:ro \
-v /sys/fs/cgroup/:/host/sys/fs/cgroup:ro \
-e DD_SITE="datadoghq.com" \
-e DD_API_KEY=<YOUR_DATADOG_API_KEY> \
-e DD_DOGSTATSD_NON_LOCAL_TRAFFIC=1 \
-p 8125:8125/udp \
datadog/agent:latest
Don't forget to replace <YOUR_DATADOG_API_KEY> with your datadog api key
All test files for K6 are in k6 directory. For example, if you want to test grpc-krs-create in 100 vurtual user in 30 second use the command below.
K6_STATSD_ENABLE_TAGS=true k6 run --vus 100 --durations 30s --out statsd --tag test_run_id=1 -e IP=172.31.30.48 k6/grpc/krs/create.js
Proxy service use to transform from rest to grpc and carry on rest to rest. So we can use jmeter to test the performance both for grpc and rest.
$ IP_KRS=127.0.0.1 IP_AUTH=127.0.0.1 IP_PAYMENT=127.0.0.1 test/main
or use the command below to automate laod test.
$ test-tools/main -j=/home/din/Downloads/apache-jmeter-5.4.1/bin/jmeter -m="test" ./jmx/1000 ./result/1000
All jmx test file for Jmeter are in jmx directory. For example, if you want to test grpc-krs-create in 100 thread second use the command below.
jmeter.sh -n -t jmx/100/grpc-krs-create.jmx -l testresults.jtl
Still developing...
Response Time
Throughput
CPU Utilization
Grpc
Rest
Datadog