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.

貢獻者指南