inet_res: rewrite to parallel lookup algorithm #4610
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a suggestion that needs to be evaluated. The concept popped up in the discussion of #4564 and I happened to have this branch already.
I have rewritten the
inet_res
DNS resolver to query name servers in parallel, which seems to be the contemporary way to do it.To avoid wasting resources there is a delay of half the normal UDP time-out before a new name server is queried, so the queries are not entirely parallel. The question is if this is too defensive?
To ensure process cleanup there is a Reaper process started for every query, and all queries are performed in parallel processes. That means at least 2 processes are spawned for a query, and then after half the normal UDP time-out another is spawned up to 1 process per name server + the Reaper. The question is if this expending too much resources - I did not find a better way to do it.
Because queries are done in parallel this algorithm uses more sockets i.e more IP Ports and more file descriptors. The current algorithm uses one UDP socket, and possibly one TCP socket if needed. This algorithm uses one socket per query process which go up to one per name server. The question is if this might be a problem for systems where IP Ports or file descriptors are a scarce resource.
So, is this a good improvement, or wasting resources?