Baton是一个用Go编写的HTTP 负载测试工具,目前支持GET、POST、PUT和DELETE请求。
安装$goget-ugithub.com/americanexpress/baton使用目前支持以下选项
-bstringBody(useinsteadof-f)-cintNumberofconcurrentrequests(default1)-fstringFilepathtofiletobeusedasthebody(useinsteadof-b)-iIgnoreTLS/SSLcertificatevalidation-mstringHTTPMethod(GET,POST,PUT,DELETE)(default"GET")-oSupressoutput,noresultswillbeprintedtostdout-rintNumberofrequests(useinsteadof-t)(default1)-tintDurationoftestinginseconds(useinsteadof-r)-ustringURLtorunagainst-wintNumberofsecondstowaitbeforerunningtest-zstringReadrequestsfromafile下面是使用10个终端发送200,000个请求的基本示例:
$baton-uhttps://localhost:8080/test-c10-r200000
可以指定发送请求的时间(以秒为单位),而不是请求的数量,Baton会等收到所有响应之后才报告结果。
请求文件如果从-zfilename指定加载请求的文件,文件必须为CSV格式。
<method>,<url>,[<body>],[<header-key>:<header-value>,...]...可以在末尾有一个或多个标题,用 , 隔开,比如:
POST,https://localhost:8888,body,Accept:application/xml,Content-type:SecretGET,https://localhost:8888,,,输出示例======================Results======================Totalrequests:1254155Timetakentocompleterequests:10.046739294sRequestspersecond:124832Maxresponsetime(ms):440Minresponsetime(ms):55Avgresponsetime(ms):156.70=====================Breakdown=====================Numberofconnectionerrors:0Numberof1xxresponses:0Numberof2xxresponses:1254155Numberof3xxresponses:0Numberof4xxresponses:0Numberof5xxresponses:0=====================================================
评论