Search code examples
apachebench

Load testing server with http multipart/related request which contains audio content


We built a server which handles speech recorded by user using an app. The audio data is sent through http post in real time. The body looks like this:

--BOUNDARY
Content-Disposition: form-data; name="metadata"
Content-Type: application/json; charset="UTF-8"
<JSON FORMATTED METADATA HERE>
--BOUNDARY
Content-Disposition: form-data; name="audio"
Content-Type: application/octet-stream
<AUDIO BYTES HERE>
--BOUNDARY--

Now, I need to do load testing for the server. I am thinking of using ApacheBench and just do consistent uploading requests but I wish to use the same format as above for each request. How could that be setup in AB?


Solution

  • I was able to solve the problem by using the following command:

    ab -p test -T "multipart/form-data; boundary=BOUNDARY" -c 1000 -n 1000 -l http://someipaddress.com/
    

    where test is a file containing the post content.