Check Web Performance 测试下网络性能
下面都是一些在线的站点,可以尝试看看,个人感觉还不错。测试下网络性能:
https://www.17ce.comhttps://www.tingyun.com/tingyun_network.htmlhttps://gtmetrix.comhttps://tools.pingdom.comhttps://www.dotcom-tools.com/website-speed-test.aspxhttps://webspeedtest.cloudinary.comhttps://www.webpagetest.orghttps://www.dareboost.com/en/analysis
学习两个压测命令:
ab是apachebench命令的缩写, 默认mac下都已经安装了
➜ ~ /usr/sbin/ab --help/usr/sbin/ab: wrong number of arguments Usage: /usr/sbin/ab [options] [http[s]://]hostname[:port]/path Options are: -n requests Number of requests to perform -c concurrency Number of multiple requests to make at a time -t timelimit Seconds to max. to spend on benchmarking This implies -n 50000 -s timeout Seconds to max. wait for each response Default is 30 seconds -b windowsize Size of TCP send/receive buffer, in bytes -B address Address to bind to when making outgoing connections -p postfile File containing data to POST. Remember also to set -T -u putfile File containing data to PUT. Remember also to set -T -T content-type Content-type header to use for POST/PUT data, eg. 'application/x-www-form-urlencoded' Default is 'text/plain' -v verbosity How much troubleshooting info to print -w Print out results in HTML tables -i Use HEAD instead of GET -x attributes String to insert as table attributes -y attributes String to insert as tr attributes -z attributes String to insert as td or th attributes -C attribute Add cookie, eg. 'Apache=1234'. (repeatable) -H attribute Add Arbitrary header line, eg. 'Accept-Encoding: gzip' Inserted after all normal header lines. (repeatable) -A attribute Add Basic WWW Authentication, the attributes are a colon separated username and password. -P attribute Add Basic Proxy Authentication, the attributes are a colon separated username and password. -X proxy:port Proxyserver and port number to use -V Print version number and exit -k Use HTTP KeepAlive feature -d Do not show percentiles served table. -S Do not show confidence estimators and warnings. -q Do not show progress when doing more than 150 requests -l Accept variable document length (use this for dynamic pages) -g filename Output collected data to gnuplot format file. -e filename Output CSV file with percentages served -r Don't exit on socket receive errors. -m method Method name -h Display usage information (this message) -I Disable TLS Server Name Indication (SNI) extension -Z ciphersuite Specify SSL/TLS cipher suite (See openssl ciphers) -f protocol Specify SSL/TLS protocol (TLS1, TLS1.1, TLS1.2 or ALL) -E certfile Specify optional client certificate chain and private key
➜ ~ /usr/sbin/ab -n 100 -c 5 http://www.baidu.com/
This is ApacheBench, Version 2.3 <$Revision: 1843412 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking www.baidu.com (be patient).....done
Server Software: BWS/1.1
Server Hostname: www.baidu.com
Server Port: 80
Document Path: /
Document Length: 280696 bytes
Concurrency Level: 5
Time taken for tests: 6.152 seconds
Complete requests: 100
Failed requests: 96
(Connect: 0, Receive: 0, Length: 96, Exceptions: 0)
Total transferred: 28187420 bytes
HTML transferred: 28071381 bytes
Requests per second: 16.25 [#/sec] (mean)
Time per request: 307.617 [ms] (mean)
Time per request: 61.523 [ms] (mean, across all concurrent requests)
Transfer rate: 4474.20 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 34 52 19.6 46 152
Processing: 151 248 60.5 233 443
Waiting: 37 57 20.6 51 151
Total: 186 300 67.6 286 504
Percentage of the requests served within a certain time (ms)
50% 286
66% 323
75% 341
80% 354
90% 392
95% 443
98% 502
99% 504
100% 504 (longest request)
推荐另一个个人感觉这个更好用一些
brew search wrk
==> Formulae
wrk ✔ wrk-trello
brew install wrk 来安装
➜ ~ wrk --helpUsage: wrk <options> <url> Options: -c, --connections <N> Connections to keep open -d, --duration <T> Duration of test -t, --threads <N> Number of threads to use -s, --script <S> Load Lua script file -H, --header <H> Add header to request --latency Print latency statistics --timeout <T> Socket/request timeout -v, --version Print version details Numeric arguments may include a SI unit (1k, 1M, 1G) Time arguments may include a time unit (2s, 2m, 2h)
wrk -c 100 -t 8 https://www.toutiao.com/i6873829094392496643/Running 10s test @ https://www.toutiao.com/i6873829094392496643/ 8 threads and 100 connections Thread Stats Avg Stdev Max +/- Stdev Latency 120.90ms 121.39ms 1.79s 80.44% Req/Sec 117.52 41.39 240.00 68.31% 9381 requests in 10.09s, 43.05MB readRequests/sec: 929.67Transfer/sec: 4.27MB