我的场景是允许 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. 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 个请求同时命中,那么您可以为每个线程组添加同步计时器并运行测试。
关于performance - 如何为不同的 HTTP 请求分配用户数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26923364/