英文:
Test using JMeter without increasing number of users
问题
我想测试 Web 服务,使用以下配置:每秒 3 个用户,在 1 小时内。我理解经典的场景是每隔 n 秒增加用户数量。但我需要保持用户数量稳定,如何做到?
英文:
I want to test web service with this configurartion: 3 users per second within 1 hour. I understand that classic scenario is increasing number of users every n second. But I need keep stable number of users, how to do it?
答案1
得分: 1
我们可以使用JMeter中的内置Thread Group以及来自流行JMeter插件的自定义Thread Group来实现这一点。
对于内置方法:
您可以使用普通Thread Group的配置来连续运行3个线程一个小时。
- 将“线程数”设置为3
- 将“Ramp-up周期”设置为0,以确保始终有3个用户
- 选中“指定线程寿命”选项
- 在“持续时间”选项中输入3600以指定一小时。
对于第三方插件方法:
这将实现相同的结果,但具有更多的控制和可视化。
- 下载并安装自定义Thread Groups插件
- 在计划中添加一个“并发线程组”
- 将“目标并发数”设置为3以定义用户数
- 将“保持目标速率时间”设置为60以运行一小时。
如果您想进一步调整设置,第三方插件方法中包含的图形表示是一个很好的资源。
希望这对您有所帮助!
英文:
We could achieve this using both the built-in Thread Group in JMeter, as well as using a custom Thread Group from a popular JMeter plugin.
For a built-in method:<br>
You can use configuration from a normal Thread Group to run 3 threads consistently for an hour.
- Set "Number of Threads" to 3
- Set "Ramp-up Period" to 0 to ensure we have a constant three users at all times
- Check the "Specify Thread lifetime" option
- Enter 3600 into the "Duration" option to specify an hour<br>
For a third-party plugin method:<br>
This will achieve the same result, but with some more control and visualization.
- Download and install the Custom Thread Groups plugin
- Add a "Concurrency Thread Group" to your plan
- Set "Target Concurrency" to 3 to define your user count
- Set "Hold Target Rate Time" to 60 to run for an hour<br>
If you'd like to tweak your settings further, the included graphical representation in the third-party plugin method is a great resource.
Hope this helps!
答案2
得分: 0
这是可轻松配置的,只需不在线程组中指定任何逐渐增加的时间段:
如果你的“每秒3个用户”意味着“每秒3个请求”,取决于你的端点响应时间,你可能需要更多的用户或者使用恒定吞吐量定时器来限制JMeter的吞吐量为每秒3个请求,因为上述线程组设置只会在你的应用响应时间精确为1秒时才能每秒获得3个请求。如果响应时间为2秒,你将每秒获得1.5个请求,如果为500毫秒,你将每秒获得6个请求,依此类推。
英文:
It's easily configurable, just don't specify any ramp-up period in the Thread Group:
If your "3 users per second" means "3 requests per second" depending on your endpoint response time you might need either more users or to limit JMeter's throughput to 3 requests per second using i.e. Constant Throughput Timer as the above Thread Group setup will give you 3 requests per second only if your application response time is 1 second sharp. If it will be 2 seconds you will have 1.5 requests per second, if it will be 500 milliseconds you will have 6 requests per second, etc.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论