This project provides a general-purpose HTTP load-testing and benchmarking library implemented in Python. The tool allows you to specify an HTTP address, generate requests at a given fixed Queries Per Second (QPS), and reports latency statistics and error rates. It is also Dockerized for easy deployment and execution.
- Specify an HTTP address as input.
- Support for a
--qps
flag to generate requests at a given fixed QPS. - Reports latency statistics (average, minimum, and maximum latencies) and error rates.
- Extensible design to add more features.
- Unit tests to verify the functionality.
- Dockerized for easy deployment.
- Docker
- Python 3.9 (if running locally without Docker)
To build the Docker image, navigate to the project directory and run:
docker build -t load-tester .
Command-Line Arguments
• --url: The URL to be tested (required).
• --qps: Queries per second (required).
• --duration: Duration of the test in seconds (required).
• --method: HTTP method to use (default is GET).
• --headers: Optional headers as a JSON string.
• --body: Optional request body.
docker run --rm load-tester --url http://example.com --qps 10 --duration 60 --method GET
If you want to develop and test the tool locally without Docker, you need to have Python 3.9 installed.
-
Install the required dependencies:
pip install -r requirements.txt
-
Run the tool locally:
python load_tester.py --url http://example.com --qps 10 --duration 60 --method GET
-
Run the tests locally:
python -m unittest discover -s .