Change the thread count of test plan in JMeter, at run time

前端 未结 7 489
名媛妹妹
名媛妹妹 2020-12-10 14:09

I want to change the number of threads for a JMeter test plan at runtime.

I have Googled my problem and found a proposed solution to use JMeter plugins. But in this

7条回答
  •  遥遥无期
    2020-12-10 14:45

    you can change it based on a variable which you set in a startup thread. See below.

    In Jmeter how do I set a variable number of threads using a beanshell sampler variable?

    However once the thread group has started you can not modify it. To the guy who said this feature would not be useful I disagree. There are many types of load tests and they do not all have the same number of users running for the duration. Here are just 2 example types of enterprise load tests we conduct at the bank where I work:

    • duration test - same number of users run the entire time (possibly with a short ramp-up period)
    • Break point test - ramp up the number of users incrementally till the application breaks
    • Spike test - run with a constant number of users but sporadically
      throw in a large number of users

    A break point test ramps up the number of users until the application breaks (the point being to see how high your app can scale). You can sort of do this using the thread groups "ramp up period" property. If you set ramp up time to 1000 and the number of threads to 100 it will add 1 thread every 10 seconds.

    Spike tests are like duration tests but at some intervals a large number of users log in. This is used to guage the applications response time during peak hours or how it will respond if you all of a sudden get a large number of users (a very real scenario).

    I find that Jmeter does not handle all load test scenarios that are needed in enterprise load testing. One work around Im considering is to just start all the threads but find a way to make some of them sleep. So you could set the number of threads to 1000 but somehow make 980 of them sleep or do nothing. Then maybe when the time_in_seconds%5==0 (every 5 minutes) you allow the other threads to run - simulating a spike test. The idea is you can hard code the threads to 1000 and will always have 1000 threads running - but they don't all have to be doing something at all times.

    (in other words you can probably find a way but you have to get creative)

    Update: I just found this plugin which allows different types of testing. Have not tried it yet but looks promising: http://jmeter-plugins.org/wiki/ThroughputShapingTimer/

提交回复
热议问题