Re: Performance: Unix sockets vs. TCP/IP sockets
От | Doug McNaught |
---|---|
Тема | Re: Performance: Unix sockets vs. TCP/IP sockets |
Дата | |
Msg-id | m3ofwuutwk.fsf@belphigor.mcnaught.org обсуждение исходный текст |
Ответ на | Performance: Unix sockets vs. TCP/IP sockets (Frank Joerdens <frank@joerdens.de>) |
Ответы |
Re: Performance: Unix sockets vs. TCP/IP sockets
|
Список | pgsql-general |
Frank Joerdens <frank@joerdens.de> writes: > On Thu, Jan 25, 2001 at 11:07:19PM -0500, Tom Lane wrote: > > Frank Joerdens <frank@joerdens.de> writes: > > > What performance penalty can I expect when going over TCP/IP sockets > > > instead of Unix sockets? > > > > On a properly designed kernel, there shouldn't be any measurable > > performance difference between a local TCP connection and a Unix-socket > > connection. > > Ah. That's good hear. I'd heard that TCP/IP was _significantly_ slower > than Unix sockets. But maybe that was just Linux. Much as I hesitate to contradict Tom here, I think I need to qualify his statement. For a localhost TCP socket, a write() has to be sent down the network stack and (possibly) split into packets, which are then sent through the routing engine and back up through the stack, flow-controlled, reassembled, and submitted to the receiving socket. Also, ACK packets have to be sent back to the sender through the same tortuous path. For a Unix socket, the write() is merely copied into the socket buffer, and the reader notified that data is ready. Flow control consists of simply blocking the writer if the buffer is full. For bulk data, a Unix socket will almost certainly be faster due to the reduced overhead. For a Postgres connection, query compilation (if needed) and lookup time, plus disk i/o if necessary, will dominate. and you shouldn't see a significant difference between the two types of socket. -Doug
В списке pgsql-general по дате отправления: