akka/akka-http

Support maxKeepAliveRequests on akka http server

Open

#1,768 opened on Jan 11, 2018

View on GitHub
 (6 comments) (0 reactions) (0 assignees)Scala (1,311 stars) (598 forks)batch import
1 - triagedhelp wantedt:coret:server

Description

It would be great if akka http server would provide configuration options to set maxKeepAliveRequests per connection, so that after connection served that amount of requests akka http would force connection close.

It is very useful when using load-balance, for web service, load-balance always use connection based strategy, and when new node added in, server need a chance to re-balance the load. Currently keepalive connection will be kept for ever, so there is no new connection established, on going connection can not be re-balanced.

When running in kubernetes load balancer would not see how many nodes running in the pod (they can be potentially hidden behind single cluster ip), so scaling up would be useless as traffic would not be rebalanced.

Many http server already support such option:

I tried as suggested in jetty bug to send connection close header in my route and it does work. I cannot control which exactly connection i will close with it as it is abstracted away by akka http and i`m not sure how sending connection close header will affect request pipelining.

It would be great if akka http would support such configuration option out of the box.

Contributor guide