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.
    尽可能少的使用Listeners,如果像上面那样(NON-GUI模式)使用-l参数,则把Listeners删除或禁用

* 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
    结果输出使用CSV,不要用XML(乌鸦注:ant+jmeter一键测试时,要想一键生成测试报告,只能是xml)

  • Only save the data that you need
    测试结果只保存需要的数据

  • Use as few Assertions as possible
    尽量少用Assertion

  • 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读取数据。这样可以节省运行时的资源

参考:http://jmeter.apache.org/usermanual/best-practices.html#lean_mean