Getting payload ready with Dispatcher
The dispatcher tool collects user requests and saves them to payload files which are then used in load testing.
It operates as a proxy, redirecting HTTP requests to the target server and returning the server's responses back to the client. If a proxied request completes successfully with a 2xx HTTP status code, it is written to payload files which are then used for load testing. dispatcher allows configuring the rules and size of payload data using special flags.
Getting started
-
Install Go 1.22 or higher
:wget https://go.dev/dl/go1.22.2.linux-amd64.tar.gz tar -C /usr/local -xzf go1.22.2.linux-amd64.tar.gz export PATH=$PATH:/usr/local/go/bin -
Install Git
using the following command:sudo apt install git
Collecting requests
-
Clone the GitHub repository
and go to theyc-load-testing-dispatcherdirectory:git clone https://github.com/yandex-cloud-examples/yc-load-testing-dispatcher.git cd yc-load-testing-dispatcher -
Run
dispatcherwith the relevant flags:go run dispatcher.go -target '<target_address>' -port <port> -ssl -noproxy -saveall -nostaticWhere:
target: Address of the service targeted for request proxying and logging.port: Port used to run the server. The default port is8888.ssl: Enables proxying requests via a secure HTTPS connection.noproxy: Determines whether to save requests without proxying them.saveall: Enables saving all requests regardless of the HTTP status code of the response to the proxied request.nostatic: Enables filtering out requests for static content, such as CSS, JS, JPEG, JPG, PNG, GIF, ICO, SVG, WOFF, and WOFF2, from being saved.
Example of running:
go run dispatcher.go -target 'yandex.ru' -port 8080 -nostaticResult:
Dispatcher listens to your requestsAfter the tool starts, send all requests for load testing to
localhost:8080. You can also open thelocalhost:8080page in your browser to load the website specified in thetargetflag.The system writes all requests in series immediately after receiving the response. Therefore, the order of requests running in parallel may differ from the one in the final file.
Result:
The payload is written to a raw.payload file The payload is written to a httpjson.payload file The payload is written to a uri.payload file The payload is written to a uripost.payload fileAfter completing all the requests you need, press Ctrl + C to close
dispatcher.Warning
You should avoid closing it before you get all the responses, as the payload may not be written yet.
The system saves requests to the following files: