Best Practices

http://jmeter.apache.org/usermanual/best-practices.html

1. 设置合理的并发数

参见16.1 Limit the Number of Threads,主要结论如下:

  1. 在测试中要设置合理的并发数,避免JMeter成为吞吐量的瓶颈。硬件性能、服务器处理速度都对JMeter本身性能有影响
  2. 需要大规模压力测试,最好使用非图形界面下的JMeter集群。If you need large-scale load testing, consider running multiple non-GUI JMeter instances on multiple machines.
  3. 跑JavaTest Sampler来测试客户端服务器支持的最大吞吐。For testing how JMeter performs on a given platform, the JavaTest sampler can be used. It does not require any network access so can give some idea as to the maximum throughput achievable.

2. 降低JMeter对资源的消耗

参见16.6 Reducing resource requirements,主要结论如下:

  1. Use non-GUI mode: jmeter -n -t test.jmx -l test.jtl
  2. Use as few Listeners as possible; if using the -l flag as above they can all be deleted or disabled.
  3. 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.
  4. Use CSV output rather than XML.
  5. Use Input data with CSV Dataset. This avoids wasting resources at run-time.

MainWiki: JMeter/Best_Practices (last edited 2013-07-18 21:29:57 by twotwo)