我在Akka-http框架(版本:10.0)上执行负载测试,我使用的是wrk工具.wrk命令:
wrk -t6 -c10000 -d 60s --timeout 10s --latency http://localhost:8080/hello
首次运行没有任何阻塞调用,
object WebServer {
implicit val system = ActorSystem("my-system")
implicit val materializer = ActorMaterializer()
implicit val executionContext = system.dispatcher
def main(args: Array[String]) {
val bindingFuture = Http().bindAndHandle(router.route, "localhost", 8080)
println(
s"Server online at http://localhost:8080/\nPress RETURN to stop...")
StdIn.readLine() // let it run until user presses return
bindingFuture
.flatMap(_.unbind()) // trigger unbinding from the port
.onComplete(_ => system.terminate()) // and shutdown when done
}
}
object router {
implicit …
Run Code Online (Sandbox Code Playgroud)