Re: PostgreSQL pre-fork speedup - Mailing list pgsql-hackers

From Tatsuo Ishii
Subject Re: PostgreSQL pre-fork speedup
Date
Msg-id 20040508.113009.78705157.t-ishii@sra.co.jp
Whole thread Raw
In response to Re: PostgreSQL pre-fork speedup  (sdv mailer <sdvmailer@yahoo.com>)
Responses Re: PostgreSQL pre-fork speedup
List pgsql-hackers
> Hi Bruce,
> 
> Sorry for the confusion because Rod asked a question
> and I answered too quickly. This is what I mean.
> 
> 15x Slower:
> -----------
> Client <--TCP--> PgPool <--UNIX--> PostgreSQL
> Client <--TCP--> PgPool <--TCP--> PostgreSQL
> 
> 5x Faster:
> ----------
> Client <--UNIX--> PgPool <--UNIX--> PostgreSQL
> Client <--UNIX--> PgPool <--TCP--> PostgreSQL
> 
> 
> Hope this helps! Pgpool speeds up connection time by
> 5x with UNIX socket due to pre-fork and connection
> pooling. However, pgpool slows down by 15x under TCP
> socket for some unknown reason.

It appeared that the cause of TCP socket slowness was in reading the
startup packet which is performed by read_startup_packet(). I did some
measurement for the function and it showed huge difference between
UNIX and TCP sockets. Times (in micro sec) for 100 call to
read_startup_packet() are:

UNIX socket: 623
TCP socket:  6086

As you can see TCP is nearly 10 times slower than UNIX socket. In the
function there are 2 read()s to process the startup packet. I think I
could enhance pool_read() so that it reduces the call to read() as
little as possible...
--
Tatsuo Ishii


pgsql-hackers by date:

Previous
From: Gaetano Mendola
Date:
Subject: write a new built in type
Next
From: Fabien COELHO
Date:
Subject: fix schema ownership on first connection preliminary patch