SO_SNDBUF size is small on win32? - Mailing list pgsql-hackers

From Yoshiyuki Asaba
Subject SO_SNDBUF size is small on win32?
Date
Msg-id 20060628.002313.74731148.y-asaba@sraoss.co.jp
Whole thread Raw
Responses Re: SO_SNDBUF size is small on win32?  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: SO_SNDBUF size is small on win32?  (Martijn van Oosterhout <kleptog@svana.org>)
Re: SO_SNDBUF size is small on win32?  ("Mark Woodward" <pgsql@mohawksoft.com>)
List pgsql-hackers
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@sraoss.co.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
errorout, because these aren't universally 

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [COMMITTERS] pgsql: Disallow changing/dropping default expression
Next
From: Tom Lane
Date:
Subject: Re: SO_SNDBUF size is small on win32?