简体   繁体   English

对于 API 请求,无法在 Jmeter 中达到预期的事务/秒

[英]Unable to reach expected transactions/sec in Jmeter for API requests

The required transactions/sec is 5.5/sec or 20,000/hour.所需的事务/秒是 5.5/秒或 20,000/小时。 And I have 6 API request with average response time as 1 sec each.我有 6 个 API 请求,每个请求的平均响应时间为 1 秒。 Think time is 5sec between each API.每个 API 之间的思考时间为 5 秒。 By Little's Law, I should able to reach the target transaction with 30 threads.根据利特尔定律,我应该能够以 30 个线程达到目标事务。 But I'm able achieve only 6000/hour which is very less compared to my target rate.但我只能达到每小时 6000 次,这与我的目标速度相比要少得多。 Only 4-5 error as the application was down for few seconds.由于应用程序关闭了几秒钟,因此只有 4-5 错误。 Later it was up an running.后来就上路了。 CPU, Memory utilizations were good. CPU,Memory 利用率很好。 What could be the reason?可能是什么原因? Used Concurrency thread group and selected Stop Thread on Error option.使用并发线程组并选择错误时停止线程选项。

Are you sure about your "average response time as 1 sec each" because assuming your configuration with:您确定您的“平均响应时间为每个 1 秒”,因为假设您的配置为:

  • 5 seconds think time between requests请求之间的 5 秒思考时间
  • 6 API requests 6 API 请求
  • 1 second response time 1秒响应时间

it means that 1 user execute 1 request each 7 seconds which gives 514 requests per hour and 30 users will do 15420 (less than your "required" 20000 but more than 6000 you're getting)这意味着 1 个用户每 7 秒执行 1 个请求,每小时发出 514 个请求,30 个用户将执行 15420 个(小于您的“要求”20000,但您得到的超过 6000 个)

Take a look at perceived response time using Aggregate Report listener, my expectation is that you will need to adjust the thinktime because real response time is much higher.使用聚合报告侦听器查看感知响应时间,我的期望是您需要调整思考时间,因为实际响应时间要长得多。

Also be aware that you don't need to apply any "laws" or "think times", there is Throughput Shaping Timer so it's sufficient to just add it and configure like:另请注意,您不需要应用任何“法律”或“思考时间”,有吞吐量整形计时器,因此只需添加它并配置如下:

在此处输入图像描述

and it will automatically slow down JMeter threads in order to maintain the defined number of requests per second.它会自动减慢 JMeter 线程,以保持每秒定义的请求数。

Remember that the number of threads must be sufficient, the timer won't automatically add new threads if the current amount is not enough (unless you use special Feedback Function )记住线程数一定要足够,如果当前数量不够,定时器不会自动添加新线程(除非你使用特殊反馈Function

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

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