网络压力测试(网络带宽压力测试教程视频_路由器压力测试)

发布时间:2025-12-10 19:16:19 浏览次数:10

网络带宽压力测试教程视频_路由器压力测试-网络压力测试仪

网络带宽压力测试教程视频_路由器压力测试在我第一次知道有wrk这个工具的时候他确实还不太完善,要想测试一些复杂的请求还有点难度.现在wrk支持lua脚本.在这个脚本里你可以修改method,header,body,可以对response做一下自定义的分析.因为是lua脚本,其实这给了你无限的可能.但是这样一个强大的功能如果不谨慎使用,会降低测试端的性能,测试结果也受到影响.Req/Sec每个线程每秒钟的完成的请求数,同样有平均值,标准偏差,最大值,正负一个标准差占比….

1.需要安装一下编译工具,通过运行下面命令来安装工具:

 

是否还在为Ide开发工具频繁失效而烦恼,来吧关注以下公众号获取最新激活方式。亲测可用!

为防止网络爬虫,请关注公众号回复”口令”

激活idea 激活CLion DataGrip DataSpell dotCover dotMemory dotTrace GoLand PhpStorm PyCharm ReSharper ReShaC++ Rider RubyMine WebStorm 全家桶 刷新

【正版授权,激活自己账号】:Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛

【官方授权 正版激活】:官方授权 正版激活 自己使用,支持Jetbrains家族下所有IDE…

# 安装 make 工具

sudo apt-get install make

# 安装 gcc编译环境

sudo apt-get install build-essential

2、安装完成之后安装git:

2.1.使用git -version命令查看环境是否安装git,如下图:

2.2.如果没安装就使用命令:apt-get install git (需要root权限就使用:sudo apt-get install git )

3、安装完成之后使用 git 下载 wrk 的源码到本地:

   

#下载命令

git clone https://github.com/wg/wrk.git

#切换路径到wrk目录下

cd wrk

#使用make命令编译环境

make

就 ok了.
make 成功以后在目录下有一个 wrk 文件. 就是它了. 你可以把这个文件复制到其他目录, 比如 bin 目录. 或者就这个目录下执行.

如果编译过程中出现:

   

src/wrk.h:11:25: fatal error: openssl/ssl.h: No such file or directory

#include <openssl/ssl.h>

12 threads and 100 connections

Thread Stats Avg Stdev Max +/- Stdev

Latency 538.64ms 368.66ms 1.99s 77.33%

Req/Sec 15.62 10.28 80.00 75.35%

5073 requests in 30.09s, 75.28MB read

Socket errors: connect 0, read 5, write 0, timeout 64

Requests/sec: 168.59

Transfer/sec: 2.50MB

Latency 538.64ms 368.66ms 1.99s 77.33%

Req/Sec 15.62 10.28 80.00 75.35%

Socket errors: connect 0, read 5, write 0, timeout 64

Requests/sec: 168.59

Transfer/sec: 2.50MB

12 threads and 100 connections

Thread Stats Avg Stdev Max +/- Stdev

Latency 1.16s 1.61s 14.42s 86.52%

Req/Sec 22.59 19.31 108.00 70.98%

4534 requests in 30.10s, 67.25MB read

Requests/sec: 150.61

Transfer/sec: 2.23MB

12 threads and 100 connections

Thread Stats Avg Stdev Max +/- Stdev

Latency 1.22s 1.88s 17.59s 89.70%

Req/Sec 14.47 9.92 98.00 77.06%

Latency Distribution

50% 522.18ms

75% 1.17s

90% 3.22s

99% 8.87s

3887 requests in 30.09s, 57.82MB read

Socket errors: connect 0, read 2, write 0, timeout 0

Requests/sec: 129.19

Transfer/sec: 1.92MB

wrk.body = "foo=bar&baz=quux"

wrk.headers["Content-Type"] = "application/x-www-form-urlencoded"

scheme = "http",

host = "localhost",

port = nil,

method = "GET",

path = "/",

headers = {},

body = nil,

thread = nil,

}

if status ~= 200 then

print(body)

wrk.thread:stop()

end

end

io.write("------------------------------\n")

for _, p in pairs({ 50, 90, 99, 99.999 }) do

n = latency:percentile(p)

io.write(string.format("%g%%,%d\n", p, n))

end

end

math.randomseed(os.time())

math.random(); math.random(); math.random()

function file_exists(file)

local f = io.open(file, "rb")

if f then f:close() end

return f ~= nil

end

function shuffle(paths)

local j, k

local n = #paths

for i = 1, n do

j, k = math.random(n), math.random(n)

paths[j], paths[k] = paths[k], paths[j]

end

return paths

end

function non_empty_lines_from(file)

if not file_exists(file) then return {} end

lines = {}

for line in io.lines(file) do

if not (line == '') then

lines[#lines + 1] = line

end

end

return shuffle(lines)

end

paths = non_empty_lines_from("paths.txt")

if #paths <= 0 then

print("multiplepaths: No paths found. You have to create a file paths.txt with one path per line")

os.exit()

end

print("multiplepaths: Found " .. #paths .. " paths")

request = function()

path = paths[counter]

counter = counter + 1

if counter > #paths then

counter = 1

end

return wrk.format(nil, path)

end

local start = string.find(cookies, name .. "=")

if start == nil then

return nil

end

return string.sub(cookies, start + #name + 1, string.find(cookies, ";", start) - 1)

end

response = function(status, headers, body)

local token = getCookie(headers["Set-Cookie"], "token")

if token ~= nil then

wrk.headers["Cookie"] = "token=" .. token

end

end

需要做网站?需要网络推广?欢迎咨询客户经理 13272073477