對將要上線的功能進行檢查

網絡穩定性測試

  • 關注的指標,avg(平均耗時)、loss(丟包率)
  • route -n 網關ip查詢,從IP routing table中可以看到0.0.0.0對應的ip

  • ping
    • -c表示運行的秒數,運行完會反饋下面的結果
    • 實際執行的時間可能會大於設置的秒數
[root@iZ2ze5i5qr1kmeajdt3k6kZ ~]# ping -i 1 -q -c 86400 192.168.71.253
PING 192.168.71.253 (192.168.71.253) 56(84) bytes of data.
--- 192.168.71.253 ping statistics ---
86400 packets transmitted, 86400 received, 0% packet loss, time 86398301ms
rtt min/avg/max/mdev = 0.013/0.035/9.915/0.040 ms
  • mtr
    • -c表示運行的秒數,運行完會反饋下面的結果
    • 會把經歷了哪些IP最終到的IP都顯示出來
[root@9Z2ze2i5Dr1gmeajpd8k2kZ ~]# mtr --report --no-dns --show-ips -i 1 -c 86400 172.36.10.8
Start: Tue May  8 20:32:46 2018
HOST: iZ2ze5i5qr1gmeajtd8k6kZ     Loss%   Snt   Last   Avg  Best  Wrst StDev
  1.|-- 192.168.69.139             0.0% 86400    1.1   1.0   1.0   7.3   0.1
  2.|-- 172.36.10.8                0.0% 86400    1.1   1.1   1.1  20.1   0.1

HTTP壓測

  • 關注的指標,RT(Latency Avg)、QPS(Requests/sec)、TPS(Transfer/sec)

  • 測試的時候在接口中直接輸出4K、16K、32K的數據,模擬真實的情況。比直接壓測一個hello Word更有說服力

  • netstat -ant | grep xxxx 、 lsof -i:port 可以對壓測中的數據進行查看

  • siege

    • 併發數限制爲255,需要改配置文件
    • 造成的壓力不明顯
  • ab

    • 併發數限制爲0-20000
  • wrk

    • -latency 延時統計
    • -timeout 請求超時時間
    • -c 併發
    • -t 要使用的線程數
    • -d 測試持續時間

  • wrk
[root@chons ~]# wrk --latency --timeout 5 -c 1000 -t 1 -d 60 http://192.168.69.145:8080/output/data16k
Running 1m test @ http://192.168.69.145:8080/output/data16k
  1 threads and 1000 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     1.41s     1.12s    5.00s    69.06%
    Req/Sec   476.65    112.18     2.81k    93.50%
  Latency Distribution
     50%    1.08s
     75%    2.08s
     90%    3.11s
     99%    4.62s
  28476 requests in 1.00m, 463.92MB read
  Socket errors: connect 0, read 0, write 0, timeout 1909
Requests/sec:    474.47
Transfer/sec:      7.73MB

DNS測試

  • 生成了10W個隨機子域名
  • 測試工具queryperf
  • 關注指標QPS、RT、成功率(失敗率)

工具安裝

生成隨機子域名

for i in $(seq 0 100000); do  echo $i; echo "$(tr -dc a-z < /dev/urandom | head -c 12).default.svc.cluster.local A" >>testdata.txt; done

測試

  • queryperf [-d datafile] [-s server_addr] [-p port] [-q num_queries]

    • -d: 後面接上一個文件,文件的內容是用戶對DNS的請求,一行爲一條請求,所以爲了測試,我們可以在裏面寫上幾千幾萬條。

    • -s: DNS服務器地址

    • -p: DNS服務器端口

    • -q: 請求多少次

  • bash-4.3# queryperf -d testdata.txt -s 172.26.0.10 -q 5000

DNS Query Performance Testing Tool
Version: $Id: queryperf.c,v 1.12 2007/09/05 07:36:04 marka Exp $

[Status] Processing input data
[Status] Sending queries (beginning with 172.26.0.10)
Statistics:

[Timeout] Query timed out: msg id 4571
[Timeout] Query timed out: msg id 4572
[Timeout] Query timed out: msg id 4573
[Timeout] Query timed out: msg id 4574
[Timeout] Query timed out: msg id 4575
[Timeout] Query timed out: msg id 4576
[Timeout] Query timed out: msg id 4577
[Timeout] Query timed out: msg id 26478
[Status] Testing complete

Statistics:

  Parse input file:     once
  Ended due to:         reaching end of file

  Queries sent:         100001 queries
  Queries completed:    100001 queries
  Queries lost:         0 queries
  Queries delayed(?):   0 queries

  RTT max:         	0.137697 sec
  RTT min:              0.000201 sec
  RTT average:          0.000520 sec
  RTT std deviation:    0.001675 sec
  RTT out of range:     0 queries

  Percentage completed: 100.00%
  Percentage lost:        0.00%

  Started at:           Mon May 14 18:59:04 2018
  Finished at:          Mon May 14 18:59:13 2018
  Ran for:              8.893822 seconds

  Queries per second:   11243.872432 qps

#測試

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章