Load Balancing akka-http

Viewed 1860


I am using akka-http, my build.sbt configuration is:

scalaVersion := "2.11.7"
libraryDependencies += "com.typesafe.akka" % "akka-actor_2.11" % "2.4.2"
libraryDependencies += "com.typesafe.akka" % "akka-http-experimental_2.11" % "2.4.2"
libraryDependencies += "com.typesafe.akka" % "akka-http-spray-json-experimental_2.11" % "2.4.2"
libraryDependencies += "com.typesafe.akka" % "akka-slf4j_2.11" % "2.4.2"

I am exposing a simple REST api with only one GET url
foo is a function that returns a Future

implicit val actorSystem = ActorSystem("system", config)
implicit val actorMaterializer = ActorMaterializer()

val route: Route = {
  get {
    path("foo") {
      complete { foo }
    }
  }
}

The web-service is expected to have a lot of calls, and I want to make the service redundant in case of failure, so I want to have two instances running simultaneously to handle all the requests.

1) what is the best way to have two intances of the web-service handling the requests simultaneously?, with an external load balancer or with some magic (wich I don't know) inside akka/akka-http ?

2) What are the principal parameters I have to tune up to improve perfomance?

1 Answers
Related