ab命令(Apache HTTP server benchmarking )的Connection Times (ms)分析(Connect,Processing,Waiting,Total分析)

ab命令的Connection Times (ms)分析(Connect,Processing,Waiting,Total分析)

Connect: Time it takes to connect to remote host 成功建立tcp三次握手

Processing: Total time minus time it takes to connect to remote host 总时间减去connect时间,也就是从简历链接后-一直到关闭链接为止。

Waiting: Response first byte receive minus last byte sent 客户端发送完请求信息的最后一个字节—接收响应信息的的第一个字节

Total: From before connect till after the connection is closed 请求从建立到close整个时间段。

分析我们看到:
分析1:Total = connect + processing;

分析2:processing-waiting = 请求端发送请求数据第一个字节到发送完最后一个字节+客户端接收数据的第一个字节到客户端接收完毕响应信息最后一个字节。
参考资料:

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


shareimprove this answer

============================
很高兴加微信讨论相关技术问题:1415035017

你可能感兴趣的:(lamp服务器维护优化,网络通信)