Forum Moderators: open

Message Too Old, No Replies

DBHost - localhost or ip or domain.com effectiveness?

which is more effective?

         

AjiNIMC

9:02 am on Jul 22, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi,

While doing the DB connection what should I use my DB host to be?

"localhost" or
"ip of my domain" or
"domain"

Since my database is located on the same hosting server, I can access it using the above three options. I want to know which one is more effective and why? Also what is the performance difference?

Thanks,
AjiNIMC

zCat

9:39 am on Jul 22, 2006 (gmt 0)

10+ Year Member



Theoretically using an IP address will be faster, because this will avoid a DNS lookup, and in the worst case if DNS is not available for some reason, the application may not be able to connect to the database.

I'd go for localhost or 127.0.0.1 if available.

AjiNIMC

12:34 pm on Jul 22, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'd go for localhost or 127.0.0.1 if available.

Even I think the first priority should be localhost or 127.0.0.1 as it will resolve locally.

then the domain IP and then the domain name.

But I wanted to see if someone has done some reasearch to find the difference in perfomance. Does it create a significate difference in performance? May be for the first time.