]> granicus.if.org Git - apache/commitdiff
ab: add the possibility to define a socket timeout (-s timeout)
authorChristophe Jaillet <jailletc36@apache.org>
Mon, 17 Dec 2012 14:10:50 +0000 (14:10 +0000)
committerChristophe Jaillet <jailletc36@apache.org>
Mon, 17 Dec 2012 14:10:50 +0000 (14:10 +0000)
[Guido Serra <zeph fsfe org>]

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

docs/manual/programs/ab.xml
support/ab.c

index 23afdc574a08fac02d9ee258ea7b25b66be03d2e..660fd4737aa8cac1b0203e2fb07d5538f61e9492 100644 (file)
@@ -54,7 +54,7 @@
     [ -<strong>P</strong> <var>proxy-auth-username</var>:<var>password</var> ]
     [ -<strong>q</strong> ]
     [ -<strong>r</strong> ]
-    [ -<strong>s</strong> ]
+    [ -<strong>s</strong> <var>timeout</var> ]
     [ -<strong>S</strong> ]
     [ -<strong>t</strong> <var>timelimit</var> ]
     [ -<strong>T</strong> <var>content-type</var> ]
     <dt><code>-r</code></dt>
     <dd>Don't exit on socket receive errors.</dd>
 
-   <dt><code>-s</code></dt>
-    <dd>When compiled in (<code>ab -h</code> will show you) use the SSL
-    protected <code>https</code> rather than the <code>http</code> protocol.
-    This feature is experimental and <em>very</em> rudimentary. You probably
-    do not want to use it.</dd>
+    <dt><code>-s <var>timeout</var></code></dt>
+    <dd>Maximum number of seconds to wait before the socket times out.
+    Default is 30 seconds.</dd>
 
     <dt><code>-S</code></dt>
     <dd>Do not display the median and standard deviation values, nor display
     <dt><code>-T <var>content-type</var></code></dt>
     <dd>Content-type header to use for POST/PUT data, eg.
     <code>application/x-www-form-urlencoded</code>.
-    Default: <code>text/plain</code>.</dd>
+    Default is <code>text/plain</code>.</dd>
 
     <dt><code>-u <var>PUT-file</var></code></dt>
     <dd>File containing data to PUT.  Remember to also set <code>-T</code>.</dd>
index 71aca8e313ab81f39fd61d6e321e0537805001ff..f20bae32c571013fd214cb39e8e8a2a07b9553f0 100644 (file)
@@ -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");