Exposes a simple class based component to create a series of request based on a seed file
At the core we're using Python 3, and the libraries required for the script to work are:
- aiohttp - asynchronous http calls
- asyncio - event loop and async / await function support
If you have pip installed, you could install all dependencies by:
# install the dependencies
python3 -m pip install --user aiohttp
python3 -m pip install --user asyncio
python3 -m pip install --user matplotlib
If you just want to use it as a CLI, you have the following parameters available:
inputfile
- Indicates the file with all the URLs to hitlfrom
- The start line number from the file (default to 0)lto
- The the line number from the file (default to 9)wait
- The time to wait in between the batchessize
- The requests to be sent per batch
Make sure you have a seed file that contains all the HTTP (get) requests to be made to stress the server
Then use the class HTTPLoadGenerator
to configure the test, for example:
# configure the test
# set the requests per second (rps) to 10
# set the time to wait in between batches to 10 seconds
test = HTTPLoadGenerator(seed_file='/full/path/to/your/file',
spare_time=10,
rps=10
)
# start the test
test.start()
If you want to save the requests into a file, you can just:
test.save_results_to_file(filename='test-1.output')
This will save the file with a CSV style with the following information:
- request start - the time on which the request started (from the event loop)
- request id - the id of the request (in this case, followed sequentially)
- elapsed time - time that took for the request to finish
- response status - the HTTP response status retrieved for the given request