运行大量线程时出现 JMeter 问题 [英] JMeter issues when running large number of threads

查看:18
本文介绍了运行大量线程时出现 JMeter 问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Apache 的 Jmeter 进行测试,我只是访问我公司网站的一页并增加用户数量直到达到阈值,问题是当我达到大约 3000 个线程时 JMeter 没有运行所有这些.查看聚合图它只运行了大约 2,536 个(这个数字有所不同,但始终在此附近).

I'm testing using Apache's Jmeter, I'm simply accessing one page of my companies website and turning up the number of users until it reaches a threshold, the problem is that when I get to around 3000 threads JMeter doesn't run all of them. Looking at the Aggregate Graph it only runs about 2,536 (this number varies but is always around here) of them.

部分运行在日志中出现以下异常:

The partial run comes with the following exception in the logs:

01:16 ERROR - jmeter.JMeter: Uncaught exception: 
java.lang.OutOfMemoryError: unable to create new native thread
    at java.lang.Thread.start0(Native Method)
    at java.lang.Thread.start(Unknown Source)
    at org.apache.jmeter.threads.ThreadGroup.start(ThreadGroup.java:293)
    at org.apache.jmeter.engine.StandardJMeterEngine.startThreadGroup(StandardJMeterEngine.java:476)
    at org.apache.jmeter.engine.StandardJMeterEngine.run(StandardJMeterEngine.java:395)
    at java.lang.Thread.run(Unknown Source)

这种行为是一致的.此外,有一次 JMeter 在输出一个文件时在中间崩溃:

This behavior is consistent. In addition one of the times JMeter crashed in the middle outputting a file that said:

# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (malloc) failed to allocate 32756 bytes for ChunkPool::allocate
# Possible reasons:
#   The system is out of physical RAM or swap space
#   In 32 bit mode, the process size limit was hit
# Possible solutions:
#   Reduce memory load on the system
#   Increase physical memory or swap space
#   Check if swap backing store is full
#   Use 64 bit Java on a 64 bit OS
#   Decrease Java heap size (-Xmx/-Xms)
#   Decrease number of Java threads
#   Decrease Java thread stack sizes (-Xss)
#   Set larger code cache with -XX:ReservedCodeCacheSize=
# This output file may be truncated or incomplete.
#
#  Out of Memory Error (allocation.cpp:211), pid=10748, tid=11652
#
# JRE version: 6.0_31-b05
# Java VM: Java HotSpot(TM) Client VM (20.6-b01 mixed mode, sharing windows-x86 )

有什么想法吗?
我尝试在 jmeter.bat 中更改堆大小,但这似乎根本没有帮助.

Any ideas?
I tried changing the heap size in jmeter.bat, but that didn't seem to help at all.

推荐答案

JVM 根本无法运行这么多线程.而且即使是这样,JMeter 也会消耗大量 CPU 资源来进行纯粹的上下文切换.换句话说,在某些时候,您不是在对 Web 应用程序进行基准测试,而是对托管 JMeter 的客户端计算机进行基准测试.

JVM is simply not capable of running so many threads. And even if it is, JMeter will consume a lot of CPU resources to purely switch contexts. In other words, above some point you are not benchmarking your web application but the client computer, hosting JMeter.

你有几个选择:

  • 使用 JVM 选项进行实验,例如减少默认-Xss512K到更小的东西

在集群中运行JMeter

使用采用完全不同方法的工具,例如 Gatling

use tools taking radically different approach like Gatling

这篇关于运行大量线程时出现 JMeter 问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