Re: PostgreSQL 7.3.3 and Intel C compiler

Lists: pgsql-hackers
From: Hans-Jürgen Schönig <hs(at)cybertec(dot)at>
To: pgsql-hackers(at)postgresql(dot)org, peter_e(at)gmx(dot)net
Subject: PostgreSQL 7.3.3 and Intel C compiler
Date: 2003-07-05 05:48:53
Message-ID: 3F0666C5.80604@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

This week I have done some performance tuning at a customer's office. We
have beaten (demoralized) MS SQL and DB2 in serializable mode and DB2 in
any transaction isolation level :).

By the way: In case of very simple statements SERIALIZABLE is about 3
times faster than READ COMMITTED. I expected it to be faster but I did
not expect this difference.

We have used Peter's fix which makes it possible to compile PostgreSQL
with Intel's C compiler. PostgreSQL built nicely (just some nasty
warnings). We have tries to run our benchmark (mostly simple statements
and cursor work) on this version of PostgreSQL but the database cluster
corrupted almost instantly. Although PostgreSQL compiled nicely we
could not get the system running without corrupting something.
Maybe this behaviour should be varified by somebody else and documented
somewhere (maybe a FAQ?).

Regards,

Hans

--
Cybertec Geschwinde u Schoenig
Ludo-Hartmannplatz 1/14, A-1160 Vienna, Austria
Tel: +43/2952/30706; +43/664/233 90 75
www.cybertec.at, www.postgresql.at, kernel.cybertec.at


From: "Mendola Gaetano" <mendola(at)bigfoot(dot)com>
To: Hans-Jürgen Schönig <hs(at)cybertec(dot)at>, <pgsql-hackers(at)postgresql(dot)org>, <peter_e(at)gmx(dot)net>
Subject: Re: PostgreSQL 7.3.3 and Intel C compiler
Date: 2003-07-06 02:48:49
Message-ID: 001901c34369$20df7b90$10d4a8c0@mm.eutelsat.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

"Hans-Jürgen Schönig" <hs(at)cybertec(dot)at> wrote:
> We have used Peter's fix which makes it possible to compile PostgreSQL
> with Intel's C compiler. PostgreSQL built nicely (just some nasty
> warnings). We have tries to run our benchmark (mostly simple statements
> and cursor work) on this version of PostgreSQL but the database cluster
> corrupted almost instantly.

Did you compile it with -O3 optimization ?
If it this the case try with -O2, some times the -O3 optimization generate
inconsistent code.

Regards
Gaetano Mendola


From: Sergey <sergey(at)optimaltec(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: PostgreSQL 7.3.3 and Intel C compiler
Date: 2003-07-06 03:25:15
Message-ID: be84q2$j48$1@main.gmane.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi!

I'm sorry I haven't done any research beforehand, but are any such
materials regarding performance tuning available in the canned form on
the 'net for me to show to my boss? I believe statements like this will
greatly promote PostgreSQL if substantiated with concise "executive
summary" articles and maybe some short technical details for
administrators. Thank you!

Sergey.

Hans-Jürgen Schönig wrote:
> This week I have done some performance tuning at a customer's office. We
> have beaten (demoralized) MS SQL and DB2 in serializable mode and DB2 in
> any transaction isolation level :).
>
> By the way: In case of very simple statements SERIALIZABLE is about 3
> times faster than READ COMMITTED. I expected it to be faster but I did
> not expect this difference.
>


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Hans-Jürgen Schönig <hs(at)cybertec(dot)at>
Cc: pgsql-hackers(at)postgresql(dot)org, peter_e(at)gmx(dot)net
Subject: Re: PostgreSQL 7.3.3 and Intel C compiler
Date: 2003-07-21 03:56:51
Message-ID: 200307210356.h6L3upB23919@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hans-Jrgen Schnig wrote:
> This week I have done some performance tuning at a customer's office. We
> have beaten (demoralized) MS SQL and DB2 in serializable mode and DB2 in
> any transaction isolation level :).
>
> By the way: In case of very simple statements SERIALIZABLE is about 3
> times faster than READ COMMITTED. I expected it to be faster but I did
> not expect this difference.

