Reputation: 11
I want to use apachebench (ab) to test file upload performance. I have read the manual and can't find a way to achieve my goal.
My goal is try to upload a file by a HTTPs Request with POST method and multipart/form-data format.
abs -n 10 -p test.txt -T "multipart/for-data;boundary=1234567890"https://myapplication.local/upload_file I have tried this but getting error
Upvotes: 1
Views: 222
Reputation: 168002
Take a look at Benchmarking file uploads and Apache benchmark multipart/form-data
Just in case I'll copy the script here:
You'll need a text file post_data.txt with the following contents:
--1234567890 Content-Disposition: form-data; name="file"; filename="ab1_pod.jpg" Content-Type: application/jpeg Content-Transfer-Encoding: base64 [base64 encoding of the file] --1234567890--
and the call:
ab -n 10 -p post_data.txt -T "multipart/form-data; boundary=1234567890" https://myapplication.local/upload_file
Have you considered using Apache JMeter? It's way more powerful and gives you the possibility to perform the multipart file upload by just specifying the file location and ticking one box:
It also provides options to define the workload model and powerful reporting
More information: JMeter Performance Testing: Upload and Download Scenarios
Upvotes: 0