Skip to content

Reuse keepalive HTTP transports - #59

Merged
jiegec merged 1 commit into
z4yx:masterfrom
marvil6:perf/reuse-keepalive-transports
Oct 2, 2026
Merged

jiegec merged 1 commit into
z4yx:masterfrom
marvil6:perf/reuse-keepalive-transports

Conversation

@marvil6

@marvil6 marvil6 commented Oct 1, 2026

Copy link
Copy Markdown

Create one HTTP client per address family for each keepalive run. Reuse those clients for periodic HEAD requests, then stop the IPv6 worker and close idle connections on exit. Tests cover IPv4 and IPv6 over HTTP and HTTPS, forced network selection, and worker shutdown.

Verification: go test ./..., go vet ./..., 100 repeated targeted test runs, 20 full race-detector runs, and Linux/macOS/Windows builds pass. In a five-run local benchmark, median HTTPS request time fell from 1.52 ms to 37 µs; each 500-request reused-transport run opened one connection instead of 500 (loopback measurements).

Fixes #58

Comment thread cli/keepalive_test.go Outdated

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please drop this test.

Comment thread cli/main.go
&cli.BoolFlag{Name: "daemonize", Aliases: []string{"D"}, Usage: "run without reading username/password from standard input; less log"},
&cli.BoolFlag{Name: "debug", Usage: "print debug messages"},
&cli.BoolFlag{Name: "help, h", Usage: "print the help"},
&cli.BoolFlag{Name: "help", Aliases: []string{"h"}, Usage: "print the help"},

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please rebase.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Sorry, you're right!

@marvil6
marvil6 force-pushed the perf/reuse-keepalive-transports branch from 5ec3bf2 to b8dc88e Compare October 2, 2026 01:21
@jiegec
jiegec merged commit 4f5c7c5 into z4yx:master Oct 2, 2026
2 checks passed
@marvil6
marvil6 deleted the perf/reuse-keepalive-transports branch October 2, 2026 02:01
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.

Keepalive creates a new HTTP transport for every request

2 participants