how to specify query string in url with apache bench

kshama picture kshama · May 9, 2010 · Viewed 9.5k times · Source

My rails application is running on thin server which i want to benchmark using apachebench

the command am using is

ab -n 1 -c 1 http://localhost:3001/welcome/search?query="doctor"&rad=5

But thin server is not taking this url.Its giving

!! Invalid Request

Can any one help me how to give the url such that thin accepts the url with query string

Answer

Steven Soroka picture Steven Soroka · May 2, 2011

apache benchmark wont resolve "localhost" out of the url. change it to 0.0.0.0 or 127.0.0.1 and quote the whole url to avoid problems with the ampersand. eg:

ab -n 1 -c 1 "http://0.0.0.0:3001/welcome/search?query=doctor&rad=5"