JMeter - 处理大量响应

JMeter - handle large responses

我正在测试 REST API,每个 returns 一个 10 MB 的响应主体。 现在在负载测试期间,JMeter 在 20 个线程时给出 内存不足异常

得出结论,这是由于 API 具有巨大的响应体。当测试其他 API 具有相当小的响应主体时,我能够扩展到 500 个线程

已尝试所有在 hacks 下共享的选项以避免内存不足异常:

  1. 运行 在非 GUI 模式下
  2. 关闭所有侦听器 - 从命令行生成 JTL
  3. 禁用所有断言,依赖于应用程序日志
  4. Groovy 在 JSR223 中用作脚本语言,用于模拟请求之间的 Pacing
  5. 堆大小增加到 12 GB
  6. JMeter 5.4.1 和 JDK 使用

从多个 JMeter 主机进行分布式负载测试似乎也有问题,因为当我将相同的 APIs 的线程数减少到 10 时,内存不足异常仍然出现。

如何有效处理对 JMeter 发出的请求的巨大响应主体?

如果您不需要读取或断言响应,那么您可以减少磁盘 space 使用,检查 HTTP Request 高级选项卡中的 Save response as MD5 hash

Save response as MD5 hash? If this is selected, then the response is not stored in the sample result. Instead, the 32 character MD5 hash of the data is calculated and stored instead. This is intended for testing large amounts of data.