Skip to content

Re-enable http keepalive on remote storage#3160

Merged
tomwilkie merged 2 commits intoprometheus:masterfrom
bboreham:remote-keepalive
Sep 14, 2017
Merged

Re-enable http keepalive on remote storage#3160
tomwilkie merged 2 commits intoprometheus:masterfrom
bboreham:remote-keepalive

Conversation

@bboreham
Copy link
Member

@bboreham bboreham commented Sep 11, 2017

As discussed at https://groups.google.com/d/msg/prometheus-users/CMyMtPC-Co4/vDfrsOXVAAAJ

Without this change, Prometheus is doing a DNS lookup, opening/closing a socket, etc., on every remote read or write, which may be many times per second.

I felt I should give users the option, and since I did this at the lower level this ends up relevant to #2498

@bboreham
Copy link
Member Author

Can't make out what went wrong in the Travis failure.

Copy link
Contributor

@mdlayher mdlayher left a comment

Choose a reason for hiding this comment

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

LGTM. Failure appears unrelated to me. Possibly a flaky test.

@tomwilkie
Copy link
Member

Indeed it succeed second time round.

@tomwilkie tomwilkie merged commit f66f882 into prometheus:master Sep 14, 2017
ProxyURL URL `yaml:"proxy_url,omitempty"`
// TLSConfig to use to connect to the targets.
TLSConfig TLSConfig `yaml:"tls_config,omitempty"`
// If set, override whether to use HTTP KeepAlive - scraping defaults OFF, remote read/write defaults ON
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is going to be very hard to understand for users and to explain to them, a given config stanza shouldn't mean different things in different contexts. It's also unresolved what scraping should do in relation to keepalive.

If you want to enable keepalive for remote storage you should do exactly that, without bringing additional complexity and other debates into it.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not following why you think this config means different things in different contexts. false always means you want keep-alive disabled, and true always means you want it available. Unless I made a typo?

Copy link
Contributor

Choose a reason for hiding this comment

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

No config means different things in different contexts. We don't do this anywhere else in Prometheus or the other components.

Copy link
Member Author

Choose a reason for hiding this comment

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

I made a different take on it at #3173, with no configurability.
Let me know if you revert this PR.

Copy link

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

You can’t.
If you need that feature, suggest modifying the code or open an issue explaining why you need it.

Copy link

@slayer slayer Oct 25, 2021

Choose a reason for hiding this comment

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

We have manual exporters on https://restrserve.org/ which is in forking mode (Yes, I know fork is sucks, but in R world it's commonness)
As I see prometheus do not close connection on fetching metrics and child process lives forever. At some point OOM killer come, and kill entire k8s pod.

@bboreham
Do you have idea why prometheus do not close connection by default?

UPD: As I see promethus do not send keep-alive header as well

GET /metrics HTTP/1.1
Host: 10.36.1.63:8000
User-Agent: Prometheus/2.28.1
Accept: application/openmetrics-text; version=0.0.1,text/plain;version=0.0.4;q=0.5,*/*;q=0.1
Accept-Encoding: gzip
X-Prometheus-Scrape-Timeout-Seconds: 5

bboreham added a commit to bboreham/prometheus that referenced this pull request Oct 5, 2017
Removes configurability introduced in prometheus#3160 in favour of hard-coding,
per advice from @brian-brazil.
brian-brazil pushed a commit that referenced this pull request Oct 5, 2017
Removes configurability introduced in #3160 in favour of hard-coding,
per advice from @brian-brazil.
tomwilkie pushed a commit to tomwilkie/prometheus that referenced this pull request Oct 26, 2017
… to 2.0 (see prometheus#3173)

Removes configurability introduced in prometheus#3160 in favour of hard-coding,
per advice from @brian-brazil.
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.

5 participants