Re: SO_SNDBUF size is small on win32?

From: "Mark Woodward" <pgsql(at)mohawksoft(dot)com>
To: "Yoshiyuki Asaba" <y-asaba(at)sraoss(dot)co(dot)jp>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: SO_SNDBUF size is small on win32?
Date: 2006-06-27 18:49:58
Message-ID: 34869.216.145.49.15.1151434198.squirrel@mail.mohawksoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches


I would set the SO_SNDBUF to 32768.

> Hi,
>
> I see a performance issue on win32. This problem is causes by the
> following URL.
>
> http://support.microsoft.com/kb/823764/EN-US/
>
> On win32, default SO_SNDBUF value is 8192 bytes. And libpq's buffer is
> 8192 too.
>
> pqcomm.c:117
> #define PQ_BUFFER_SIZE 8192
>
> send() may take as long as 200ms. So, I think we should increase
> SO_SNDBUF to more than 8192. I attache the patch.
>
> Regards,
> --
> Yoshiyuki Asaba
> y-asaba(at)sraoss(dot)co(dot)jp
> Index: pqcomm.c
> ===================================================================
> RCS file: /projects/cvsroot/pgsql/src/backend/libpq/pqcomm.c,v
> retrieving revision 1.184
> diff -c -r1.184 pqcomm.c
> *** pqcomm.c 5 Mar 2006 15:58:27 -0000 1.184
> --- pqcomm.c 27 Jun 2006 15:17:18 -0000
> ***************
> *** 593,598 ****
> --- 593,608 ----
> return STATUS_ERROR;
> }
>
> + #ifdef WIN32
> + on = PQ_BUFFER_SIZE * 2;
> + if (setsockopt(port->sock, SOL_SOCKET, SO_SNDBUF,
> + (char *) &on, sizeof(on)) < 0)
> + {
> + elog(LOG, "setsockopt(SO_SNDBUF) failed: %m");
> + return STATUS_ERROR;
> + }
> + #endif
> +
> /*
> * Also apply the current keepalive parameters. If we fail to set a
> * parameter, don't error out, because these aren't universally
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2006-06-27 18:51:12 Re: posix_fadvise versus old kernels
Previous Message Tom Lane 2006-06-27 18:43:57 Re: SO_SNDBUF size is small on win32?

Browse pgsql-patches by date

  From Date Subject
Next Message Mark Woodward 2006-06-27 19:02:13 Re: SO_SNDBUF size is small on win32?
Previous Message Tom Lane 2006-06-27 18:43:57 Re: SO_SNDBUF size is small on win32?