简体   繁体   English

在基本身份验证的情况下在Jmeter中实现并发

[英]Attaining Concurrency in Jmeter in case of Basic Authtoken

I am load testing RESTful API of a mobile app with an estimated 5,000 users. 我正在对大约5,000个用户的移动应用程序的RESTful API进行负载测试。

Although all 5,000 users are not expected to login and use the mobile app simultaneously, I plan to test that scenario. 尽管不希望所有5,000个用户同时登录和使用移动应用程序,但我计划测试该方案。

From the information available online, I have seen that usually, only a handful number of users are used to test using multiple thread group and/or reducing the ramp-up period (thereby increasing concurrency). 从在线可用信息中,我已经看到通常只有少数用户使用多线程组和/或减少启动周期(从而增加并发性)进行测试。 However in my case, each time the user logs in, a new authtoken is generated. 但是就我而言,每次用户登录时,都会生成一个新的身份验证令牌。 Therefore, if the same user is logged in concurrently (in jmeter), one of them fail to log in. 因此,如果同一用户同时登录(使用jmeter),则其中之一将无法登录。

In such a scenario, do I "have" to create 5,000 users to be able to test them using the app concurrently, or is there another way. 在这种情况下,我是否“必须”创建5,000个用户以能够同时使用该应用程序对其进行测试,或者还有另一种方法。

Thanks for the help! 谢谢您的帮助!

If your test scenario is to simulate 5000 users and 2 users having the same username cannot be logged in, you will have to create 5000 users in your system and simulate them all using JMeter. 如果您的测试场景是模拟5000个用户,并且2个具有相同用户名的用户无法登录,则必须在系统中创建5000个用户并使用JMeter模拟所有用户。 In that case consider following recommendations from JMeter Performance and Tuning Tips guide 在这种情况下,请考虑遵循《 JMeter性能和调优技巧》指南中的建议

However this is not something usually required. 但是,这通常不是必需的。 Let's imagine that you have 5000 users online. 假设您有5000个在线用户。 It doesn't necessarily mean that all 5000 will send simultaneous requests. 这并不一定意味着所有5000个请求都会同时发送请求。 Real life users need to "think" some time before doing next action. 现实生活中的用户需要“思考”一段时间后再执行下一步操作。 Besides you need to consider time for page to load as well. 此外,您还需要考虑页面加载的时间。 For example: 例如:

  • each of 5000 users thinks 15 seconds between operations 每5000个用户认为两次操作之间间隔15秒
  • page load time is 5 seconds 页面加载时间为5秒
  • so individual user will execute 60 / (15 + 5) = 3 requests per minute 因此单个用户每分钟将执行60 /(15 + 5)= 3个请求
  • for 5000 users it will be 5000 * 3 = 15000 requests per minute 对于5000个用户,这将是每分钟5000 * 3 = 15000个请求
  • 15000 requests per minute = 250 requests per second. 每分钟15000个请求=每秒250个请求。

So you should be able to simulate 5000 online users using only 250 concurrent unique virtual users. 因此,您应该能够仅使用250个并发唯一虚拟用户来模拟5000个在线用户。 You can configure JMeter to send exact 250 requests per second using Constant Throughput Timer 您可以使用恒定吞吐量计时器将JMeter配置为每秒精确发送250个请求

您希望并发用户使用一个特定的URL还是整个用例?如果其URL同步计时器可能对您有帮助

If you want your test to be legit you need the same amount of dummy user in the database as the requests. 如果要使测试合法,则在数据库中需要与请求相同数量的虚拟用户。

Dmitri T is right about the figures. 德米特里T对数字正确。

In the end 250 request would require 250 dummy users. 最后,250个请求将需要250个虚拟用户。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM