15

I've setup an XML-RPC server/client communication under Windows. What I've noticed is that if exchanged data volume become huge, there's a difference in starting the server listening on "localhost" vs. "127.0.0.1". If "127.0.0.1" is set, the communication speed is faster than using "localhost". Could somebody explain why? I thought it could be a matter on naming resolving, but....locally too?

ABCplus
  • 3,981
  • 3
  • 27
  • 43

1 Answers1

11

Every domain name gets resolved. There is no exception to this rule, including with regards to a local site.

When you make a request to localhost, localhost's IP gets resolved by the host file every time it gets requested. In Windows, the host file controls this. But if you make a request to 127.0.0.1, the IP address is already resolved, so any request goes directly to this IP.

Alex Waygood
  • 6,304
  • 3
  • 24
  • 46
fatiherdem
  • 1,173
  • 6
  • 18
  • 35