akka/akka-http

Support maxKeepAliveRequests on akka http server

开放

#1,768 创建于 2018年1月11日

 (6 条评论) (0 个反应) (0 位负责人)Scala (598 个派生)batch import
1 - triagedhelp wantedt:coret:server

仓库指标

星标
 (1,311 个星标)
PR 合并指标
 (平均合并 1天 10小时) (30 天内合并 2 个 PR)

描述

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.

贡献者指南