Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Wrk stress testing tool

2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

Wrk installation

Install under Mac: brew install wrk

Once the installation is successful, enter the wrk directory / usr/local/Cellar/wrk/4.0.2/bin and execute the wrk command.

Simple performance testing

Bin git: (master) wrk-T12-C100-d30s http://weibo.com Running 30s test @ http://weibo.com 12 threads and 100 connections Thread Stats Avg Stdev Max + /-Stdev Latency 55.09ms 95.37ms 1.47s 90.01% Req/Sec 271.78 122.50 626.00 66.39% 95509 requests in 30.08s, 55.70MB read Socket errors: connect 0, read 0, write 0 Timeout 1Requests/sec: 3175.48Transfer/sec: 1.85MB

-T12 simulates 12 user threads.-c100 simulates 100 connections

3. Statistical analysis

The project name indicates the discretization degree of the Avg average average value of each test Stdev standard deviation result. The higher the Stdev standard deviation result, the more unstable the maximum Max result + /-Stdev plus or minus one standard deviation, the greater the instability.

Latency: can be understood as response time

Req/Sec: the number of requests completed per second per thread

Generally speaking, we mainly focus on averages and maximum values.

If the standard deviation is too large, the sample itself has a high degree of dispersion. It is possible that the performance of the system fluctuates greatly

4.wrk Post interface test

First, you need to prepare a lua file.

Wrk.method = "POST" wrk.headers ["Content-Type"] = "application/x-www-form-urlencoded" wrk.body = "youbody&youset"

It is suggested that you fill in the contents of this document and save it as a post.lua file.

Of course, the content of this script can be defined again. Check the git document of wrk.

Execute script

Wrk-T4-c2000-d60s-T5s-- script=post.lua-- latency http://192.168.31.107/user/login

In this way, 4 threads and 2000 connections are simulated to execute post.lua requests at intervals of 5 seconds within 60s.

You can extend it and create shell scripts to batch test various interfaces.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 253

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report