AdGuardHome icon indicating copy to clipboard operation
AdGuardHome copied to clipboard

Coalesce simultaneous identical DNS requests into one in-flight lookup

Open jo2dan94 opened this issue 3 months ago • 1 comments

Prerequisites

  • [x] I have checked the Wiki and Discussions and found no answer

  • [x] I have searched other issues and found no duplicates

  • [x] I want to request a feature or enhancement and not ask a question

The problem

When several clients request the same uncached domain at nearly the same time, each request can independently perform the same upstream resolution and related processing. This creates duplicate work and unnecessary upstream traffic during bursts.

Proposed solution

Use request coalescing/single-flight behavior for compatible simultaneous DNS lookups.

For identical requests that can safely share work:

  • The first request performs the upstream resolution.
  • Matching concurrent requests wait for that in-flight result.
  • The completed result is safely copied/reused for waiting callers.
  • Timeouts and cancellation remain per request where appropriate.
  • Requests with materially different policy context are not incorrectly merged.
  • Telemetry reports coalesced requests and avoided upstream queries.

This would reduce duplicate work during bursty traffic without changing DNS results.

Alternatives considered and additional information

No response

jo2dan94 avatar Aug 30 '26 13:08 jo2dan94

Hello! Thank you for your feature request. However, it is a duplicate of #4364. Please check #4364 for updates. I am closing your ticket as a duplicate.

sofvaskina avatar Aug 31 '26 08:08 sofvaskina