Definition of Connect, Processing, Waiting in apache bench

By looking at the source code we find these timing points:

apr_time_t start,           /* Start of connection */
           connect,         /* Connected, start writing */
           endwrite,        /* Request written */
           beginread,       /* First byte of input */
           done;            /* Connection closed */

And when request is done some timings are stored as:

        s->starttime = c->start;
        s->ctime     = ap_max(0, c->connect - c->start);
        s->time      = ap_max(0, c->done - c->start);
        s->waittime  = ap_max(0, c->beginread - c->endwrite);

And the ‘Processing time’ is later calculated as

s->time - s->ctime;

So if we translate this to a timeline:

t1: Start of connection
t2: Connected, start writing
t3: Request written
t4: First byte of input
t5: Connection closed

Then the definitions would be:

Connect:      t1-t2   Most typically the network latency
Processing:   t2-t5   Time to receive full response after connection was opened
Waiting:      t3-t4   Time-to-first-byte after the request was sent
Total time:   t1-t5

Leave a Comment