Why was SERIALIZABLE faster? I know SERIALIZABLE doesn't have the
rollback penalty in read-only queries, but I don't understand why it
would be faster.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: Hans-Jürgen Schönig <hs(at)cybertec(dot)at>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org, peter_e(at)gmx(dot)net
Subject: Re: PostgreSQL 7.3.3 and Intel C compiler
Date: 2003-07-21 15:57:40
Message-ID: 3F1C0D74.7070502@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Bruce Momjian wrote:
> Hans-J?rgen Sch?nig wrote:
>
>>This week I have done some performance tuning at a customer's office. We
>>have beaten (demoralized) MS SQL and DB2 in serializable mode and DB2 in
>>any transaction isolation level :).
>>
>>By the way: In case of very simple statements SERIALIZABLE is about 3
>>times faster than READ COMMITTED. I expected it to be faster but I did
>>not expect this difference.
>
>
> Why was SERIALIZABLE faster? I know SERIALIZABLE doesn't have the
> rollback penalty in read-only queries, but I don't understand why it
> would be faster.
>

To be honest I don't have the slightest idea. Maybe it has to do with
snapshotting but I don't know precisely. In case of SERIALIZABLE all
snapshots inside a transaction are the same - maybe this makes the big
difference. I have no other explanation for that.

There is one nifty detail which seems VERY strange to me: If
serializable mode is set in postgresql.conf the system was 3 times
faster (~ 7.5 sec. vs. 2.5sec). If serializable mode was set for every
transaction (using set at the beginning of the transaction) serializable
mode was as fast as read committed.

We have done 90% cursor work and very simple queries (mostly queries
such as "DECLARE CURSOR x FOR SELECT * FROM ... WHERE a = b").
I have no idea why PostgreSQL behaves like that but it seems to be a
really good tweak because in this mode we beat any other database
including SQL server on Windows 2003 (2.9sec) and IBM DB2 on Linux (12.6
seconds).
I am sorry but I cannot provide you the tools we have used because we
have a non disclosure agreement with the customer. I will try to verify
this with my machines and a simple self-made benchmark.

Regards,

Hans

--
Cybertec Geschwinde u Schoenig
Ludo-Hartmannplatz 1/14, A-1160 Vienna, Austria
Tel: +43/2952/30706; +43/664/233 90 75
www.cybertec.at, www.postgresql.at, kernel.cybertec.at


From: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>
To: Hans-Jürgen Schönig <hs(at)cybertec(dot)at>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org, peter_e(at)gmx(dot)net
Subject: Re: PostgreSQL 7.3.3 and Intel C compiler
Date: 2003-07-22 05:47:40
Message-ID: Pine.LNX.4.21.0307221543460.7267-100000@linuxworld.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Mon, 21 Jul 2003, [ISO-8859-1] Hans-Jrgen Schnig wrote:

> > Why was SERIALIZABLE faster? I know SERIALIZABLE doesn't have the
> > rollback penalty in read-only queries, but I don't understand why it
> > would be faster.
> >
>
>
> To be honest I don't have the slightest idea. Maybe it has to do with
> snapshotting but I don't know precisely. In case of SERIALIZABLE all
> snapshots inside a transaction are the same - maybe this makes the big
> difference. I have no other explanation for that.
>
> There is one nifty detail which seems VERY strange to me: If
> serializable mode is set in postgresql.conf the system was 3 times
> faster (~ 7.5 sec. vs. 2.5sec). If serializable mode was set for every
> transaction (using set at the beginning of the transaction) serializable
> mode was as fast as read committed.

Hmm.

>
> We have done 90% cursor work and very simple queries (mostly queries
> such as "DECLARE CURSOR x FOR SELECT * FROM ... WHERE a = b").
> I have no idea why PostgreSQL behaves like that but it seems to be a
> really good tweak because in this mode we beat any other database
> including SQL server on Windows 2003 (2.9sec) and IBM DB2 on Linux (12.6
> seconds).

Are you testing the same type of cursors? Cursors do not behave
according to READ COMMITTED principles under Postgres. What are the
results for READ ONLY INSENSITIVE cursors with DB2 and MS SQL?

Thanks,

