From: | "Dann Corbit" <DCorbit(at)connx(dot)com> |
---|---|
To: | <pgsql-hackers(at)postgresql(dot)org> |
Subject: | pqlib suggestion |
Date: | 2007-06-07 19:19:07 |
Message-ID: | D425483C2C5C9F49B5B7A41F89441547010006EB@postal.corporate.connx.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Clients using pqlib can get some boost by increasing tcp/ip window size.
It might be good to make it a settable parameter.
Anyway, maybe something like this:
/* ----------
* connectNoDelay -
* Sets the TCP_NODELAY socket option.
* Returns 1 if successful, 0 if not.
* ----------
*/
static int
connectNoDelay(PGconn *conn)
{
int on = 1;
#ifdef TCP_NODELAY
if (setsockopt(conn->sock, IPPROTO_TCP, TCP_NODELAY,
(char *) &on,
sizeof(on)) < 0)
{
char sebuf[256];
printfPQExpBuffer(&conn->errorMessage,
libpq_gettext("could not set socket
to TCP no delay mode: %s\n"),
SOCK_STRERROR(SOCK_ERRNO, sebuf, sizeof(sebuf)));
return 0;
}
#endif
on = 65535;
if (setsockopt(conn->sock, SOL_SOCKET, SO_RCVBUF,
(char *) &on,
sizeof(on)) < 0)
{
printfPQExpBuffer(&conn->errorMessage,
"connectNoDelay() --
setsockopt SO_RCVBUF failed: errno=%d\n%s\n",
errno, strerror(errno));
#ifdef WIN32
printf("Winsock error: %i\n",
WSAGetLastError());
#endif
return 0;
}
on = 65535;
if (setsockopt(conn->sock, SOL_SOCKET, SO_SNDBUF,
(char *) &on,
sizeof(on)) < 0)
{
printfPQExpBuffer(&conn->errorMessage,
"connectNoDelay() --
setsockopt SO_SNDBUF failed: errno=%d\n%s\n",
errno, strerror(errno));
#ifdef WIN32
printf("Winsock error: %i\n",
WSAGetLastError());
#endif
return 0;
}
return 1;
}
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2007-06-07 19:27:34 | Re: Autovacuum launcher doesn't notice death of postmaster immediately |
Previous Message | Andrew Hammond | 2007-06-07 19:13:09 | Re: Autovacuum launcher doesn't notice death of postmaster immediately |