5
Performace test
Calvin edited this page 2013-11-14 01:37:15 +08:00
This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Sytem Test其实包含了性能测试, 过载测试 , 稳定性测试等,因为可以使用同一套环境/工具/脚本,所以一块讨论。

测试工具

我心目中完美的测试工具是这样的:

  • 既可以做Client,也可以做外部Sever模拟器。
  • 良好的支持Http/SOAP/REST,也容易扩展到其他协议如SIP,Diameter。
  • 性能要好。
  • 脚本可动态修改,不需要编译打包的过程。
  • 脚本最好能重用项目中的java类库。

可惜没有完美的方案:

  • Client端随大流用JMeteer, 见JMeter,日后可以看看Gatling,用Scala DSL编写脚本。
  • Sever模拟器端开始尝试用Node.js,见Node.js。

测试监控

在性能调优时,要找出瓶颈便需要了解某些具体方法调用消耗的时间,在众多选择中,选择了Java Simon,详见JavaSimon。

另外还有很多外部工具、命令来即时监控系统资源情况,Java的线程阻塞,堆内存等,不罗嗦了。

对于长期运行的稳定性测试,需要长期监控系统资源状态变化,推荐使用Nagios

SpringSide-Test中的Benchmark框架

有时候需要编写代码压测某样东西的性能,需要多线程的起停,等待控制,需要打印进度和结果。springside-test封装了一个主体基类,一个任务基类,在showcase中的redis各种demo都是基于这个框架。