Gavin


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Hans-Jürgen Schönig <hs(at)cybertec(dot)at>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org, peter_e(at)gmx(dot)net
Subject: Re: PostgreSQL 7.3.3 and Intel C compiler
Date: 2003-07-22 06:04:33
Message-ID: 4035.1058853873@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

=?ISO-8859-1?Q?Hans-J=FCrgen_Sch=F6nig?= <hs(at)cybertec(dot)at> writes:
> There is one nifty detail which seems VERY strange to me: If
> serializable mode is set in postgresql.conf the system was 3 times
> faster (~ 7.5 sec. vs. 2.5sec). If serializable mode was set for every
> transaction (using set at the beginning of the transaction) serializable
> mode was as fast as read committed.

Seems pretty strange to me too. I can believe that taking a new
snapshot for each command (as READ COMMITTED mode does) might take a
significant amount of time, especially if you have a large number of
backends connected. (I think the time to get the snapshot data is
linear in the number of live backends; also there is the possibility
of contention on the PROC array when multiple backends need to fetch
snapshots at the same time.) But if that's where the performance
difference is, it wouldn't matter whether you start in serializable
mode by default or issue a SET command to select it.

> I am sorry but I cannot provide you the tools we have used because we
> have a non disclosure agreement with the customer. I will try to verify
> this with my machines and a simple self-made benchmark.

Please try to create a self-contained test case to demonstrate this
behavior. I'd like to try to profile it...

regards, tom lane


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Hans-Jürgen Schönig <hs(at)cybertec(dot)at>, pgsql-hackers(at)postgresql(dot)org, peter_e(at)gmx(dot)net
Subject: Re: PostgreSQL 7.3.3 and Intel C compiler
Date: 2003-07-22 16:01:33
Message-ID: 200307221601.h6MG1XT21482@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Tom Lane wrote:
> =?ISO-8859-1?Q?Hans-J=FCrgen_Sch=F6nig?= <hs(at)cybertec(dot)at> writes:
> > There is one nifty detail which seems VERY strange to me: If
> > serializable mode is set in postgresql.conf the system was 3 times
> > faster (~ 7.5 sec. vs. 2.5sec). If serializable mode was set for every
> > transaction (using set at the beginning of the transaction) serializable
> > mode was as fast as read committed.
>
> Seems pretty strange to me too. I can believe that taking a new
> snapshot for each command (as READ COMMITTED mode does) might take a
> significant amount of time, especially if you have a large number of
> backends connected. (I think the time to get the snapshot data is
> linear in the number of live backends; also there is the possibility
> of contention on the PROC array when multiple backends need to fetch
> snapshots at the same time.) But if that's where the performance
> difference is, it wouldn't matter whether you start in serializable
> mode by default or issue a SET command to select it.

But the snapshots only are grabbing the xids from each proc, right?
Doesn't seem that would take very long.

If this is the bottleneck, maybe we need a shared proc lock.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: Hans-Jürgen Schönig <hs(at)cybertec(dot)at>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org, peter_e(at)gmx(dot)net
Subject: Re: PostgreSQL 7.3.3 and Intel C compiler
Date: 2003-07-22 16:52:17
Message-ID: 3F1D6BC1.1060405@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

> But the snapshots only are grabbing the xids from each proc, right?
> Doesn't seem that would take very long.
>
> If this is the bottleneck, maybe we need a shared proc lock.
>

I had a hard day testing and verifying this kind of stuff. We have run
several hundred benchmarks at the customer using many different
settings. SERIALIZABLE was the key to high-performance. I have run
dozens of different benchmarks today (cursors, simple selects,
concurrent stuff, ...). I have not found a difference. I have no idea
why the customer's system was so much faster in SERIALIZABLE mode. They
use a native C++ implementation of the FE/BE protocol but as far as I
have seen their database layer does not care about transaction isolation
too much.
I will continue testing this kind of stuff because this is a very
strange yet important issue.
I will try to get some code from the customer. This is mostly
non-disclosure stuff so I am not sure what we can use. I just wanted to
ask if somebody has a reasonable explanation and if somebody can verify
this behaviour.

