简体   繁体   English

JMeter的“循环计数”行为

[英]JMeter's 'loop count' behavior

This is related to JMeter's loop count behaviour. 这与JMeter的循环计数行为有关。

For the first time I am using JMeter to load test my new web application. 这是我第一次使用JMeter对新的Web应用程序进行负载测试。
To start with I have configured JMeter to access a simple xhtml page (home.xhtml). 首先,我已经配置JMeter来访问一个简单的xhtml页面(home.xhtml)。

Load configuration in JMeter: 
Number of threads (users): 100
Ramp-Up period (in seconds): 1
Loop count: 100

With the above configuration, I am trying to simulate 100 users accessing the home page URL 100 times each. 通过以上配置,我试图模拟100 users访问首页URL的情况,每个100 users访问100次。 I am expecting this to simulate a test condition where 100 browser windows are opened by 100 different users and each user accesses the URL 100 times each with the same browser window . 我期望这可以模拟一个测试条件,其中100个不同的用户打开100个浏览器窗口,并且每个用户使用with the same browser window访问URL 100次。 So, this should have ideally created 100 sessions only. 因此,理想情况下,应该只创建100个会话。 But in the heap dump at the end of the test, I notice that there were 10,000 (100 x 100) sessions objects. 但是在测试结束时的堆转储中,我注意到有10,000(100 x 100)个会话对象。

Session instance's class: org.apache.catalina.session.StandardSession 会话实例的类: org.apache.catalina.session.StandardSession

This behavior causes heap out of memory error on the Tomcat JVM at higher loads (say 1000 users with loop count of 1000). 此行为导致负载较高(例如,1000个用户的循环计数为1000)时,Tomcat JVM上的堆内存不足错误。 During my tests, the old gen of the heap (monitored using VisualGC tool that comes with JDK) continues to grow to result in heap out of memory error eventually. 在我的测试期间,堆的旧生成器(使用JDK附带的VisualGC工具进行监视)继续增长,最终导致堆内存不足错误。

Software used: 使用的软件:

Tomcat 7.0.47
JSF 2.2 (Mojarra 2.1.6)
PrimeFaces 4.0
JMeter 2.11 (To create the load)
VisualVM (To monitor memory consumption & take heap dump)
Eclipse Memory Analysis Tool (MAT) 1.3 – Used to analyse the heap.

My inference from the heap analysis: As I am seeing 10,000 session instances in the heap, I am inferring that JMeter is simulating 10,000 users with my above configuration instead of simulating 100 users with 100 URL access each. 我从堆分析得出的推论:当我在堆中看到10,000个会话实例时,我推断JMeter正在使用上述配置模拟10,000个用户,而不是模拟每个100个具有100个URL访问的用户。

Question : Is JMeter's this loop count behaviour expected or am I missing something? 问题 :JMeter的this循环计数行为是预期的还是我缺少什么?

If you don't add an HTTP Cookie Manager , then each request will be seen as a different User by server. 如果您未添加HTTP Cookie Manager ,则每个请求将被服务器视为不同的用户。

To simulate 100 VUs, just add a Cookie Manager to your Test Plan and it will do it. 要模拟100个VU,只需在测试计划中添加一个Cookie管理器即可。

Each "VU" will be looping 100 times. 每个“ VU”将循环100次。

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

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