Skip to content

observer: Reduce memory usage#8649

Open
beautifulentropy wants to merge 1 commit intomainfrom
observer-memory-reduction
Open

observer: Reduce memory usage#8649
beautifulentropy wants to merge 1 commit intomainfrom
observer-memory-reduction

Conversation

@beautifulentropy
Copy link
Member

@beautifulentropy beautifulentropy commented Feb 26, 2026

Reuse shared HTTP clients and transports instead of initializing a new client for every probe request, and close HTTP response bodies in CRL, HTTP, and TLS probers.

These changes line up well with the heap and goroutine profiles, which show net/http transport churn and a large number of net/http.(*persistConn).readLoop / writeLoop goroutines accumulating, consistent with connections and associated transport buffers not being closed promptly.

Fixes #8650

@beautifulentropy beautifulentropy marked this pull request as ready for review February 26, 2026 19:09
@beautifulentropy beautifulentropy requested a review from a team as a code owner February 26, 2026 19:09
@beautifulentropy beautifulentropy force-pushed the observer-memory-reduction branch from 31584ef to aec1a8f Compare February 26, 2026 19:22
Copy link
Contributor

@aarongable aarongable left a comment

Choose a reason for hiding this comment

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

It makes me slightly nervous to have a shared client, if some future prober wants to modify that client before using it. But today every call is merely obsclient.Client().Do(), so it works for now.

@aarongable aarongable requested a review from jsha February 26, 2026 22:02
Copy link
Contributor

@jsha jsha left a comment

Choose a reason for hiding this comment

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

Optional: since we have objects to attach them to (CRLProbe, HTTPProbe), it would be a little nicer to create the client at object creation time and store it as a field, instead of using globals.

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.

Observer memory usage is a little higher than we expect

3 participants