127.0.0.1:3000 and localhost:3000

Hello,

Working with rails, i realized that when i use my application with localhost:3000, the application becomes much more slow than when i use it with 127.0.0.1:3000, for example… have anyone ever realized this too?

Why this happens?

Thanks

Hello,

Working with rails, i realized that when i use my application with
localhost:3000, the application becomes much more slow than when i use it
with 127.0.0.1:3000, for example... have anyone ever realized this too?

I think that in some setups localhost will resolve by default to an
ipv6 address (::1 or something like that), only falling back to
127.0.0.1 if that fails. In some cases it may take a while for the OS
to realise the connection to ::1 can't be made.

Fred

Take a look at your /etc/hosts file. Mine has the following priority:

127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost

Walter