• 9
name

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191

Backtrace:

File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

I have application servers with memcached running on them.

What will happen if I make a request to memcached on 10.243.98.5, which just happens to be the originating server? Will it use the same fast-path tcp/ip stack as 127.0.0.1, or would I get better performance by checking if 10.243.98.5 is the same box, and substituting 127.0.0.1?

Normally it wouldn't matter so much, because odds are the item you want is going to be in a memcached on another application server, but in this case the load-balancer divides requests so that it's very likely that most of the memcached requests will resolve to the local memcached instance.

What operating system are you using? I'll hazard a guess and say that it will be about the same level of performance using either method, as the dns record for 10.243.... should be cached. Have you tried timing it both ways?

  • 1
Reply Report
      • 1
    • ARP isn't even going to be involved on the same machine, there's no need to ARP for something that isn't transmitted on the wire.
      • 1
    • Linux 2.6, but IIRC there is actually special treatment for 127.0.0.1, where it doesn't go through the tcp/ip stack, it runs at closer to shared memory speeds - so there is the possibility of there being a large difference in performance.

Sounds like you already know the answer ;). In many cases UNIX will use:

http://en.wikipedia.org/wiki/Unix_domain_socket

Unix Domain sockets are faster than TCP/IP/UDP because their is no network stack involved. Many UNIX applications will use Unix Domain sockets for local communication, like for instance your database drivers, or memcached. This isn't always the case, and you should be careful not to confuse Unix domain sockets with UDP, which is completely different.

  • 1
Reply Report

Many OSs have optimized the loopback interfaces. Chances are, the packets will hit the routing table, see that it is local, and follow a fast-path routing to the input on the same machine. No ethernet drivers nor ARP nor other things will be touched.

If you look, chances are your MTU will also be much larger on the loopback too.

  • 0
Reply Report

Trending Tags