我正在使用并发线程组对我的目标运行负载测试。我还将堆大小增加到 6GB。现在,当我运行脚本时,它给出了超过 2000 个线程
Failed to start thread - pthread_create failed (EAGAIN) for attributes: stacksize: 1024k, guardsize: 4k, detached.
Uncaught Exception java.lang.OutOfMemoryError: unable to create native thread: possibly out of memory or process/resource limits reached. See log file for details.
我尝试将堆大小从 512MB 更改为 8GB,但每次都不能超过 2000 个线程
最佳答案
该错误意味着底层操作系统无法创建新线程,因此您需要调整操作系统以允许为进程/当前用户创建更多线程。
- Windows:Pushing the Limits of Windows: Processes and Threads
- Linux:How to Set Limits on User Running Processes in Linux
如果您对运行 JMeter 的计算机没有管理员/root 访问权限,则必须使用 distributed testing因为您将无法克服操作系统对进程数量的限制。修改 JMeter 的 HEAP 没有帮助。
关于java - 即使将堆大小增加到最大值后,Jmeter 也会出现超过 2000 个线程的 java.lang.OutOfMemoryError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57359063/