Bharat's Digital Garden

Load testing

A load test allows you to understand how the server performs under peak load, using load testing tools you can check how the server performs in terms of CPU, latency, throughput and many more metrics.

For my digital ocean 5$ single vCPU 2.1 Ghz instance running a golang gin server. Testing with a simple GET request which just reads and returns data from the database, these are the metrics vegeta came up with

Documents ❯ echo "GET https://ayured-api.bharatkalluri.in/api/v1/book" | vegeta attack -max-workers=40 -rate=0 -duration=30s | tee results.bin | vegeta report                              ⏎
Requests      [total, rate, throughput]         2966, 98.22, 98.11
Duration      [total, attack, wait]             30.233s, 30.198s, 34.181ms
Latencies     [min, mean, 50, 90, 95, 99, max]  33.338ms, 407.429ms, 73.615ms, 928.117ms, 938.114ms, 960.45ms, 2.408s
Bytes In      [total, mean]                     329226, 111.00
Bytes Out     [total, mean]                     0, 0.00
Success       [ratio]                           100.00%
Status Codes  [code:count]                      200:2966  
Error Set:

The max utilization I saw on my server was 40%. at 100 requests per second!

Refs