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

Expose the ability to set HTTP and TCP keepalives on dynamic backends. #140

Merged
merged 5 commits into from
Sep 10, 2024

Conversation

acw
Copy link
Contributor

@acw acw commented Sep 5, 2024

No description provided.

fsthttp/backend.go Outdated Show resolved Hide resolved
fsthttp/backend.go Outdated Show resolved Hide resolved
acw and others added 2 commits September 5, 2024 14:15
Co-authored-by: Ulyssa <git@ulyssa.dev>
Co-authored-by: Ulyssa <git@ulyssa.dev>
Copy link
Member

@dgryski dgryski left a comment

Choose a reason for hiding this comment

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

Naming tweaks.

@@ -311,6 +311,52 @@ func (b *BackendOptions) PoolConnections(poolingOn bool) *BackendOptions {
return b
}

// HttpKeepaliveTime configures how long to allow HTTP connections to remain
// idle in a connection pool before it should be considered closed.
func (b *BackendOptions) HttpKeepaliveTime(time time.Duration) *BackendOptions {
Copy link
Member

Choose a reason for hiding this comment

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

Do we want HTTP instead of Http ?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 107ec31!


// TcpKeepaliveEnable sets whether or not to use TCP keepalives to try to
// maintain the connetion to the backend.
func (b *BackendOptions) TcpKeepaliveEnable(enable bool) *BackendOptions {
Copy link
Member

Choose a reason for hiding this comment

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

Naming: TCP vs Tcp

Copy link
Collaborator

Choose a reason for hiding this comment

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

random hit says yes: https://pkg.go.dev/github.com/m-lab/tcp-info/tcp uses TCP

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 107ec31!

@acw acw requested a review from dgryski September 9, 2024 17:05
Copy link
Member

@dgryski dgryski left a comment

Choose a reason for hiding this comment

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

One question about keepalives probe, but otherwise LGTM.

}

func (b *BackendConfigOptions) TCPKeepaliveProbes(count uint32) {
if count > 0 {
Copy link
Member

Choose a reason for hiding this comment

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

Count is a uint32 and so always >= 0. Do we want to handle the 0 case too like with KeepaliveEnable or use 0 to disable this option after previously setting it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have a little bit of hesitation about using 0 to unset (I just don't like special values like that), but yes, that's a possibility. Basically, using 0 here would return this value to being the default for the system. If you wanted to turn probes off, you'd still need to unset KeepaliveEnable.

@acw acw merged commit 8a5d69d into main Sep 10, 2024
11 checks passed
@acw acw deleted the awick/keepalive-dbe-flags branch September 10, 2024 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants