Jmeter(四十五)Logic Controllers 之 Throughput Controller(控制业务比例)

不管前面是地雷阵还是万丈深渊,我都将勇往直前,义无反顾,鞠躬尽瘁,死而后已。

--朱总理

一、官方文档

19.2.7 Throughput Controller

The Throughput Controller allows the user to control how often it is executed. There are two modes:

percent execution

total executions

Percent executions

causes the controller to execute a certain percentage of the iterations through the test plan.

Total executions

causes the controller to stop executing after a certain number of executions have occurred.

Like the Once Only Controller, this setting is reset when a parent Loop Controller restarts.


This controller is badly named, as it does not control throughput. Please refer to the Constant Throughput Timer for an element that can be used to adjust the throughput.

Control Panel


The Throughput Controller can yield very complex behavior when combined with other controllers - in particular with interleave or random controllers as parents (also very useful).

Parameters

AttributeDescriptionRequired

NameDescriptive name for this controller that is shown in the tree.No

Execution StyleWhether the controller will run in percent executions or total executions mode.Yes

ThroughputA number. For percent execution mode, a number from 0-100 that indicates the percentage of times the controller will execute. "50" means the controller will execute during half the iterations through the test plan. For total execution mode, the number indicates the total number of times the controller will execute.Yes

Per UserIf checked, per user will cause the controller to calculate whether it should execute on a per user (per thread) basis. If unchecked, then the calculation will be global for all users. For example, if using total execution mode, and uncheck "per user", then the number given for throughput will be the total number of executions made. If "per user" is checked, then the total number of executions would be the number of users times the number given for throughput.

The Throughput Controller allows the user to control how often it is executed. There are two modes

第一段就说的很清楚,控制执行频率。



·Total Executions 

  执行一定数量停止

·Percent Executions

  按照百分比执行

和仅一次控制器一样,当父循环控制器重新启动时,此设置将重置

·Per User

如果选中,则每个用户将导致控制器计算是否应按每个线程执行

如果未选中,则计算是所有线程的全局计算

例如:选择Total Executions,取消选择Per User,则吞吐量给定的数字是执行的总数;选择Per User,执行的总数是线程数*吞吐量的给定数

二、实践

吞吐量控制器通常在组合业务场景中,例如:容量性能场景、稳定性能场景中非常实用。

线程组配置:5s内启动100线程,循环1次

Throughput Controller_success 选择百分比控制方式 20%

Throughput Controller_debug   选择百分比控制方式 30%

Throughput Controller_error   选择百分比控制方式 50%


聚合报告展示:

Response Times Over Time 展示:

 Transactions per Second展示:

从聚合报告展示中便可看出其分配比例。

分别将吞吐量控制器修改为Total Executions

线程组循环数改为2,其余不变

Throughput Controller_success 100

Throughput Controller_debug  50

Throughput Controller_error  50

选择Per User

 Response Times Over Time

欢迎任何形式的转载,但请务必注明出处。 限于本人水平,如果文章和代码有表述不当之处,还请不吝赐教。 ---紫陌花间客

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Jmeter之逻辑控制器(Logic Controller) 前言: 1、 Jmeter官网对逻辑控制器的解释是:...
    Talon_1355阅读 2,999评论 0 0
  • 夜莺2517阅读 127,806评论 1 9
  • 我是黑夜里大雨纷飞的人啊 1 “又到一年六月,有人笑有人哭,有人欢乐有人忧愁,有人惊喜有人失落,有的觉得收获满满有...
    陌忘宇阅读 12,729评论 28 53
  • 信任包括信任自己和信任他人 很多时候,很多事情,失败、遗憾、错过,源于不自信,不信任他人 觉得自己做不成,别人做不...
    吴氵晃阅读 11,351评论 4 8