JMeter在垃圾回收时的响应时间行为

huangapple go评论71阅读模式
英文:

JMeter behaviour on response time while garbage collecting

问题

我目前正在尝试理解JMeter的垃圾回收如何影响报告的响应时间。

我可以通过下面的图表来表示我的思路:

从JMeter到example.org的HTTP请求 --> JMeter在响应之前执行GC --> GC结束 --> 从example.org接收响应

JMeter如何处理这个情况?GC时间是否会被添加到响应时间中?在收到响应后,GC时间是否会从响应时间中减去?

如果GC时间被添加,这意味着G1GC算法会频繁发生,但暂停时间很短,会影响90百分位响应时间。但ConcurrentMarkSweep会造成较少但更长的暂停,不会真正影响90百分位(对我来说更可接受)。

非常感谢!保重!

Romain

英文:

I'am currently trying to understand how JMeter's Garbage collection affects the response time reported.

I can represent my though by the graph below

HTTP Request from JMeter to example.org --> JMeter perform a GC before the response --> End of GC --> Receiving response from example.org

How does JMeter handle this ? Does the GC time is added to the response time ? GC time is subtracted to the response time after the response is received ?

If the GC time is added, it means that G1GC Algorithm which occur frequently but with short pauses will affect 90 percentile response time. But ConcurrentMarkSweep will make fewer but longer pauses without really affecting 90 percentile (which is more acceptable for me).

Thanks a lot
Take care

Romain

答案1

得分: 1

根据JMeter词汇表

>经过时间。 JMeter从发送请求之前到收到最后响应之后测量经过的时间。

因此,如果在JVM卡住的同时发生了主要的GC,JMeter将无法收到响应,因此在GC中花费的时间将被添加到总体经过时间中。

您可以查看使用JMeter进行并发、高吞吐量性能测试的文章,其中有人的吞吐量出现了波动:

JMeter在垃圾回收时的响应时间行为

在切换到CMS GC之后,他得到了以下结果:

JMeter在垃圾回收时的响应时间行为

因此,请确保:

  1. 遵循来自解决JMeter负载测试“内存不足”失败的9种简单方法文章的建议。
  2. 使用例如JVisualVM监视堆使用情况,JMeter应该使用30%到80%的可用堆大小,这样垃圾收集的次数应该较少。
  3. 如果您无法产生稳定的负载模式,这意味着单个负载发生器不足,您将不得不采用分布式测试
英文:

As per JMeter Glossary

>Elapsed time. JMeter measures the elapsed time from just before sending the request to just after the last response has been received.

So if a major GC will happen while JVM is stuck JMeter won't receive the response hence the time spent in GC will be added to the overall elapsed time.

You can look at Concurrent, High Throughput Performance Testing with JMeter article where the guy was getting spikes in the throughput like:

JMeter在垃圾回收时的响应时间行为

and after switching to the CMS GC he got the following:

JMeter在垃圾回收时的响应时间行为

So make sure to:

  1. Follow recommendations from 9 Easy Solutions for a JMeter Load Test “Out of Memory” Failure article
  2. Monitor heap usage using i.e. JVisualVM, JMeter should consume from 30% to 80% of available heap size, this way the number of garbage collections should be less
  3. If you won't be able to produce a steady load pattern it means that the single load generator is not enough and you will have to go for Distributed Testing

huangapple
  • 本文由 发表于 2020年5月5日 18:04:05
  • 转载请务必保留本文链接:https://go.coder-hub.com/61610536.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定