This repository aims to create a cloud-native application that implements 2 different distributed tracing tools: Elastic APM and Zipkin, and to compare their performance and features.
Here is the basic architecture of the setup:
- src/index.ts: This is the entry point of the application. It starts the corresponding service specified via the
SERVICE_TYPE
environment variable. - k8s: This folder contains the configuration files for the deployments, services, configuration, and ingress of the application.
- elastic: This folder contains the deployment and services for APM Server, Elasticsearch, and Kibana.
- zipkin.yaml: This file contains the deployment and service configuration for the Zipkin server.
- build.bat: This script builds the application as a Docker image and pushes it to the Docker Hub registry.
- build the application as docker image. Update the deployment files accordingly in ./k8s/service-x.yaml
- then apply the deployments and services:
kubectl apply -f ./k8s/service-a.yaml
kubectl apply -f ./k8s/service-b.yaml
kubectl apply -f ./k8s/service-c.yaml
-
set the config variables:
kubectl apply -f ./k8s/config.yaml
-
configure the ingress to combine services in a load balancer:
kubectl apply -f ./k8s/ingress.yaml
- configure the Elastic APM and related services:
kubectl apply -f ./elastic/elastic.yaml
kubectl apply -f ./elastic/apm-server.yaml
kubectl apply -f ./elastic/kibana.yaml
- configure the Zipkin server
kubectl apply -f ./zipkin/zipkin.yaml
After doing these, the application services, and elastic services will be up and running. Check them by their ports accordingly. The Elastic APM will be accessible via Kibana dashboard.
curl ${APP_HOST}/service-a/
curl ${APP_HOST}/service-a/routeWithLongOperation
curl ${APP_HOST}/service-a/routeWithError
Page | Image |
---|---|
Services Overview | |
Traces Overview | |
Timeline View |
Page | Image |
---|---|
Dependencies Overview | |
Traces Overview | |
Timeline View |
The Autocannon tool was used to run load testing for 30 seconds with 10 connections. Here are some insights:
Metric | Without tools | With Zipkin | With Elastic APM |
---|---|---|---|
Average latency | 204.38 ms | 242.56 ms | 277.77 ms |
Requests per sec | 84.7 | 54.6 | 43.3 |
Bytes/sec | 19.3 kb/sec | 12.4 kb/sec | 9.87 kb/sec |