iralance / myblog

notes
0 stars 0 forks source link

压力测试 #3

Open iralance opened 7 years ago

iralance commented 7 years ago

ab

ab 无疑是目前最常见的压力测试工具

shell> ab -k -c 100 -t 10 http://domain/path

参数「c」表示的是并发,参数「t」表示的是整个测试持续的时间。一个很容易被忽视的参数是「k」,它会增加请求头 Connection: Keep-Alive,相当于开启了 HTTP 长连接,这样做一方面可以降低测试服务器动态端口被耗尽的风险,另一方面也有助于给目标服务器更大的压力,测试出更接近极限的结果。

loadrunner

是HP推出的一种预测系统行为和性能的负载测试工具,通过以模拟上千万用户实施并发负载及实时性能监测的方式来确认和查找问题,分为Windows 版本和Unix 版本。LoadRunner能够对整个企业架构进行测试。

wrk

wrk 相对于 ab 来说最大的优点是它支持多线程,这样更容易发挥多核 CPU 的能力,从而更容易测试出系统的极限能力

shell> wrk -c 100 -d 10 http://domain/path

其中,参数「c」表示的是并发,参数「d」表示的是整个测试持续的时间。此外,可以通过参数「t」来控制线程数(缺省值为 2),实际使用中可以视情况酌情增大。

如果顺着 ab 的使用惯性,你可能会纳闷为什么 wrk 没有类似参数「k」这样打开 HTTP 长链接的选项,这是因为 wrk 使用的是 HTTP/1.1,缺省开启的是长连接,而 ab 使用的是 HTTP/1.0,缺省开启的是短链接。

用 wrk 测试短链接?

shell> wrk -H "Connection: Close" -c 100 -d 10 http://domain/path

也就是说通过参数「H」传递一个自定义的 Connection 请求头来关闭长链接。

locust

An open source load testing tool. Define user behaviour with Python code, and swarm your system with millions of simultaneous users.

webench

wget http://blog.zyan.cc/soft/linux/webbench/webbench-1.5.tar.gz
tar zxvf webbench-1.5.tar.gz
cd webbench-1.5
make && make install

gatling

Async Scala-Akka-Netty based Load Test Tool

sniper

A powerful & high-performance http load tester

hey

HTTP load generator, ApacheBench (ab) replacement, formerly known as rakyll/boom

Siege

Siege is an http load tester and benchmarking utility

http_load

http_load runs multiple http fetches in parallel, to test the throughput of a web server.

vegeta

HTTP load testing tool and library. It’s over 9000!

t50

mixed packet injector tool

GoReplay

GoReplay is an open-source tool for capturing and replaying live HTTP traffic into a test environment in order to continuously test your system with real data. It can be used to increase confidence in code deployments, configuration changes and infrastructure changes.

tcpcopy

An online request replication tool, also a tcp stream replay tool, fit for real testing, performance testing, stability testing, stress testing, load testing, smoke testing, etc

gryphon

Gryphon是由网易自主研发的能够模拟千万级别并发用户的一个软件,目的是能够用较少的资源来模拟出大量并发用户,并且能够更加真实地进行压力测试, 以解决网络消息推送服务方面的压力测试的问题和传统压力测试的问题。Gryphon分为两个程序,一个运行gryphon,用来模拟用户,一个是 intercept,用来截获响应包信息给gryphon。Gryphon模拟用户的本质是用一个连接来模拟一个用户,所以有多少个连接,就有多少个用户,而用户的素材则取自于pcap抓包文件。值得注意的是,Gryphon架构类似于tcpcopy,也可以采用传统使用方式和高级使用方式。