Skip to content

Probe DNS, HTTP and TCP targets concurrently - #179

Open
abhiishek340 wants to merge 1 commit into
bloomberg:masterfrom
abhiishek340:probe-targets-concurrently
Open

abhiishek340 wants to merge 1 commit into
bloomberg:masterfrom
abhiishek340:probe-targets-concurrently

Conversation

@abhiishek340

Copy link
Copy Markdown

Issue number of the reported bug or feature request: #144

Describe your changes
checkTargets ran every configured DNS/HTTP/TCP probe one after another, so /check took the sum of all probe timeouts. With the default 500ms per-target timeout, two unreachable targets already add up to the 1s CheckTimeout peers allow for /check. Every peer's call then fails with context deadline exceeded, and the UI shows all nodes as unhealthy. This matches the report in #144: one dead target is fine, two or more break the UI.

This change runs the probes concurrently, so /check takes as long as the slowest single probe. Each goroutine writes only to its own preallocated slot. Results are then assembled in the same order as before (per host: dns, http, tcp), so the response shape is unchanged. The probe table now has a named targetProbe type, and the fan-out lives in runTargetProbes.

Testing performed

  • New TestCheckTargetsProbesConcurrently: four HTTP targets that never answer within a 200ms timeout must all be checked in under 400ms, and each must report an error.
    • Without the fix it fails: checking 4 unreachable targets took 804.792417ms, want less than 400ms.
  • New TestCheckTargetsKeepsProtocolOrder: a host configured for all three protocols still gets its results in dns, http, tcp order.
  • go test -race ./pkg/... passes.
  • make bin/goldpinger builds.

Additional context
#178 also touches the probe loop in checkTargets (it adds metrics for external targets). If that PR lands first, I'm happy to rebase this one onto it.

checkTargets ran every configured probe one after another, so /check
took the sum of all probe timeouts. With the default 500ms per-target
timeout, two unreachable targets already add up to the 1s CheckTimeout
peers allow, so every peer's call fails with "context deadline exceeded"
and the UI shows all nodes as unhealthy.

Run the probes concurrently instead, so the time spent is that of the
slowest single probe. Results keep their previous order per host.

Fixes bloomberg#144

Signed-off-by: Abhishek Yadav <[email protected]>

This branch has not been deployed

No deployments
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.

1 participant