Skip to content
Snippets Groups Projects
Commit d43282e0 authored by Stephen R. van den Berg's avatar Stephen R. van den Berg
Browse files

PGsql Use TCP_NODELAY to squeeze out the last ounce of performance

Rev: lib/modules/Sql.pmod/pgsql.pike:1.19
Rev: lib/modules/Sql.pmod/pgsql_util.pmod:1.5
Rev: src/modules/_PGsql/PGsql.cmod:1.17
Rev: src/modules/_PGsql/configure.in:1.7
parent 6cee1e53
Branches shake256
Tags
No related merge requests found
......@@ -673,6 +673,7 @@ private int read_cb(mixed foo, string d) {
#endif
void destroy() {
cancelquery();
if(_c)
_c.sendterminate();
}
......
......@@ -142,6 +142,12 @@ class PGassist {
sendcmd(({"X",plugint32(4)}),2);
close();
}
void create() {
#ifdef USEPGsql
::create();
#endif
}
}
class PGconn {
......@@ -180,6 +186,7 @@ class PGconn {
void create(Stdio.File stream,object t) {
std::create();
std::assign(stream);
pg::create();
}
}
......@@ -205,6 +212,7 @@ class PGconnS {
void create(Stdio.File stream, SSL.context ctx) {
rawstream=stream;
std::create(stream,ctx,1,1);
pg::create();
}
}
#endif
......
/* -*- c -*-
* $Id: PGsql.cmod,v 1.16 2008/07/28 11:47:53 srb Exp $
* $Id: PGsql.cmod,v 1.17 2008/07/31 10:32:36 srb Exp $
*
* PGsql, accelerator functions for Sql.pgsql for Pike.
*
......@@ -21,6 +21,13 @@
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_TCP_H
#include <netinet/tcp.h>
#endif
DECLARATIONS
......@@ -206,6 +213,15 @@ bad:
}
PIKEFUN void create() {
#ifdef TCP_NODELAY
apply(THISOBJ,"query_fd",0);
if(Pike_sp[-1].type == PIKE_T_INT) {
int fd=Pike_sp[-1].u.integer;
int newval = 1;
setsockopt(fd, SOL_TCP, TCP_NODELAY, &newval, sizeof(newval));
}
pop_stack();
#endif
}
PIKEFUN void setportal(void|object portal) {
......
# $Id: configure.in,v 1.6 2008/07/27 15:18:21 srb Exp $
# $Id: configure.in,v 1.7 2008/07/31 10:32:36 srb Exp $
#
AC_INIT(PGsql.cmod)
......@@ -6,4 +6,6 @@ AC_CONFIG_HEADER(config.h)
AC_MODULE_INIT()
AC_CHECK_HEADERS(sys/socket.h netinet/tcp.h)
AC_OUTPUT(Makefile,echo FOO >stamp-h )
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment