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
Name Descriptive name for this controller that is shown in the tree. No
Execution Style Whether the controller will run in percent executions or total executions mode. Yes
Throughput A 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 User If 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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章