学英语学压测:02jmeter组件-测试计划和线程组&ramp-up参数的作用

📢📢📢:先看关键单词,再看英文,最后看中文总结,再回头看一遍英文原文,效果更佳!!

关键词

|--------------------|------|------------------------|
| Functional Testing | 功能测试 | [ˈfʌŋkʃənəl ˈtɛstɪŋ] |
| Sample | 样本 | [ˈsæmpəl] |
| Listeners | 监听器 | [ˈlɪsənərz] |
| Consequence | 后果 | [ˈkɒnsɪkwəns] |
| Performance | 性能 | [pərˈfɔːrməns] |
| Stress-testing | 压力测试 | [strɛs ˈtɛstɪŋ] |
| Controllers | 控制器 | [kənˈtroʊlərz] |
| Samplers | 取样器 | [ˈsæmplərz] |
| Concurrent | 并发的 | [kənˈkɜːrənt] |
| Duration | 持续时间 | [djuˈreɪʃən] |
| Startup Delay | 启动延迟 | [ˈstɑːrtʌp dɪˈleɪ] |

测试计划:

A test plan describes a series of steps JMeter will execute when run. A complete test plan will consist of one or more Thread Groups, logic controllers, sample generating controllers, listeners, timers, assertions, and configuration elements.

The Test Plan object has a checkbox called "Functional Testing". If selected, it will cause JMeter to record the data returned from the server for each sample. If you have selected a file in your test listeners, this data will be written to file. This can be useful if you are doing a small run to ensure that JMeter is configured correctly, and that your server is returning the expected results. The consequence is that the file will grow huge quickly, and JMeter's performance will suffer. This option should be off if you are doing stress-testing (it is off by default).

If you are not recording the data to file, this option makes no difference.

You can also use the Configuration button on a listener to decide what fields to save.

线程组

Thread group elements are the beginning points of any test plan. All controllers and samplers must be under a thread group. Other elements, e.g. Listeners, may be placed directly under the test plan, in which case they will apply to all the thread groups. As the name implies, the thread group element controls the number of threads JMeter will use to execute your test. The controls for a thread group allow you to:

  • Set the number of threads
  • Set the ramp-up period
  • Set the number of times to execute the test

Each thread will execute the test plan in its entirety and completely independently of other test threads. Multiple threads are used to simulate concurrent connections to your server application.

The ramp-up period tells JMeter how long to take to "ramp-up" to the full number of threads chosen. If 10 threads are used, and the ramp-up period is 100 seconds, then JMeter will take 100 seconds to get all 10 threads up and running. Each thread will start 10 (100/10) seconds after the previous thread was begun. If there are 30 threads and a ramp-up period of 120 seconds, then each successive thread will be delayed by 4 seconds.

Ramp-up needs to be long enough to avoid too large a work-load at the start of a test, and short enough that the last threads start running before the first ones finish (unless one wants that to happen).

Start with Ramp-up = number of threads and adjust up or down as needed.

By default, the thread group is configured to loop once through its elements.

Thread Group also allows to specify Thread lifetime. Click the checkbox at the bottom of the Thread Group panel to enable/disable extra fields in which you can enter the duration of test and the startup delay You can configure Duration (seconds) and Startup Delay (seconds) to control the duration of each thread group and the after how much seconds it starts. When the test is started, JMeter will wait Startup Delay (seconds) before starting the Threads of the Thread Group and run for the configured Duration (seconds) time.

中文总结:

测试计划:

完整的测试计划由一个或多个线程组、逻辑控制器、样本生成控制器、监听器、定时器、断言和配置元素组成。

复选框"功能测试"选中后,JMeter将记录每个样本从服务器返回的数据,并将数据写入监听器中选择的文件。

线程组:

线程组元素是任何测试计划的起始点,所有控制器和取样器必须在线程组下。

其他元素(如监听器)可直接放在测试计划下,此时它们适用于所有线程组。

线程组控制JMeter执行测试的线程数。

配置选项包括设置线程数、加速时间和测试执行次数。

Ramp-up参数只在线程组第一次启动时生效,用于控制线程的启动速度。在线程组的后续循环中,Ramp-up参数不再起作用,因为所有线程已经处于运行状态。

假设你有以下配置:

  • 线程数(Number of Threads):10
  • Ramp-up时间:20秒
  • 循环次数(Loop Count):2

在这种情况下:

  • JMeter将在20秒内逐步启动10个线程,每个线程之间的启动间隔为2秒。
  • 所有线程启动后,将执行测试计划两次(循环次数为2)。
  • 在第二次循环开始时,所有线程已经启动,Ramp-up时间不会再次生效。
相关推荐
小小测试开发1 天前
JMeter XPath提取器用法详解:XML/HTML响应数据提取神器
xml·jmeter·html
weixin_440730503 天前
jmeter请求头和参数总结
jmeter
2501_924064115 天前
2025数据库性能测试工具:Utest、JMeter、HammerDB 等主流方案推荐
数据库·测试工具·jmeter·数据库性能测试·数据库负载测试·数据库压测工具·jmeter 压力测试
小小测试开发5 天前
JMeter JSR223预处理程序全攻略:用Groovy解锁复杂场景自动化
运维·jmeter·自动化
卖个几把萌5 天前
【08】JMeter从文本中读取多个参数
测试工具·jmeter
海梨花6 天前
又是秒杀又是高并发,你的接口真的扛得住吗?
java·后端·jmeter
小小测试开发6 天前
JMeter HTTP URL重写修饰符用法详解:解决会话传递与URL参数动态处理
网络协议·jmeter·http
兔子蟹子6 天前
JMeter 自动化测试 + 飞书通知完整指南
jmeter·飞书
小小测试开发7 天前
JMeter JSR223预处理程序高级用法:解锁自动化测试的灵活性上限
开发语言·jmeter·groovy
CesareCheung7 天前
JMeter 进行 WebSocket 接口压测
python·websocket·jmeter