17.7 Reducing resource requirements

Some suggestions on reducing resource usage.

  • Use non-GUI mode: jmeter -n -t test.jmx -l test.jtl
    使用NON-GUI模式(命令行模式):jmeter -n -t test.jmx -l test.jtl
  • Use as few Listeners as possible; if using the -l flag as above they can all be deleted or disabled.
  • Don't use "View Results Tree" or "View Results in Table" listeners during the load test, use them only during scripting phase to debug your scripts.
    在性能测试期间不要使用Listener 中的"View Results Tree" 和 "View Results in Table",只有在debug脚本的时候使用他们。
  • Rather than using lots of similar samplers, use the same sampler in a loop, and use variables (CSV Data Set) to vary the sample. [The Include Controller does not help here, as it adds all the test elements in the file to the test plan.]
    不要使用大量的相似samplers,而是循环使用一个sampler,使用参数化来达到不同sample的效果。(Include Controller 也不能解决什么问题,他只是将其中的sample添加到test plan而已)
  • Don't use functional mode
    不要使用函数模式(乌鸦注:应该指的是Option-Function helper,尽量不要使用这种模式)
  • Use CSV output rather than XML
  • Only save the data that you need
  • Use as few Assertions as possible
  • Use the most performing scripting language (see JSR223 section)
  • If your test needs large amounts of data - particularly if it needs to be randomised - create the test data in a file that can be read with CSV Dataset. This avoids wasting resources at run-time.
    如果你的测试需要大量的测试数据,提前创建测试数据保存到文件里,通过csv data set读取数据。这样可以节省运行时的资源