Re: SO_SNDBUF size is small on win32?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Magnus Hagander" <mha(at)sollentuna(dot)net>
Cc: "Yoshiyuki Asaba" <y-asaba(at)sraoss(dot)co(dot)jp>, andrew(at)dunslane(dot)net, kleptog(at)svana(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: Re: SO_SNDBUF size is small on win32?
Date: 2006-06-27 18:43:57
Message-ID: 26403.1151433837@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

"Magnus Hagander" <mha(at)sollentuna(dot)net> writes:
> We use non-blocking sockets in backend/port/win32/socket.c so we are
> able to deliver our "faked signals" while waiting for I/O on the socket.
> We specifically set it in pgwin32_socket().

Hm, that seems a bit grotty, but anyway I stand corrected.

> Given that, it might be a good idea to actually put the code there
> instead, to localise it. With a comment and a reference to that Q
> article.

No, I think the patch has it in the right place, because pgwin32_socket
would have no defensible way of knowing what the max send size would be.
(Indeed, with a slightly different implementation in pqcomm.c, there
would not *be* any hard upper limit; the current code wastes cycles
copying data around, when with a large message it probably should just
send() directly from the message buffer...)

I agree it needs a comment though.

>> What I would think might help is a patch on the libpq side (because it
>> *does* use a nonblocking socket) to avoid sending more than
>> 8K per WSASend call.

> It could definitly be a good idea to have a patch there *as well*, but I
> think they'd both be affected.

On the libpq side, sending large messages is probably rare except for
COPY IN mode. Has anyone noticed performance issues specifically with
COPY IN?

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mark Woodward 2006-06-27 18:49:58 Re: SO_SNDBUF size is small on win32?
Previous Message Bruce Momjian 2006-06-27 18:41:56 Re: posix_fadvise versus old kernels

Browse pgsql-patches by date

  From Date Subject
Next Message Mark Woodward 2006-06-27 18:49:58 Re: SO_SNDBUF size is small on win32?
Previous Message Magnus Hagander 2006-06-27 17:49:46 Re: SO_SNDBUF size is small on win32?