前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >linux curl wget ab测速

linux curl wget ab测速

作者头像
葫芦
发布2020-04-24 16:59:11
4K0
发布2020-04-24 16:59:11
举报
文章被收录于专栏:葫芦葫芦

CURL测速

curl -o /dev/null -w "\n DNS 解析域名的时间\n namelookup:"%{time_namelookup}"\n client和server端建立TCP 连接的时间\n time_connect:"%{time_connect}"\n 从client发出请求;到web的server 响应第一个字节的时间\n time_starttransfer:"%{time_starttransfer}"\n client发出请求;到web的server发送会所有的相应数据的时间\n time_total:"%{time_total}"\n 下载速度 单位 byte/s\n speed_download(byte/s):"%{speed_download}"\n" 

wget测速

wget -O /dev/null

ab测速

ab -n 1000 -c 50-k -p ./getByLocation.data -H "referer: https://servicewechat.com/*/devtools/page-frame.html" -T "application/json" -H "Content-Type: application/json" "https://c-mini.*.com/ads/application"

执行脚本

#!/bin/bash
echo "1.拉流接口"
curl -o /dev/null -w "\n DNS 解析域名的时间\n namelookup:"%{time_namelookup}"\n client和server端建立TCP 连接的时间\n time_connect:"%{time_connect}"\n 从client发出请求;到web的server 响应第一个字节的时间\n time_starttransfer:"%{time_starttransfer}"\n client发出请求;到web的server发送会所有的相应数据的时间\n time_total:"%{time_total}"\n 下载速度 单位 byte/s\n speed_download(byte/s):"%{speed_download}"\n"  'https://********.********.********' -H 'sec-ch-ua: nwjs 75' -H 'Sec-Fetch-Mode: cors' -H 'Origin: http://127.0.0.1:56074' -H 'Accept-Encoding: gzip, deflate, br' -H 'Sec-Fetch-Dest: empty' -H 'Connection: keep-alive' -H 'Pragma: no-cache' -H 'User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1 wechatdevtools/1.02.2003250 MicroMessenger/7.0.4 Language/zh_CN webview/' -H 'content-type: application/json;charset=UTF-8' -H 'Accept: */*' -H 'Cache-Control: no-cache' -H 'Referer: https://****.com/********/devtools/page-frame.html' -H 'Sec-Fetch-Site: cross-site' -H 'auth-token: ********' --data-binary '{"action":1,"vid":"********","*****":"********","uid":"********","appId":"********","**":"********","***":"********","**":[1]}' --compressed

echo "2.搜索接口"
curl -o /dev/null -w "\n DNS 解析域名的时间\n namelookup:"%{time_namelookup}"\n client和server端建立TCP 连接的时间\n time_connect:"%{time_connect}"\n 从client发出请求;到web的server 响应第一个字节的时间\n time_starttransfer:"%{time_starttransfer}"\n client发出请求;到web的server发送会所有的相应数据的时间\n time_total:"%{time_total}"\n 下载速度 单位 byte/s\n speed_download(byte/s):"%{speed_download}"\n"  'https://********.********.********' -H 'sec-ch-ua: nwjs 75' -H 'Sec-Fetch-Mode: cors' -H 'Origin: http://127.0.0.1:56074' -H 'Accept-Encoding: gzip, deflate, br' -H 'Sec-Fetch-Dest: empty' -H 'Connection: keep-alive' -H 'Pragma: no-cache' -H 'User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1 wechatdevtools/1.02.2003250 MicroMessenger/7.0.4 Language/zh_CN webview/' -H 'content-type: application/json;charset=UTF-8' -H 'Accept: */*' -H 'Cache-Control: no-cache' -H 'Referer: https://****.com/********/devtools/page-frame.html' -H 'Sec-Fetch-Site: cross-site' -H 'auth-token: ********' --data-binary '{"action":1,"vid":"********","*****":"********","uid":"********","appId":"********","**":"********","***":"********","**":[1]}' --compressed

echo "3.资源地址"
wget -O /dev/null https://*.mp4

输出

1.拉流接口
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   339    0   162  100   177    572    625 --:--:-- --:--:-- --:--:--   627

 DNS 解析域名的时间
 namelookup:0.004
 client和server端建立TCP 连接的时间
 time_connect:0.035
 从client发出请求;到web的server 响应第一个字节的时间
 time_starttransfer:0.283
 client发出请求;到web的server发送会所有的相应数据的时间
 time_total:0.283
 下载速度 单位 byte/s
 speed_download(byte/s):572.000
2.搜索接口
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  5899    0  5630  100   269  16064    767 --:--:-- --:--:-- --:--:-- 16039

 DNS 解析域名的时间
 namelookup:0.000
 client和server端建立TCP 连接的时间
 time_connect:0.035
 从client发出请求;到web的server 响应第一个字节的时间
 time_starttransfer:0.350
 client发出请求;到web的server发送会所有的相应数据的时间
 time_total:0.350
 下载速度 单位 byte/s
 speed_download(byte/s):16064.000
3.资源地址
--2020-04-22 11:32:12--  https://*.mp4
Resolving *.com)... *.*.*.*, *.*.*.*,*.*.*.*
Connecting to *.com (*.com)|*.*.*.*|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 16178920 (15M) [video/mp4]
Saving to: '/dev/null'

100%[=========================================================================================================================================================>] 16,178,920  25.8MB/s   in 0.6s
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • CURL测速
  • wget测速
    • ab测速
      • 执行脚本
        • 输出
        领券
        问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档