1
0
Fork 0
loadr/README.md

68 lines
1.8 KiB
Markdown

# Loadr
A lightweight REST load testing tool with robust support for different request patterns, token auth, and performance reports.
## Installation
```bash
go build
```
## Quick Start
```bash
# Simple pattern: 5 POST requests
./loadr -rate=20 -max=100 -url=http://api.example.com -pattern=5p
# Mixed pattern: 1 POST followed by 5 GETs, repeating
./loadr -rate=20 -max=100 -url=http://api.example.com -pattern=1p5g
# With authentication and request body
./loadr -rate=20 -max=100 -url=http://api.example.com -pattern=2p3g -json=./data.json -token=YourBearerToken
```
## Request Patterns
The `-pattern` flag supports flexible request patterns:
### Simple Patterns
- `5p` : 5 POST requests
- `3g` : 3 GET requests
### Sequential Patterns
- `1p5g` : 1 POST followed by 5 GETs
- `2p3g` : 2 POSTs followed by 3 GETs
- `3g2p` : 3 GETs followed by 2 POSTs
### Probabalistic Patterns
- `20%p80%g` : 20% POST and by 80% GETs
### Pattern Rules
- Numbers specify how many requests of each type
- 'p' or 'P' specifies POST requests
- 'g' or 'G' specifies GET requests
- '%' indicates probabilistic requests
- If no number is specified, 1 is assumed (e.g., "pg" = "1p1g")
- Pattern repeats until max requests is reached
## Command Line Flags
- `-rate`: Number of requests per second (default: 10)
- `-max`: Maximum number of requests to send (default: 50)
- `-url`: Target URL (default: "https://example.com")
- `-pattern`: Request pattern (e.g., "5p", "1p5g", "3g2p", "10%p90%g")
- `-json`: Path to JSON file for request body
- `-token`: Bearer token for authorization
- `-v`, `-version`: Print version information
## Reports
Test results are automatically:
1. Displayed in the console
2. Saved to `.reports/[timestamp].txt`
Reports include:
- Total requests sent and received
- Average, maximum, and minimum latency
- Requests per second (sent and received)
- Pattern information