2

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 !

3
  • Is externalIP an address present on your Ubuntu system, or your public IP address on a NAT'ing firewall? Jan 7, 2018 at 17:04
  • It's present on my Ubuntu system Jan 7, 2018 at 17:22
  • What happened when you measured it?
    – symcbean
    Jan 8, 2018 at 21:19

2 Answers 2

2

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.

1

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?

5

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .