Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Apache Benchmark (ab) to login to a site

I am running a php based web application in Ubuntu platform. I want to perform load testing to 1000 concurrent users for the login process. (when correct username and password are provided, it will be directed to the home page).

I am using Apache Benchmark (ab) to do the load testing. I used this command to load the login page alone.

    ab -n 1000 -c 1000 http://localhost/etsp/

How can I extend this command to test the login process? What I meant was, is there any way to provide username and password to this?

Any hint will be highly appreciated.

like image 220
Yash Avatar asked Aug 16 '14 12:08

Yash


People also ask

How does Apache Benchmark work?

ApacheBench ( ab ) is a benchmarking tool that measures the performance of a web server by inundating it with HTTP requests and recording metrics for latency and success.

What is ApacheBench command line utility?

ApacheBench ( ab is the real program file name) is a single-threaded command line computer program used for benchmarking (measuring the performance of) HTTP web servers.

What is ab load testing?

Apache Bench (ab) is a load testing and benchmarking tool for Hypertext Transfer Protocol (HTTP) server. It can be run from command line and it is very simple to use. A quick load testing output can be obtained in just one minute.


1 Answers

Look at the man page for Apache Benchmark for the option that makes the most sense given your application:

  • HTTP Basic Authentication
    You want the -A option to supply basic authentication credentials.

  • Cookie-Based Authentication
    You want the -C option to supply the cookie name and value.

  • Form-based Authentication Trigger
    You want the -T and -p options to specify a POST file and content type for that file. If it's a standard HTML form, the content type is probably going to be application/x-www-form-urlencoded. The file is going to contain the login form field name/value pairs encoded for the form submission. The Stack Overflow answer application/x-www-form-urlencoded or multipart/form-data? has information about how to do this.

like image 126
hrunting Avatar answered Oct 17 '22 00:10

hrunting