Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

skipper: add server connection keepalive limits #3246

Merged
merged 1 commit into from
Sep 24, 2024

Conversation

AlexanderYastrebov
Copy link
Member

Clients may connect to a subset of Skipper fleet which leads to uneven request distribution and increased cpu usage.

Autoscaling of Skipper fleet is not effective because clients stay connected to old instances while new instances are underutilized.

This change adds ConnManager that tracks creation of new connections and closes connections when their age or number of requests served reaches configured limits.

@AlexanderYastrebov AlexanderYastrebov added the major moderate risk, for example new API, small filter changes that have no risk like refactoring or logs label Sep 23, 2024
@AlexanderYastrebov AlexanderYastrebov changed the title net: add server connection keepalive limits skipper: add server connection keepalive limits Sep 23, 2024
Clients may connect to a subset of Skipper fleet which leads to uneven
request distribution and increased cpu usage.

Autoscaling of Skipper fleet is not effective because clients stay
connected to old instances while new instances are underutilized.

This change adds ConnManager that tracks creation of new connections
and closes connections when their age or number of requests served
reaches configured limits.

Signed-off-by: Alexander Yastrebov <alexander.yastrebov@zalando.de>
@@ -243,6 +243,8 @@ type Config struct {
ReadHeaderTimeoutServer time.Duration `yaml:"read-header-timeout-server"`
WriteTimeoutServer time.Duration `yaml:"write-timeout-server"`
IdleTimeoutServer time.Duration `yaml:"idle-timeout-server"`
KeepaliveServer time.Duration `yaml:"keepalive-server"`
Copy link
Member Author

@AlexanderYastrebov AlexanderYastrebov Sep 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Named similar to existing keepalive-backend and *-server flags.

}

func (cm *ConnManager) connState(_ net.Conn, state http.ConnState) {
cm.count(fmt.Sprintf("lb-conn-%s", state))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 , I think this is to have the current metrics, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, moved it here

@szuecs
Copy link
Member

szuecs commented Sep 24, 2024

👍

1 similar comment
@AlexanderYastrebov
Copy link
Member Author

👍

@AlexanderYastrebov AlexanderYastrebov merged commit ce501f8 into master Sep 24, 2024
14 checks passed
@AlexanderYastrebov AlexanderYastrebov deleted the net/conn-keepalive branch September 24, 2024 13:36
AlexanderYastrebov added a commit to zalando-incubator/kubernetes-on-aws that referenced this pull request Oct 2, 2024
Add config items for server connection keepalive limits, set no limits by default.

See zalando/skipper#3246

Signed-off-by: Alexander Yastrebov <alexander.yastrebov@zalando.de>
Pushpalanka pushed a commit that referenced this pull request Oct 11, 2024
Clients may connect to a subset of Skipper fleet which leads to uneven
request distribution and increased cpu usage.

Autoscaling of Skipper fleet is not effective because clients stay
connected to old instances while new instances are underutilized.

This change adds ConnManager that tracks creation of new connections
and closes connections when their age or number of requests served
reaches configured limits.

Signed-off-by: Alexander Yastrebov <alexander.yastrebov@zalando.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
major moderate risk, for example new API, small filter changes that have no risk like refactoring or logs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants