标签:style blog http io ar color 使用 sp for
Gatling是一款开源的压力测试工具,基于Scala, Akka and Netty。
示例脚本:
import scala.concurrent.duration._ import io.gatling.core.Predef._ import io.gatling.http.Predef._ import io.gatling.jdbc.Predef._ class RecordedSimulation extends Simulation { val httpProtocol = http .baseURL("http://192.168.1.117/") .acceptHeader("""*/*""") .acceptEncodingHeader("""gzip, deflate""") .acceptLanguageHeader("""zh-CN""") .userAgentHeader("""Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)""") val headers_2 = Map("""Accept""" -> """text/html, application/xhtml+xml, */*""") val scn = scenario("RecordedSimulation") .repeat(1){ //.forever{ feed(csv("large_files.csv").circular) .exec(http("request_"+"${id}") .get("${uri}") .headers(headers_2) //.check(status.is(200))) .check(status.in(200 to 399))) .pause(1) } setUp( scn.inject(atOnceUsers(1000)) ) .protocols(httpProtocol) }
large_files.csv默认放在user-files/data/下面
文件内容:
id,uri
1,index.html
2,download/file.zip
标签:style blog http io ar color 使用 sp for
原文地址:http://www.cnblogs.com/rd-log/p/4103746.html