Maybe we will find the reason some day :(.
Sorry that I cannot provide more information at the moment.

Regards,

Hans

--
Cybertec Geschwinde u Schoenig
Ludo-Hartmannplatz 1/14, A-1160 Vienna, Austria
Tel: +43/2952/30706; +43/664/233 90 75
www.cybertec.at, www.postgresql.at, kernel.cybertec.at


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Hans-Jürgen Schönig <hs(at)cybertec(dot)at>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org, peter_e(at)gmx(dot)net
Subject: Re: PostgreSQL 7.3.3 and Intel C compiler
Date: 2003-07-22 16:56:28
Message-ID: 200307221656.h6MGuSg28907@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hans-Jrgen Schnig wrote:
> > But the snapshots only are grabbing the xids from each proc, right?
> > Doesn't seem that would take very long.
> >
> > If this is the bottleneck, maybe we need a shared proc lock.
> >
>
>
> I had a hard day testing and verifying this kind of stuff. We have run
> several hundred benchmarks at the customer using many different
> settings. SERIALIZABLE was the key to high-performance. I have run
> dozens of different benchmarks today (cursors, simple selects,
> concurrent stuff, ...). I have not found a difference. I have no idea
> why the customer's system was so much faster in SERIALIZABLE mode. They
> use a native C++ implementation of the FE/BE protocol but as far as I
> have seen their database layer does not care about transaction isolation
> too much.

They do the backend protocol using a custom implementation. Why would
they do that?

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Hans-Jürgen Schönig <hs(at)cybertec(dot)at>, pgsql-hackers(at)postgresql(dot)org, peter_e(at)gmx(dot)net
Subject: Re: PostgreSQL 7.3.3 and Intel C compiler
Date: 2003-07-22 18:15:21
Message-ID: 8812.1058897721@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> But the snapshots only are grabbing the xids from each proc, right?
> Doesn't seem that would take very long.

Yeah, we've never seen any previous indication that grabbing a snapshot
is a bottleneck. Also, I think it uses a shared (read) lock, so there
shouldn't really be contention, unless perhaps they are starting and
stopping backends very frequently as well.

> If this is the bottleneck, maybe we need a shared proc lock.

We need to understand what's happening before speculating about how to
fix it ...

regards, tom lane


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Hans-Jürgen Schönig <hs(at)cybertec(dot)at>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org, peter_e(at)gmx(dot)net
Subject: Re: PostgreSQL 7.3.3 and Intel C compiler
Date: 2003-07-22 20:23:39
Message-ID: 200307222023.h6MKNdD21010@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


Well, it seems it would be easier for them to just improve our existing
libpq and send us the patches, rather than rewriting it from scratch.

---------------------------------------------------------------------------

Hans-Jrgen Schnig wrote:
> > They do the backend protocol using a custom implementation. Why would
> > they do that?
> >
>
>
> It seems as if their implemenation provides 20% more throughput. I
> haven't benchmarked with lib pq personally so I cannot tell you more.
>
>
> Hans
>
>
> --
> Cybertec Geschwinde u Schoenig
> Ludo-Hartmannplatz 1/14, A-1160 Vienna, Austria
> Tel: +43/2952/30706; +43/664/233 90 75
> www.cybertec.at, www.postgresql.at, kernel.cybertec.at
>
>
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: Hans-Jürgen Schönig <hs(at)cybertec(dot)at>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org, peter_e(at)gmx(dot)net
Subject: Re: PostgreSQL 7.3.3 and Intel C compiler
Date: 2003-07-22 20:24:28
Message-ID: 3F1D9D7C.20508@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

> They do the backend protocol using a custom implementation. Why would
> they do that?
>

It seems as if their implemenation provides 20% more throughput. I
haven't benchmarked with lib pq personally so I cannot tell you more.

Hans

--
Cybertec Geschwinde u Schoenig
Ludo-Hartmannplatz 1/14, A-1160 Vienna, Austria
Tel: +43/2952/30706; +43/664/233 90 75
www.cybertec.at, www.postgresql.at, kernel.cybertec.at


From: Steven Vajdic <svajdic(at)asc(dot)corp(dot)mot(dot)com>
To:
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Unsubscribe
Date: 2003-07-23 04:37:29
Message-ID: 3F1E1109.F5983628@asc.corp.mot.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers