Repository navigation
Basic Examples
Here are the most common things you'll want to do with pywrkr. Just copy and paste these commands.
More connections = more load on your server. The default is 10.
# Light load: 5 connections
pywrkr http://localhost:8080/ -c 5
# Medium load: 100 connections
pywrkr http://localhost:8080/ -c 100
# Heavy load: 500 connections
pywrkr http://localhost:8080/ -c 500How to choose? Start small (10-50) and increase until you see errors or high latency. That's your server's limit.
The default is 10 seconds. For more accurate results, run longer.
# Quick check: 5 seconds
pywrkr http://localhost:8080/ -d 5
# Standard test: 30 seconds
pywrkr http://localhost:8080/ -d 30
# Thorough test: 5 minutes (300 seconds)
pywrkr http://localhost:8080/ -d 300Instead of running for a set time, send exactly N requests and stop. This is useful when you want to compare "same workload, different configs."
# Send exactly 1,000 requests using 50 connections
pywrkr http://localhost:8080/ -n 1000 -c 50
# Send 10,000 requests using 100 connections
pywrkr http://localhost:8080/ -n 10000 -c 100By default, pywrkr sends GET requests. Here's how to send POST with a body:
# Simple POST with JSON body
pywrkr http://localhost:8080/api/data -m POST \
-b '{"name": "test", "value": 42}' \
-H "Content-Type: application/json"If your body is large, put it in a file:
# Save your request body to a file
echo '{"name": "test", "value": 42}' > body.json
# Use the file
pywrkr http://localhost:8080/api/data -m POST \
-p body.json \
-H "Content-Type: application/json"# Basic HTTP auth (username:password)
pywrkr http://localhost:8080/api/protected -A admin:secret123# Add an API key header
pywrkr http://localhost:8080/api -H "Authorization: Bearer my-token-here"
# Add multiple headers
pywrkr http://localhost:8080/api \
-H "Authorization: Bearer my-token" \
-H "X-Custom-Header: some-value"# Send a session cookie
pywrkr http://localhost:8080/ -C "session=abc123"
# Multiple cookies
pywrkr http://localhost:8080/ -C "session=abc123" -C "lang=en"If your server has a cache (like a CDN), each request might return a cached response instead of hitting your actual server. Use -R to add a unique parameter to every request, so nothing gets cached.
# Without -R: all requests hit the same cached URL
# With -R: each request gets a unique URL like /api?_cb=abc123
pywrkr http://localhost:8080/api -R -c 100 -d 30Want to know where the time is spent? DNS lookup? Connecting? Waiting for the server?
pywrkr https://example.com/ --latency-breakdown -d 10This shows time spent on each phase:
- DNS Lookup — finding the server's IP address
- TCP Connect — opening the connection
- TLS Handshake — setting up encryption (HTTPS only)
- TTFB — waiting for the server to respond
- Transfer — downloading the response body
You can mix and match everything:
# 200 connections, 60 seconds, POST with auth, save JSON results
pywrkr http://localhost:8080/api/data \
-c 200 -d 60 \
-m POST -b '{"key": "val"}' \
-H "Content-Type: application/json" \
-A admin:secret \
--latency-breakdown \
--json results.json- Simulating Real Users — make tests look like real browsing
- Rate Limiting — control exactly how many requests per second
- Finding Server Limits — automatically find your server's capacity