On my Ubuntu 16.04 machine, I've two services A & B. Service A calls Service B using 127.0.0.1:Bport
...
Does it change anything, in terms of performance to call <externalIp>:Bport
instead ?
Thanks !
On my Ubuntu 16.04 machine, I've two services A & B. Service A calls Service B using 127.0.0.1:Bport
...
Does it change anything, in terms of performance to call <externalIp>:Bport
instead ?
Thanks !
You can check with
tcpdump -i lo -n
that connections to local addresses of non-loopback interfaces are handled by the loopback interface.
So no, there would be no performance difference.
In both cases, it will only pass through the kernel, since the any of the host's IP addresses can be reached without touching the NIC.
This is defined by the "local" routing table, where traffic will be looped back to the loopback interface, as you can see in Hauke Laging's tcpdump
example.
Since both arrive via the loopback interface, performance should be the same.
Check the following links: 1. Routing Tables, 2. What is the local routing table used for?