Implementation of Online Final Task Backend | DEV Challenge XIX
- Golang - high performance language for make API-layer
- Gin Web Framework - help build API fast: router, request validation, building response.
- Built in Golang image standard library
- Postman - Useful tool which provide UI for create API tests and next run it within docker runner
docker compose up -d
curl -i -X POST http://127.0.0.1:8080/api/image-input
docker compose run postman
Example results:
┌─────────────────────────┬───────────────────┬──────────────────┐
│ │ executed │ failed │
├─────────────────────────┼───────────────────┼──────────────────┤
│ iterations │ 2 │ 0 │
├─────────────────────────┼───────────────────┼──────────────────┤
│ requests │ 26 │ 0 │
├─────────────────────────┼───────────────────┼──────────────────┤
│ test-scripts │ 26 │ 0 │
├─────────────────────────┼───────────────────┼──────────────────┤
│ prerequest-scripts │ 0 │ 0 │
├─────────────────────────┼───────────────────┼──────────────────┤
│ assertions │ 96 │ 0 │
├─────────────────────────┴───────────────────┴──────────────────┤
│ total run duration: 1070ms │
├────────────────────────────────────────────────────────────────┤
│ total data received: 17.46kB (approx) │
├────────────────────────────────────────────────────────────────┤
│ average response time: 10ms [min: 3ms, max: 104ms, s.d.: 18ms] │
└────────────────────────────────────────────────────────────────┘
docker compose run siege
Note:
- you can see siege log at
siege/log/siege.log
- load testing inside docker on same machine is not so representative. Better to use two hosts: API-server and siege-client.
- for having complex load testing (closest to real data) we need to prepare image set with high resolutions
Siege result on my machine:
- Docker resources: 1.4 GHz Quad-Core Intel Core i5, 4 (v)CPUs, RAM 8 GB, 2 GB Swap.
Transactions: 94892 hits
Availability: 100.00 %
Elapsed time: 59.97 secs
Data transferred: 10.05 MB
Response time: 0.01 secs
Transaction rate: 1582.32 trans/sec
Throughput: 0.17 MB/sec
Concurrency: 9.08
Successful transactions: 94893
Failed transactions: 0
Longest transaction: 0.56
Shortest transaction: 0.00
Import collection tests/MineDetectors.postman_collection.json
into Postman app.