Which one is better to query from – loopback-ip or interface-ip?

I have memcache server listing on 0.0.0.0:11211. I have to query the memcached server from the same box. Which one do you think is better: querying from 127.0.0.1:11211 or from interface-ip:11211. Please explain why also ?

Answer

I have to query the memcached server from the same box.

Why not use Unix socket to avoid TCP/IP overhead:

$ memcached -h
memcached 1.2.8
repcached 2.2
-p <num>      TCP port number to listen on (default: 11211)
-U <num>      UDP port number to listen on (default: 11211, 0 is off)
-s <file>     unix socket path to listen on (disables network support)

See also: Unix domain sockets vs TCP Sockets

Attribution
Source : Link , Question Author : pradeepchhetri , Answer Author : Anthony Geoghegan

Leave a Comment