如何为不同的HTTP请求分配用户数?

时间:2014-11-14 05:15:07

标签: performance http jmeter performance-testing

我的方案是允许25个用户点击一个HTTP请求,75个用户请求另一个请求,同时使用一个或多个线程组。

   1. Default Request: www.abc.com
   2. 25 Users should hit www.abc.com/firstrequest
   3. 75 Users should hit www.abc.com/secondrequest

如何使用Jmeter同时允许在两个或多个不同请求中分配用户?

1 个答案:

答案 0 :(得分:7)

是的,您可以使用同步计时器来执行此操作,但仅针对请求而不针对多个请求。

但是可以通过调整来实现所需的负载。

1. suppose you have 2 threadgroups having 1 request each. i.e. firstrequest and secondrequest 
2. create synchronizing timer as a child of testplan (by this it will be applicable to both threadgroups)
3. put no. of threads to group by as 100 (as you want 25 users to hit firstrequest and 75 users to hit secondrequest simulataneously, which means 100 concurrent users)
4. assign 25 thread count to first threadgroup
5. assign 75 thread count to first threadgroup 
6. Allow running threadgroups in parallel by not checking run threadgroups consecutively checkbox in testplan

通过这种方式,您可以生成100个并发用户来测试2个请求。 如果您不希望同时命中2个请求,则可以向每个线程组添加同步计时器并运行测试。

enter image description here