This is a simple load testing tool built with Go. It allows you to test the performance of your HTTP services by sending multiple requests concurrently. The docker image can be downloaded from Docker Hub.
docker pull mayckol/restclientThe next code snippets shows how to run the load client using a local image, if you want to use the image from Docker Hub, replace restclient with mayckol/restclient.
This is a simple load testing tool built with Go. It allows you to test the performance of your HTTP services by sending multiple requests concurrently.
- GET Requests: By default, the tool sends
GETrequests to the specified URL. - POST Requests: You can now send
POSTrequests with a JSON body. - Concurrency: Control the number of simultaneous requests.
- Random ID Generation: Automatically generate or replace an
idfield in your JSON body forPOSTrequests.
Before running the rest client, you need to build the Docker image:
docker build -t restclient .Using a .env File To run a load test using a .env file for configuration:
docker run --rm \
-v /path/to/your/jsonfiles/rest-client:/app/jsonfiles \
-v /path/to/your/env/rest-client/.env:/app/.env \
restclient \
--envpath=/app/.envGET Requests
To run a simple load test with GET requests:
From DockerHub Image
docker run --rm mayckol/restclient:latest \
--url=http://example.com/ \
--requests=10 \
--concurrency=10
(Using flags)
docker run --rm restclient \
--url=http://example.com/ \
--requests=10 \
--concurrency=10POST Requests
To run a load test with POST requests, specify the path to the JSON file that will be used as the body:
docker run --rm \
-v /path/to/your/jsonfiles:/app/jsonfiles \
restclient \
--url=http://example.com/ \
--requests=10 \
--concurrency=10 \
--verb=POST \
--jsonpath=/app/jsonfiles/body.jsonYou can also add or replace an id field in the JSON body:
docker run --rm \
-v /path/to/your/jsonfiles:/app/jsonfiles \
restclient \
--url=http://example.com/ \
--requests=10 \
--concurrency=10 \
--verb=POST \
--jsonpath=/app/jsonfiles/body.json \
--rand-id-type=number \
--rand-id-chrs=10If you are testing a service running on your localhost, the Docker container's localhost is not the same as your host machine's localhost. To connect to a service running on your host machine, you should use host.docker.internal as the URL.
Example for localhost:
docker run --rm \
-v /path/to/your/jsonfiles:/app/jsonfiles \
restclient \
--url=http://host.docker.internal:8081 \
--requests=10 \
--concurrency=10 \
--verb=POST \
--jsonpath=/app/jsonfiles/body.json \
--rand-id-type=number \
--rand-id-chrs=10--envpathPath to the .env file.--urlThe URL of the service to be tested.--requestsTotal number of requests to send (default: 100).--concurrencyNumber of simultaneous requests (default: 10).--verbHTTP method to use (GET or POST, default: GET).--jsonpathPath to the JSON file to use as the body for POST requests.--rand-id-typeType of random id to generate (number or string).--rand-id-chrsNumber of characters or digits for the random id.
docker run --rm restclient \
--url=http://example.com/ \
--requests=100 \
--concurrency=20docker run --rm \
-v /path/to/your/jsonfiles:/app/jsonfiles \
restclient \
--url=http://example.com/api/resource \
--requests=50 \
--concurrency=5 \
--verb=POST \
--jsonpath=/app/jsonfiles/body.jsondocker run --rm \
-v /path/to/your/jsonfiles:/app/jsonfiles \
restclient \
--url=http://example.com/api/resource \
--requests=20 \
--concurrency=10 \
--verb=POST \
--jsonpath=/app/jsonfiles/body.json \
--rand-id-type=string \
--rand-id-chrs=8This tool is a simple and effective way to test the performance of your HTTP services. It supports both GET and POST requests, with the ability to customize the request body and add randomness for better simulation of real-world scenarios.
- Command Line Options: The section now includes a code block that lists each option with its description, making it easier to read and reference.
- Consistency: Maintained consistent formatting throughout the README for clarity.
- Examples: Provided multiple usage examples to demonstrate different scenarios.
This project is licensed under the MIT License - see the LICENSE file for details.
