Consul HTTP checks disable keepalive
- Dominant language
- Go
- Stars
- 30.1k
- Forks
- 4.6k
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 39
Description
We log all incoming connections to our service and noticed that the consul agent creates a new TCP connection for every HTTP healthcheck interval
Looking we saw this commit from 2015 explicitly disables keepalive
https://github.com/hashicorp/consul/commit/952ec284a438487be2973a4a7ad991b98fd19797?branch=952ec284a438487be2973a4a7ad991b98fd19797&diff=split
There appears to be no pull request attached with details on why, and the comment reads
```
Create the transport. We disable HTTP Keep-Alive's to prevent
failing checks due to the keepalive interval.
```
Which doesn't quite make sense to me.
This seems pretty wasteful - health checks are going to happen very often and to the same destination, so why create a new TCP connection each time?
I could send a PR to delete this code but I would like to try to understand the comment that says it is necessary. Why would the health check fail at keepalive timeout? It should simply reconnect.
Contributor guide
Research direction
Start by inspecting the 2015 commit linked in the issue and the current Consul HTTP health-check transport code. Determine why keep-alive was disabled and whether reusing connections can avoid failed checks; done means documenting the reason or making the behavior safe and verifying the health-check results.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100