ApacheJMeter 吞吐量整形计时器性能非常差
ApacheJMeter Throughput Shaping Timer very bad performance
我正在使用 ApacheJMeter 的吞吐量整形计时器插件对自适应应用程序进行动态压力测试(应用程序会在资源需求变化时改变其行为)。
我的配置(见附件)如下:
seconds 0 - 4 : ramp up to 1000 requests per second (RPS)
seconds 5 - 14 : 1000 RPS
seconds 15 - 19 : ramp up to 5000 RPS
seconds 20 - 29 : 5000 RPS
seconds 30 - 34 : ramp up to 15000 RPS
seconds 35 - 44 : 15000 RPS
seconds 45 - 49 : ramp down to 5000 RPS
seconds 50 - 59 : 5000 RPS
seconds 60 - 64 : ramp down to 1000 RPS
seconds 65 - 74 : 1000 RPS
seconds 75 - 79 : ramp down to 0 RPS
为了执行测试,我在具有 16 个内核(每个 3GHz)和 32GB RAM 的 Ubuntu 18 LTS 上使用以下命令:
$ jmeter/bin/jmeter -n -t ~/JMeterTests/.jmx -l ~/TestResults/.jtl
不幸的是,当我开始测试时,CPU 使用率立即飙升至 100%,请求产生了许多错误:
这里肯定有问题,因为我在这台机器上使用 JMeter 发送 10000 RPS,甚至没有达到 10% CPU 使用率。我不知道哪里出了问题 - 谁能帮忙?
测试文件在附件3中。
非常感谢。
您在终极线程组中只定义了 300 个线程(虚拟用户)。
这意味着只有在响应时间为 20 毫秒或更短的情况下,您才能在 300 个用户的情况下达到每秒 15000 个请求。
从您的总结器中我可以看到平均响应时间为 55 毫秒,最大响应时间为 876 毫秒,这意味着这 300 个用户绝对不够,即使假设被测系统能够每秒处理该数量的请求.
所以建议是:
- 确保遵循 JMeter Best Practices
- 如果需要,请迁移到 Concurrency Thread Group which can kick off extra threads if current amount is not enough to reach/maintain the desired throughput, it can be connected with the Throughput Shaping Timer via Feedback Function, check out Using JMeter’s Throughput Shaping Timer Plugin 文章以获取更多详细信息。
- 您在这台机器上使用 JMeter 并且每秒有 10k 个请求用于 不同 测试并不一定意味着您将能够每秒产生 10k 个请求测试和未来的测试,这是 JMeter 配置、OS 配置、测试计划详细信息等的问题。
正如 this Article and this 指出的那样,通过更改 linux 配置中的以下参数解决了该问题:
a) Increased the local port range using below command:
echo 1024 65000 > /proc/sys/net/ipv4/ip_local_port_range
b) Enable reuse of sockets as below:
sudo sysctl -w net.ipv4.tcp_tw_reuse=1
请注意,应考虑 Dmitri T. 上面给出的提示。将并发线程组与反馈功能结合使用有利于整个测试计划。
接下来,对配置所做的更改对于生产系统来说可能不健康。我不能就此发表任何有根据的声明。
最后,请注意,您必须在分布式测试环境中的所有测试服务器中应用配置更改。
编辑:
另外注意,配置后用户的最大值还是有限制的,只是比之前高了一点。
我正在使用 ApacheJMeter 的吞吐量整形计时器插件对自适应应用程序进行动态压力测试(应用程序会在资源需求变化时改变其行为)。
我的配置(见附件)如下:
seconds 0 - 4 : ramp up to 1000 requests per second (RPS)
seconds 5 - 14 : 1000 RPS
seconds 15 - 19 : ramp up to 5000 RPS
seconds 20 - 29 : 5000 RPS
seconds 30 - 34 : ramp up to 15000 RPS
seconds 35 - 44 : 15000 RPS
seconds 45 - 49 : ramp down to 5000 RPS
seconds 50 - 59 : 5000 RPS
seconds 60 - 64 : ramp down to 1000 RPS
seconds 65 - 74 : 1000 RPS
seconds 75 - 79 : ramp down to 0 RPS
为了执行测试,我在具有 16 个内核(每个 3GHz)和 32GB RAM 的 Ubuntu 18 LTS 上使用以下命令:
$ jmeter/bin/jmeter -n -t ~/JMeterTests/.jmx -l ~/TestResults/.jtl
不幸的是,当我开始测试时,CPU 使用率立即飙升至 100%,请求产生了许多错误:
这里肯定有问题,因为我在这台机器上使用 JMeter 发送 10000 RPS,甚至没有达到 10% CPU 使用率。我不知道哪里出了问题 - 谁能帮忙?
测试文件在附件3中。
非常感谢。
您在终极线程组中只定义了 300 个线程(虚拟用户)。
这意味着只有在响应时间为 20 毫秒或更短的情况下,您才能在 300 个用户的情况下达到每秒 15000 个请求。
从您的总结器中我可以看到平均响应时间为 55 毫秒,最大响应时间为 876 毫秒,这意味着这 300 个用户绝对不够,即使假设被测系统能够每秒处理该数量的请求.
所以建议是:
- 确保遵循 JMeter Best Practices
- 如果需要,请迁移到 Concurrency Thread Group which can kick off extra threads if current amount is not enough to reach/maintain the desired throughput, it can be connected with the Throughput Shaping Timer via Feedback Function, check out Using JMeter’s Throughput Shaping Timer Plugin 文章以获取更多详细信息。
- 您在这台机器上使用 JMeter 并且每秒有 10k 个请求用于 不同 测试并不一定意味着您将能够每秒产生 10k 个请求测试和未来的测试,这是 JMeter 配置、OS 配置、测试计划详细信息等的问题。
正如 this Article and this
a) Increased the local port range using below command:
echo 1024 65000 > /proc/sys/net/ipv4/ip_local_port_range
b) Enable reuse of sockets as below:
sudo sysctl -w net.ipv4.tcp_tw_reuse=1
请注意,应考虑 Dmitri T. 上面给出的提示。将并发线程组与反馈功能结合使用有利于整个测试计划。 接下来,对配置所做的更改对于生产系统来说可能不健康。我不能就此发表任何有根据的声明。 最后,请注意,您必须在分布式测试环境中的所有测试服务器中应用配置更改。
编辑:
另外注意,配置后用户的最大值还是有限制的,只是比之前高了一点。