Web Stress Testing

Source: Internet
Author: User
Tags ack

  • Webbench
  • Ab
  • Siege
  • To view the number of connections
  • TCP Connection Resolution
  • cd /usr/local/src/wget http://www.ha97.com/code/webbench-1.5.tar.gztar zxvf webbench-1.5.tar.gzcd webbench-1.5make

    webbench -c 并发数 -t 运行测试时间 URL

    ./webbench -c 10000  -t 60  http://42.62.55.58:8003/Speed=44365 pages/min, 96247 bytes/sec.Requests: 44365 susceed, 0 failed.每分钟响应请求数:44365              每秒钟传输数据量  93kb 每秒请求: 44365 成功  0 个失败实际为每秒钟 请求739个。
    wget  http://download.joedog.org/siege/siege-4.0.4.tar.gztar -zxvf siege-4.0.4.tar.gzcd siege-4.0.4/./configure  --prefix=/usr/local/siegemakemake install##修改最大连接数量vim /usr/local/siege/etc/siegerclimit = 10000
    cd /usr/local/siege/bin/./siege  http://42.62.55.58:8003/asset/api/asset.html  --header="Authorization: Basic YWRtaW46MXFhei4yd3N4"   -r 10 -c 400Transactions:                   4152 hits   #已完成的事务总数Availability:                  92.41 %       #完成的成功率Elapsed time:                  58.99 secs    #总共使用的时间Data transferred:               5.11 MB   Response time:                  2.14 secsTransaction rate:              70.38 trans/secThroughput:                     0.09 MB/secConcurrency:                  150.91        #实际最高并发链接数Successful transactions:        4152Failed transactions:             341Longest transaction:           36.69Shortest transaction:           0.20
      yum-y Install httpd-tools  
    Ab-c 10000-n 50000 http://42.62.55.56/index.html Document Path:/index.htmldocument length:612 Byte Sconcurrency level:10000 # #并发数量Time taken for tests:7.113 Secondscomplete Requests:50000fail       Ed requests:0write errors:0total transferred:44242210 bytes #整个过程中的网络传输量HTML transferred: 32310540 bytes # htmlrequests per second:7029.83 [#/sec] (mean) #最重要的指标之一, equivalent to the number of transactions per second in LR, followed by mean in parentheses indicates that this is an average Time per request:1422.509 [MS] (mean) #最重要的指标之二, equivalent to the average transaction response times in LR, followed by a mean in parentheses indicating that this is an average of one hour per request:0  .142 [MS] (mean, across all concurrent requests) #每个连接请求实际运行时间的平均值Transfer rate:6074.52 [Kbytes/sec] Received  #平均每秒网络上的流量 to help troubleshoot problems with extended response time due to excessive network traffic connection times (ms) min MEAN[+/-SD] Median maxconnect:3        695 633.1 413 3502processing:247-305.7 439 5780waiting:2 394 309.9 334 5608Total: 269 1207 702.4 908   6101Percentage of the requests served within a certain time (ms) 50% 908 66% 1081 75% 1752 80% 1847 90% 1904 95% 2057 98% 3762 99% 3941100% 6101 (longest request)

    Web server side view number of connections

    netstat -n|grep  ^tcp|awk ‘{print $NF}‘|sort -nr|uniq -c   9022 TIME_WAIT           #  主动断开的一方,发送完最后一次ACK之后进入的状态   1099 SYN_RECV            # 服务端被动打开后,接收到了客户端的SYN并且发送了ACK时的状态     12 LAST_ACK            # 通信双方发送了最后一个FIN的时候,发送方此时处于LAST_ACK状态,    322 FIN_WAIT2           # 服务端在主动发起断开的连接请求时,发送FIN并收到客户端的ACK进入的等待客户端FIN的状态   2038 FIN_WAIT1           # 服务端发送完成FIN后还未接收到客户端返回的ACK时进入的状态   4384 ESTABLISHED         # 已建立连接的   6633 CLOSING             # 关闭的      1 CLOSE_WAIT          # 关闭等待ESTABLISHED->CLOSE_WAIT->(发送ACK)->LAST_ACK->(发送FIN+接收ACK)->CLOSED
    Three-time handshake:

    First handshake
    The client sends a segment of the connection request message to the server. The message segment is syn=1,ack=0,seq=x in the head. After the request is sent, the client enters the syn-sent state.

    * PS1:SYN=1,ACK=0表示该报文段为连接请求报文。* PS2:x为本次TCP通信的字节流的初始序号。

    TCP regulation: Syn=1 message segment can not have data parts, but to consume a sequence number.

    Second handshake
    After the server receives the connection request message segment, if the connection is agreed, a reply is sent: Syn=1,ack=1,seq=y,ack=x+1.
    When the answer is sent, it enters the SYN-RCVD state.

    * PS1:SYN=1,ACK=1表示该报文段为连接同意的应答报文。* PS2:seq=y表示服务端作为发送者时,发送字节流的初始序号。* PS3:ack=x+1表示服务端希望下一个数据报发送序号从x+1开始的字节。

    Third handshake
    When the client receives a connection consent answer, it also sends a confirmation segment to the server, indicating that the connection consent response from the server has been successfully received.
    该报文段的头部为:ACK=1,seq=x+1,ack=y+1。

    After the client sends this message segment, it enters the established state, and the server receives the response and enters the established state, when the connection is completed!

    TCP four times Wave

    The TCP connection is bidirectional, so in four waves, the first two waves are used to disconnect One direction, and the last two waves are used to break the connection in the other direction.

    Wave for the first time
    If a thinks the data is sent, it needs to send a connection release request to B. The request is only the header, the main parameters carried in the head are:
    Fin=1,seq=u. At this point, a will enter the Fin-wait-1 state.

    * PS1:FIN=1表示该报文段是一个连接释放请求。* PS2:seq=u,u-1是A向B发送的最后一个字节的序号。

    Wave for the second time
    b When a connection release request is received, the appropriate application is notified that a connection to B in this direction has been released. At this point, B enters the close-wait state and sends a connection release response to a, whose message header contains:
    Ack=1,seq=v,ack=u+1.

    * PS1:ACK=1:除TCP连接请求报文段以外,TCP通信过程中所有数据报的ACK都为1,表示应答。* PS2:seq=v,v-1是B向A发送的最后一个字节的序号。* PS3:ack=u+1表示希望收到从第u+1个字节开始的报文段,并且已经成功接收了前u个字节。

    A receives the reply, enters the fin-wait-2 state, waits for B to send the connection release request.
    After the second wave is completed, A to B connection has been released, B will no longer receive data, and a will no longer send data. However, the B-to-a connection still exists and B can continue to send data to a.

    Wave for the third time
    When B sends all the data to a, send a connection release request to a, request header: Fin=1,ack=1,seq=w,ack=u+1. B will enter the Last-ack state.

    Wave for the fourth time

    A when a release request is received, a confirmation reply is sent to B, at which point a enters the time-wait state. The status will last 2MSL time, and if there is no re-sending request for B in the time period, enter the closed state and revoke the TCB. When B receives a confirmation answer, it enters the closed state and revokes the TCB.
    Why does a need to enter the time-wait state first, wait for 2MSL time before entering closed state?
    In order to ensure B can receive a confirmation of the answer.

    If a is sent to the closed state directly after confirming the answer, if the answer is lost, B waits for a timeout and then sends the connection release request again, but at this point a is closed and no response is made, so B never shuts down normally.

    Web Stress Testing

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.