From: Christophe Jaillet Date: Mon, 17 Dec 2012 14:10:50 +0000 (+0000) Subject: ab: add the possibility to define a socket timeout (-s timeout) X-Git-Tag: 2.5.0-alpha~5978 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=844012a0061ca474ba2cbe237c2bb3232cc76aec;p=thirdparty%2Fapache%2Fhttpd.git ab: add the possibility to define a socket timeout (-s timeout) [Guido Serra ] Also some changes In usage(): - reword -t option to be more clear with the new -s - add missing -q - add the new -s option - reword some options to better match online documentation ab.xml claimed that -s was already there, but nothing in the code looks like that. So, I guess it only landed on the online doc... git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1422937 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/docs/manual/programs/ab.xml b/docs/manual/programs/ab.xml index 23afdc574a0..660fd4737aa 100644 --- a/docs/manual/programs/ab.xml +++ b/docs/manual/programs/ab.xml @@ -54,7 +54,7 @@ [ -P proxy-auth-username:password ] [ -q ] [ -r ] - [ -s ] + [ -s timeout ] [ -S ] [ -t timelimit ] [ -T content-type ] @@ -150,11 +150,9 @@
-r
Don't exit on socket receive errors.
-
-s
-
When compiled in (ab -h will show you) use the SSL - protected https rather than the http protocol. - This feature is experimental and very rudimentary. You probably - do not want to use it.
+
-s timeout
+
Maximum number of seconds to wait before the socket times out. + Default is 30 seconds.
-S
Do not display the median and standard deviation values, nor display @@ -170,7 +168,7 @@
-T content-type
Content-type header to use for POST/PUT data, eg. application/x-www-form-urlencoded. - Default: text/plain.
+ Default is text/plain.
-u PUT-file
File containing data to PUT. Remember to also set -T.
diff --git a/support/ab.c b/support/ab.c index 71aca8e313a..f20bae32c57 100644 --- a/support/ab.c +++ b/support/ab.c @@ -1872,13 +1872,16 @@ static void usage(const char *progname) */ fprintf(stderr, "Options are:\n"); fprintf(stderr, " -n requests Number of requests to perform\n"); - fprintf(stderr, " -c concurrency Number of multiple requests to make\n"); - fprintf(stderr, " -t timelimit Seconds to max. wait for responses\n"); + fprintf(stderr, " -c concurrency Number of multiple requests to make at a time\n"); + fprintf(stderr, " -t timelimit Seconds to max. to spend on benchmarking\n"); + fprintf(stderr, " This implies -n 50000\n"); + fprintf(stderr, " -s timeout Seconds to max. wait for each response\n"); + fprintf(stderr, " Default is 30 seconds\n"); fprintf(stderr, " -b windowsize Size of TCP send/receive buffer, in bytes\n"); fprintf(stderr, " -B address Address to bind to when making outgoing connections\n"); fprintf(stderr, " -p postfile File containing data to POST. Remember also to set -T\n"); fprintf(stderr, " -u putfile File containing data to PUT. Remember also to set -T\n"); - fprintf(stderr, " -T content-type Content-type header for POSTing, eg.\n"); + fprintf(stderr, " -T content-type Content-type header to use for POST/PUT data, eg.\n"); fprintf(stderr, " 'application/x-www-form-urlencoded'\n"); fprintf(stderr, " Default is 'text/plain'\n"); fprintf(stderr, " -v verbosity How much troubleshooting info to print\n"); @@ -1899,6 +1902,7 @@ static void usage(const char *progname) fprintf(stderr, " -k Use HTTP KeepAlive feature\n"); fprintf(stderr, " -d Do not show percentiles served table.\n"); fprintf(stderr, " -S Do not show confidence estimators and warnings.\n"); + fprintf(stderr, " -q Do not show progress when doing more than 150 requests\n"); fprintf(stderr, " -g filename Output collected data to gnuplot format file.\n"); fprintf(stderr, " -e filename Output CSV file with percentages served\n"); fprintf(stderr, " -r Don't exit on socket receive errors.\n"); @@ -2083,7 +2087,7 @@ int main(int argc, const char * const argv[]) myhost = NULL; /* 0.0.0.0 or :: */ apr_getopt_init(&opt, cntxt, argc, argv); - while ((status = apr_getopt(opt, "n:c:t:b:T:p:u:v:rkVhwix:y:z:C:H:P:A:g:X:de:SqB:" + while ((status = apr_getopt(opt, "n:c:t:s:b:T:p:u:v:rkVhwix:y:z:C:H:P:A:g:X:de:SqB:" #ifdef USE_SSL "Z:f:" #endif @@ -2124,6 +2128,9 @@ int main(int argc, const char * const argv[]) case 'S': confidence = 0; break; + case 's': + aprtimeout = apr_time_from_sec(atoi(opt_arg)); /* timeout value */ + break; case 'p': if (method != NO_METH) err("Cannot mix POST with other methods\n");