Re: PostgreSQL pre-fork speedup

From: Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp>
To: sdvmailer(at)yahoo(dot)com
Cc: pgman(at)candle(dot)pha(dot)pa(dot)us, pg(at)rbt(dot)ca, scott(dot)marlowe(at)ihs(dot)com, steve(at)blighty(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: PostgreSQL pre-fork speedup
Date: 2004-05-12 05:28:35
Message-ID: 20040512.142835.112627099.t-ishii@sra.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> > 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...

I think I have improved the TCP performance of pgpool. With my quick
testing, in the follwing case pgpool is at least as fast as
PostgreSQL(client directly connected to PostgreSQL).

> > 15x Slower:
> > -----------
> > Client <--TCP--> PgPool <--UNIX--> PostgreSQL
> > Client <--TCP--> PgPool <--TCP--> PostgreSQL

The latest version can be obtained from:

http://www2b.biglobe.ne.jp/~caco/pgpool/pgpool-1.2.2.tar.gz
--
Tatsuo Ishii

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Christopher Kings-Lynne 2004-05-12 06:49:09 Re: Subtle pg_dump problem...
Previous Message Joe Conway 2004-05-12 04:27:41 Re: Module dependency on PostgeSQL version