Closed 1999 closed 10 years ago
https://github.com/mikeal/request/issues/803 is probably relating issue
As the feature request it looks fine.
But why you have a lot of DNS lookups? Lets enable keep alive on the target HTTP server and configure agents on your app side: while you have the incoming load connections will be reused from the agent pool.
I can't configure target HTTP server - this is CouchDB and AFAIK it doesn't allow keep-alive connections. Btw, what happens when all agent pool sockets are busy? Does asker reject the request or puts request in some kind of queue?
Btw, bem-node (which is used in tv.yandex.ru) has some kind of this dns caching layer.
We talked about this feature and came to conclusion: dns requests should not be cached at application level. Instead you should use special tools for that, for example bind9 or any other dns caching server. bem-node code which resolves hostname by making request to / is a great mistake.
As far as I can see, asker doesn't cache dns lookups, and due to dns module documentation
http.get / http.request
will calldns.lookup
each time request is made. It seems like adding dns.lookup caching will speed up requests. The only new thing will be Host header. What do you think about it?The problem I faced was
getaddrinfo ENOTFOUND
, so I tried to investigate it a bit and came to conclusion that chanhing localhost to 127.0.0.1 fixed the problem a bit (Error: connect EMFILE
appears, but that's a problem of http.agent setting probably).