Is there a substantial overhead when connect to a database by the domain name instead of the IP Address, over a local network?

StackOverflow https://stackoverflow.com/questions/20862705

문제

Is there a substantial overhead when connect to a database by the domain name instead of the IP Address, over a local network?

I have an application server that is will be connecting to a mongodb server running on a separate instance, but the same local network. Is there substantial overhead for the DNS lookup?

For example:

[ app ] -- 1.1.1.1:27017 --> [ Mongo ]

VS

[ app ] -- mongo.example.com:27017 --> [ Mongo ]

EDIT

Is it generally considered a best practice to use the IP Address instead of the Domain name?

More info:

Thank you!

도움이 되었습니까?

해결책

There will be an occasional, possibly significant, delay to look up the name. But the result will then be cached on any decent OS, so most connections won't have to wait on a DNS lookup.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top