Akshay Gupta
Akshay Gupta

Reputation: 11

Wanted to post a video file using apache benchmark

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

Answers (1)

Dmitri T
Dmitri T

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:

enter image description here

It also provides options to define the workload model and powerful reporting

More information: JMeter Performance Testing: Upload and Download Scenarios

Upvotes: 0

Related Questions