Messages in this thread | | | Date | Thu, 13 Nov 2008 17:04:28 -0600 | From | "Chris Friesen" <> | Subject | Re: Unix sockets via TCP on localhost: is TCP slower? |
| |
Olaf van der Spek wrote: > On Thu, Nov 13, 2008 at 12:24 PM, Arnaldo Carvalho de Melo > <acme@redhat.com> wrote: >> Em Thu, Nov 13, 2008 at 12:20:44AM +0100, Olaf van der Spek escreveu: >>> Hi, >>> >>> Quite often in discussions, I see people claiming Unix sockets are >>> faster then TCP sockets on a connection that stays inside localhost. >>> Let's say from app A to app B. >>> Is this indeed the case and if so, how much and why? >>> My assumption is that the kernel can optimize the 'connection' and let >>> any performance differences disappear. >> How much? Please measure.
Lmbench shows local tcp as noticeably slower than unix sockets on a Mac G5 running 2.6.27.
*Local* Communication latencies in microseconds - smaller is better --------------------------------------------------------------- Host OS 2p/0K Pipe AF UDP RPC/ TCP RPC/ TCP ctxsw UNIX UDP TCP conn --------- ------- ----- ----- ---- ----- ----- ----- ----- ---- localhost 2.6.27 2.270 10.5 12.6 19.9 31.5 22.7 35.5 68.
*Local* Communication bandwidths in MB/s - bigger is better ----------------------------------------------------------------------- Host OS Pipe AF TCP File Mmap Bcopy Bcopy Mem Mem UNIX reread reread (libc) (hand) read write --------- ------- ---- ---- ---- ------ ------ ------ ------ ---- ----- localhost 2.6.27 1368 1564 334. 1111.8 2068.8 930.3 947.0 2072 1269.
Chris
| |