当前位置:网站首页>Jmeter- (V) simulated user concurrent login for interface test

Jmeter- (V) simulated user concurrent login for interface test

2022-06-23 03:23:00 Hello, test

Preface :

This time mainly introduces the use of Jmeter Simulate user concurrent login , Test interface performance :

        ( One ) read CVS The configuration file

        ( Two ) Read database


( One ) read configuration file

advantage : Easy to learn , Easy to use

shortcoming : It is not applicable to concurrency with a large number of users , For example, testing 1 Million users concurrently , You need to manually write tens of thousands of pieces of data to the configuration file , Hands hurt ~

1. Add thread group

Right click test plan -> Threads -> Thread group

Parameter interpretation :

         Number of threads : Number of concurrent users

        Ramp-Up Time ( second ): How long it takes to start all threads

                ① 0 Concurrent on behalf of ;

                ②  If the number of threads is 3, The required duration is 3S, be 3/3=1 every other 1S Start a thread ;

                ③  General Settings Ramp-Up= Number of threads , Then adjust it up and down to the desired .

         cycles : Check Forever And keep doing it

2.  Add synchronous timer , Set assembly point

explain : Its function is to block threads , Until the specified number of threads arrives , And release it together , It can create a lot of pressure in a moment

Thread group right-click -> Timer -> Synchro timer

Parameter description : 

The number of simulated user groups : Number of threads released at the same time

The timeout is in milliseconds : That is, how many milliseconds after the timeout, release the specified number of threads at the same time .

  • If set to 0,Timer Will wait for the number of threads to reach “Number of Simulated Users to Group by” The value in is released ;
  • If it is greater than 0, If the number of threads set above has not been reached after this time ,Timer All threads will be released .

3. A parameterized

Thread group right-click -> The configuration element ->CVS Data file settings

 4. add to http request , Call parameters

 5. Check operation

View the concurrency by viewing the result tree and the aggregation report . 

( Two ) Read database

advantage : It is suitable for large-scale user concurrent testing , And the maintenance cost is small .

1. Add thread group

2. Add timers

3. Add database configuration

Thread group right-click -> The configuration element ->JDBC Connection  Configuration

 4.  Get the login account and password from the database

Thread group right-click -> Sampler ->JDBC request request

5. add to http request  

${__V(name_${__Random(1,10,)})}: The function is used here , Random login 10 This user

You can use tools -> The function Assistant dialog box generates

 5. Check operation

View the concurrency by viewing the result tree and the aggregation report . 

Hello Test, So far we Jmeter Simulation concurrency has been introduced , We choose the best solution according to the number of users . Later, we will give a special article on how to view the aggregation report ? Pay more attention to , finger heart ~

原网站

版权声明
本文为[Hello, test]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202211736595459.html