I'm having trouble understanding how to configure Akka HTTP (version 2.4.11) to accept more than about 130 concurrent connections. My minimal test case is this example from the docs, in which I've tried to set relevant configuration options:
import akka.actor.ActorSystem
import akka.http.scaladsl.Http
import akka.http.scaladsl.model._
import akka.http.scaladsl.server.Directives._
import akka.stream.ActorMaterializer
import com.typesafe.config.ConfigFactory
import scala.io.StdIn
object WebServer {
def main(args: Array[String]) {
val parallel = 1024
implicit val system = ActorSystem("my-system", ConfigFactory.parseString(
s"""
|akka {
| http {
| server {
| backlog = $parallel
| pipelining-limit = $parallel
| }
|
| host-connection-pool {
| max-connections = $parallel
| max-open-requests = $parallel
| max-connections = $parallel
| }
| }
|}
""".stripMargin))
implicit val materializer = ActorMaterializer()
// needed for the future flatMap/onComplete in the end
implicit val executionContext = system.dispatcher
val route =
path("hello") {
get {
complete(HttpEntity(ContentTypes.`text/html(UTF-8)`, "<h1>Say hello to akka-http</h1>"))
}
}
val bindingFuture = Http().bindAndHandle(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
}
}
I'm testing it with ab
(on Mac OS X with a 4 GHz Intel Core i7):
$ ab -n 2000 -c 150 http://localhost:8080/hello
This is ApacheBench, Version 2.3 <$Revision: 1706008 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient)
apr_socket_recv: Connection reset by peer (54)
When the value of -c
is greater than about 130, I always get Connection reset by peer
immediately, regardless of the configuration options above.
What am I missing?
On 30 November 2016 at 17:25:08, Benjamin Geer (benjam...@gmail.com) wrote:
After more investigation, it appears that this is a Mac OS X kernel configuration issue, not an Akka issue.
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+...@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.