当前位置:网站首页>Jmeter压力测试教程
Jmeter压力测试教程
2022-06-23 15:54:00 【用户7353950】
Jmeter是一个非常好用的压力测试工具。Jmeter用来做轻量级的压力测试,非常合适,只需要十几分钟,就能把压力测试需要的脚本写好。
阅读目录
- 什么是压力测试
- 做压力测试的常用工具
- 做压力测试的步骤如下:
- 本文做压力测试的例子
- 第一步:使用CSV Data Set Config 来参数化
- 第二步:添加HTTP Request.
- 第三步:使用Thread Group, 控制模拟多少用户
- 第四步: 添加Summary Report 用来查看测试结果
- 第五步:运行一下
什么是压力测试
顾名思义:压力测试,就是 被测试的系统,在一定的访问压力下,看程序运行是否稳定/服务器运行是否稳定(资源占用情况)
比如:2000个用户同时到一个购物网站购物,这些用户打开页面的速度是否会变慢,或者网站是否会奔溃
做压力测试的常用工具
做压力测试,一般要使用工具, 人工是没办法做的。 最常用的工具是LoadRunner, 但是LoadRunner毕竟是收费软件,而且使用上也比较复杂。现在越来越多的人开始使用Jmeter来做压力测试。免费, 而且使用上非常简单。
做压力测试的步骤如下:
1. 写脚本 或者录制脚本
2. 使用用户自定义参数
3. 场景设计
4. 使用控制器,来控制 模拟多少用户。
5. 使用监听器, 查看测试结果
本文做压力测试的例子
本文举的实例是:在一台电脑用Jmeter模拟200个用户,同时去使用bing搜索不同的关键字, 查看页面返回的时间是否在正常范围内。
第一步:使用CSV Data Set Config 来参数化
首先我们把测试需要用到的2个参数放在txt文件中,
新建一个data.txt文件,输入些数据, 一行有两个数据,用逗号分隔。
启动Jmeter, 先添加一个Thread Group, 然后添加一个CSV Data Set Config (Add -> Config Element -> CSV Data Set Config)
第二步:添加HTTP Request.
我们添加http 请求,发送get
选择Thread Group 右键 (Add ->Sampler -> HTTP Request), 需要填的数据如下:
第三步:使用Thread Group, 控制模拟多少用户
选中Thread Group
Number of Threads(users): 一个用户占一个线程, 200个线程就是模拟200个用户
Ramp-Up Period(in seconds): 设置线程需要多长时间全部启动。如果线程数为200 ,准备时长为10 ,那么需要1秒钟启动20个线程。也就是每秒钟启动20个线程。
Loop Count: 每个线程发送请求的次数。如果线程数为200 ,循环次数为10 ,那么每个线程发送10次请求。总请求数为200*10=2000 。如果勾选了“永远”,那么所有线程会一直发送请求,直到选择停止运行脚本。
第四步: 添加Summary Report 用来查看测试结果
选中Thread Group 右键(Add -> Listener -> Summary Report)
第五步:运行一下
到目前为止, 脚本就全写好了, 我们来运行下, 如何看下测试的结果
边栏推荐
- 港股多支个股表现活跃,引发投资者对港股市场回暖猜想与关注
- Taishan Office Technology Lecture: four cases of using Italic Font
- Log4j log integration and configuration details
- OutputDebugString instructions and exception handling
- SaaS 云工具,产业互联网下的变革利器
- Uniapp sends picture messages to Tencent instant messaging Tim
- [openharmony] USB gadget configuration HDC function cfg file interpretation
- [tcapulusdb knowledge base] Introduction to tmonitor background one click installation (II)
- 亚朵更新招股书:继续推进纳斯达克上市,已提前“套现”2060万元
- 腾讯的技术牛人们,是如何完成全面上云这件事儿的?
猜你喜欢
![[tcapulusdb knowledge base] Introduction to tmonitor system upgrade](/img/7b/8c4f1549054ee8c0184495d9e8e378.png)
[tcapulusdb knowledge base] Introduction to tmonitor system upgrade

出现Identify and stop the process that‘s listening on port 8080 or configure this application等解决方法

Sleuth + Zipkin
Drag the child file to the upper level

Interpreting the 2022 agile coaching industry status report

元宇宙带来的社会结构和资本制度演变

CoAtNet: Marrying Convolution and Attention for All Data Sizes翻译

腾讯的技术牛人们,是如何完成全面上云这件事儿的?

坚持五件事,带你走出迷茫困境

数学分析_证明_第1章:可数个可数集之并为可数集
随机推荐
SaaS 云工具,产业互联网下的变革利器
Golang write file code example
Advanced development - generic entry basic class test
Opengauss database source code analysis series articles -- detailed explanation of dense equivalent query technology (Part 2)
The R language uses the GT package and the gtextras package to display tabular data gracefully and beautifully: gt of the gtextras package_ The sparkline function visualizes the line plot of the group
Avoid these six difficulties and successfully implement MES system
[today in history] June 23: Turing's birthday; The birth of the founder of the Internet; Reddit goes online
Six stone programming: the subtlety of application
stylegan1: a style-based henerator architecture for gemerative adversarial networks
golang goroutine、channel、time代码示例
2022 Jiufeng primary school (Optics Valley No. 21 primary school) student source survey
golang数据类型图
CoAtNet: Marrying Convolution and Attention for All Data Sizes翻译
融云:让银行轻松上“云”
万字攻略,详解腾讯面试(T1-T9)核心技术点,面试题整理
Quartz
面渣逆袭:MySQL六十六问!建议收藏
测试的重要性及目的
安全舒适,全新一代奇骏用心诠释老父亲的爱
读书郎通过上市聆讯:平板业务毛利率走低,2021年利润同比下滑11%