javascalaakkaakka-http

Akka-Http per server instance configuration


I have multiple akka-http server instances running on different ports as part of the same jvm process. The server instances have different performance requirements and need to be configured differently.

Is it possible to configured them on a per-instance basis.

I Could find nothing in the official docs, nor anywhere else.

https://doc.akka.io/docs/akka-http/current/configuration.html


Solution

  • The ServerBuilder returned by Http#newServerAt can be configured with different ServerSettings using withSettings or adaptSettings, either modifying programatically or loading a whole new block from config using ServerSettings#apply(Config) and separate materializers (that can have further separate settings for default dispatcher etc) using withMaterializer.