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?
Asked
Active
Viewed 6,077 times
1 Answers
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
-
4For me, it takes about one second to resolve (i.e., the difference between using localhost and 127.0.0.1). Is that normal? Could a virus scanner be in the way? – Gijs van Oort Feb 11 '15 at 11:09
-
I've also experienced a similar behavior before on PHP server with apache . – Anonymous Mar 29 '17 at 10:46
-
@GijsvanOort I know I am 4 years late but you gotta check out your host file. – Rishav May 24 '19 at 15:00