1

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 !

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

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.

0

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?

  • Looking for more concrete sources, but there are other similar answers: stackoverflow.com/a/10936084/1974978 – multithr3at3d Jan 7 '18 at 16:52
  • The OP asked for external IP Address, and not for the same IP / localhost! I think you're confusing between the two. – Am_I_Helpful Jan 7 '18 at 16:59
  • 1
    @Am_I_Helpful The OP said that his "external" IP address was actually configured on the same machine. So your comments don't make sense here. – Michael Hampton Jan 8 '18 at 8:49
  • @MichaelHampton - OP hadn't clairfied this when I made the comment. Anyway, thanks for informing, I''ll remove my downvote. – Am_I_Helpful Jan 8 '18 at 15:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.