consul: optimize watching of Consul checks during deployment
- Dominant language
- Go
- Stars
- 17k
- Forks
- 2.1k
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 105
Description
Currently the way Nomad tracks Consul health checks during deployment is inefficient. Nomad will spam Consul with 3 API requests (namespaces, services, checks) every 500 milliseconds for each allocation currently being started (assuming `update.health_check=="checks"` which is the default).
https://github.com/hashicorp/nomad/blob/v1.3.1/client/allochealth/tracker.go#L23
https://github.com/hashicorp/nomad/blob/v1.3.1/command/agent/consul/service_client.go#L1313
Easy optimization: we should only need to query namespaces and services once, if we expanded the Consul client interface to query for checks directly we can cut down on API requests by 2/3rds.
Hard mode: switch to using watches and filter expressions on checks. Unclear what impact this would have on Consul and how optimized that path would be internally.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with client/allochealth/tracker.go and command/agent/consul/service_client.go at the referenced lines, then trace the Consul client interface used for namespaces, services, and checks. Compare the current request flow with the proposed direct checks query. Done means avoiding repeated namespace and service requests per allocation while preserving deployment health-check behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100