I do understand that mabe it's not the purpose of this lib (feel free to close in case).
But would be useful adding a DNS cache layer.
It's one of the common problem nowadays with huge number of requests. It doesn't cache dns lookups or anything. Maybe it's worth just mentioning this in Readme.
What's the cleanest way to deal with it?
huge number of requests
agent option.lookup function for with agent, but it's not currently documented in nodejs doc, so you have to look it up yourselves.
- a handful of domains? set keep
alivewith agent option.
The proposed solution doesn't help many parallel requests. Every one does a separate DNS lookup. And they can fail because there are so many in parallel. Making a separate agent for each request would have the same problem.
Most helpful comment
agentoption.lookupfunction for withagent, but it's not currently documented in nodejs doc, so you have to look it up yourselves.