Advanced
Load Testing
Load Testing
Requirements
- Everything is running in distributed mode.
- wrk is installed in your system.
- Create a file named
put.lua
with sample data, for example -
put.lua
1wrk.method = "PUT"2wrk.headers["Content-Type"] = "application/json"3wrk.body = '{ "tag": "github", "target": "https://github.com" }'
Running Test
- Load test link creation
$wrk -t8 -d10s -c100 -s "./put.lua" http://localhost:5002
- Load test link data API. Get one of shortIDs created in previous step
$wrk -t8 -d10s -c100 http://localhost:5002/<shortID>
- load test link redirection
$wrk -t8 -d10s -c100 http://localhost:5000/<shortID>
Results
Following is a sample result on a quad core machine with wrk running on the same machine. The run duration for each test was 1 minute. This is not meant as professional benchmark as that will require a different and controlled setup.
Task | Cache Hit | Performance (Avg) | Total Ops | Latency (Avg) |
---|---|---|---|---|
Create Links | 121K reqs/sec | 7.26M | 47.39ms | |
Get Link | Redis | 60K reqs/sec | 3.60M | 1.68ms |
Get Link | None | 25K reqs/sec | 1.5M | 4.30ms |
Redirect | Memory | 398K reqs/sec | 23M | 0.94ms |
Redirect | Redis | 39K reqs/sec | 2.3M | 23.33ms |
Redirect | None | 21K reqs/sec | 1.3M | 90.22ms |