当前位置:网站首页>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)
第五步:运行一下
到目前为止, 脚本就全写好了, 我们来运行下, 如何看下测试的结果
边栏推荐
- 腾讯的技术牛人们,是如何完成全面上云这件事儿的?
- XML
- TensorRT Paser加载onnx 推理使用
- Thinking analysis of binary search method
- golang二分查找法代码实现
- SSRS页面配置Postgresql data source的方法
- R language uses colorblinr package to simulate color blind vision, and uses edit to visualize the image of ggplot2_ The colors function is used to edit and convert color blindness into visual results
- Block, non block, multiplexing, synchronous, asynchronous, bio, NiO, AIO
- ADB 按鍵名、按鍵代碼數字、按鍵說明對照錶
- Image reading: image open(ImgPath)
猜你喜欢

Apache commons tool class

Focus: zk-snark Technology
![[tcapulusdb knowledge base] tcapulusdb tmonitor module architecture introduction](/img/7b/8c4f1549054ee8c0184495d9e8e378.png)
[tcapulusdb knowledge base] tcapulusdb tmonitor module architecture introduction

Golang writes to JSON files
![[tcapulusdb knowledge base] Introduction to tmonitor stand-alone installation guidelines (II)](/img/6d/8b1ac734cd95fb29e576aa3eee1b33.png)
[tcapulusdb knowledge base] Introduction to tmonitor stand-alone installation guidelines (II)

科大讯飞神经影像疾病预测方案!

2022 Jiufeng primary school (Optics Valley No. 21 primary school) student source survey

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

阻塞、非阻塞、多路复用、同步、异步、BIO、NIO、AIO 一文搞定

golang数据类型图
随机推荐
R language uses the image of magick package_ The scale function resizes the image. You can customize the scaling from the angle of width or height
安全舒适,全新一代奇骏用心诠释老父亲的爱
[today in history] June 23: Turing's birthday; The birth of the founder of the Internet; Reddit goes online
ASEMI快恢复二极管RS1M、US1M和US1G能相互代换吗
Code example of golang date time package: get age, zodiac and constellation based on birthday
创新实力再获认可!腾讯安全MSS获2022年度云原生安全守护先锋
再突破!阿里云进入Gartner云AI开发者服务挑战者象限
读书郎通过上市聆讯:平板业务毛利率走低,2021年利润同比下滑11%
Example of if directly judging data type in JS
PageHelper faces the paging problem of complex service data processing
CA authentication and issuance of revocation certificates
Opengauss database source code analysis series articles -- detailed explanation of dense equivalent query technology (Part 1)
stylegan3:alias-free generative adversarial networks
Summarize the experience of purchasing Alibaba cloud servers
[tcapulusdb knowledge base] Introduction to new models of tcapulusdb
Golang对JSON文件的写操作
NLP 论文领读|改善意图识别的语义表示:有监督预训练中的各向同性正则化方法
How does the web container initialize third-party plug-ins
Asynclistener interface of servlet 3.0
Innovation strength is recognized again! Tencent security MSS was the pioneer of cloud native security guard in 2022