- Go v1.18.
- Docker v20.10.14.
- Docker-compose v2.5.1.
- Distributed tracing
- Logging
- Swagger API
- Docker build
- Send mail via Gmail SMTP server
- Sign in with google
user: anonymous
pass: anonymous
go mod download
# build rest_api package
docker build -t api:multistage -f Dockerfile.multistage.api .
# tag api
docker image tag api:multistage api
# build indexer package
docker build -t indexer:multistage -f Dockerfile.multistage.indexer .
# tag indexer
docker image tag indexer:multistage indexer
# run api with Redis, RabbitMQ, ElasticSearch, Postgres database
docker-compose up
# run api with Redis, RabbitMQ, ElasticSearch, Postgres database
docker-compose up redis rabbitmq elasticsearch postgres
The app will help indexing data into elastic search.
Require: RabbitMQ, ElasticSearch
go run ./packages/indexer/main.go
The app will help get users ramdom from randomuser.me, then insert to Postgres database.
Require: RabbitMQ, Postgres
go run ./packages/random_user/main.go
Require: RabbitMQ, Postgres, ElasticSearch
go run ./packages/rest_api/main.go
Load test: Wrk
wrk -t6 -c100 -d15s https://api.tdo.works/api/v1/users-cache
Running 15s test @ https://api.tdo.works/api/v1/users-cache
6 threads and 100 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 227.11ms 17.19ms 318.56ms 76.39%
Req/Sec 70.48 21.42 141.00 73.44%
6044 requests in 15.10s, 13.25MB read
Requests/sec: 400.35
Transfer/sec: 0.88MB
wrk -t6 -c100 -d15s https://api.tdo.works/api/v1/users
Running 15s test @ https://api.tdo.works/api/v1/users
6 threads and 100 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 581.02ms 217.44ms 1.56s 68.91%
Req/Sec 27.78 15.62 89.00 65.57%
2304 requests in 15.03s, 5.05MB read
Requests/sec: 153.25
Transfer/sec: 343.92KB