Thread: PostgreSQL on Linux and Solaris comparison

PostgreSQL on Linux and Solaris comparison

From
chris.lo@cyberwisdom.net (Chris)
Date:
Hi,

I am using PostgresSQL 7.1.3 on both Linux and Solaris envrionment.
Development is using the Linux and production is using Solaris. I
experienced that the perfomrance on Solaris is much worse than Linux.
For example, the same query executed 9 seconds on Solaris and only 1
seconds on Linux.

Is there any help upgrading the 7.1.3 to 7.2.3? Or how can I do some
performance tunning on Solaris?

Thanks.
Chris

Re: PostgreSQL on Linux and Solaris comparison

From
Bruce Momjian
Date:
First, try 7.3beta.  That has a fix for Solaris sorting.  That may fix
it.

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

Chris wrote:
> Hi,
>
> I am using PostgresSQL 7.1.3 on both Linux and Solaris envrionment.
> Development is using the Linux and production is using Solaris. I
> experienced that the perfomrance on Solaris is much worse than Linux.
> For example, the same query executed 9 seconds on Solaris and only 1
> seconds on Linux.
>
> Is there any help upgrading the 7.1.3 to 7.2.3? Or how can I do some
> performance tunning on Solaris?
>
> Thanks.
> Chris
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>

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

Re: PostgreSQL on Linux and Solaris comparison

From
"scott.marlowe"
Date:
On 31 Oct 2002, Chris wrote:

> Hi,
>
> I am using PostgresSQL 7.1.3 on both Linux and Solaris envrionment.
> Development is using the Linux and production is using Solaris. I
> experienced that the perfomrance on Solaris is much worse than Linux.
> For example, the same query executed 9 seconds on Solaris and only 1
> seconds on Linux.
>
> Is there any help upgrading the 7.1.3 to 7.2.3? Or how can I do some
> performance tunning on Solaris?

There are several issues at play here, some of which you can fix, some of
which you can't.

One is that older flavors of Solaris had a broken sort() command built
into them that was VERY slow when sorting a list with lots of non-unique
keys.

Another is that fact that Solaris has a "heavy process, light thread"
scheduler design.  This means that Solaris favors a few processes with
many threads for good performance, while Postgresql is programmed on the
many processes, what the heck is a thread design.

The many process no thread design is very robust.  But not so fast on
Solaris and Windows, where threads are the preferred implementation
method.

On Linux, threads and processes are equally fast, so the design of
Postgresql is no problem there.

If you have time to play, you might try loading debian on your Sparc boxen
and comparing postgresql on the same hardware under both Solaris and
Linux.  You'll likely find Postgresql to be about twice as fast under
Linux on Sparc hardware as it is under Solaris.  At least that's what I've
seen.  (My Sparc 20 32 bit machine at 50MHz running Linux easily bested a
150MHz 64 bit Sun Ultra 1 running solaris when benchmarking Postgresql by
about 20 to 50%.)

Also, try Postgresql 7.3b5 which just came out and see how that runs on
both.  There have been some performance improvements that should make both
run faster.


Re: PostgreSQL on Linux and Solaris comparison

From
Bruce Momjian
Date:
scott.marlowe wrote:
> On 31 Oct 2002, Chris wrote:
>
> > Hi,
> >
> > I am using PostgresSQL 7.1.3 on both Linux and Solaris envrionment.
> > Development is using the Linux and production is using Solaris. I
> > experienced that the perfomrance on Solaris is much worse than Linux.
> > For example, the same query executed 9 seconds on Solaris and only 1
> > seconds on Linux.
> >
> > Is there any help upgrading the 7.1.3 to 7.2.3? Or how can I do some
> > performance tunning on Solaris?
>
> There are several issues at play here, some of which you can fix, some of
> which you can't.
>
> One is that older flavors of Solaris had a broken sort() command built
> into them that was VERY slow when sorting a list with lots of non-unique
> keys.

Right, in fact, I have seen no evidence that newer Solaris versions have
this fixed, so the problem may still exist, though there is a workaround
in 7.3beta.

> Another is that fact that Solaris has a "heavy process, light thread"
> scheduler design.  This means that Solaris favors a few processes with
> many threads for good performance, while Postgresql is programmed on the
> many processes, what the heck is a thread design.

I didn't mention that because he was saying 1 vs. 9 seconds, so I
assumed process startup time was not an issue.

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

Re: PostgreSQL on Linux and Solaris comparison

From
"scott.marlowe"
Date:
On Thu, 7 Nov 2002, Bruce Momjian wrote:

> scott.marlowe wrote:
> > On 31 Oct 2002, Chris wrote:
> >
> > > Hi,
> > >
> > > I am using PostgresSQL 7.1.3 on both Linux and Solaris envrionment.
> > > Development is using the Linux and production is using Solaris. I
> > > experienced that the perfomrance on Solaris is much worse than Linux.
> > > For example, the same query executed 9 seconds on Solaris and only 1
> > > seconds on Linux.
> > >
> > > Is there any help upgrading the 7.1.3 to 7.2.3? Or how can I do some
> > > performance tunning on Solaris?
> >
> > There are several issues at play here, some of which you can fix, some of
> > which you can't.
> >
> > One is that older flavors of Solaris had a broken sort() command built
> > into them that was VERY slow when sorting a list with lots of non-unique
> > keys.
>
> Right, in fact, I have seen no evidence that newer Solaris versions have
> this fixed, so the problem may still exist, though there is a workaround
> in 7.3beta.

I thought I had seen somewhere that Sun had a patch out to fix that.  I'll
have to check again.

> > Another is that fact that Solaris has a "heavy process, light thread"
> > scheduler design.  This means that Solaris favors a few processes with
> > many threads for good performance, while Postgresql is programmed on the
> > many processes, what the heck is a thread design.
>
> I didn't mention that because he was saying 1 vs. 9 seconds, so I
> assumed process startup time was not an issue.

Agreed, but the performance issue on Solaris versus Linux for postgresql
seems to be more than just process startup time.  It's like almost
everything is about 50% to 100% faster in Linux than on sparc than in
Solaris on Sparc as regards postgresql (I tested 7.2.x last time, haven't
played with 7.3 on linux / sparc).

Note that this same performance issue seems to rear its head with things
like apache 1.3.x, and samba.  We've built samba servers here on Sun 4200s
that couldn't keep up with old Pentium Pro - 200 boxes running Linux, and
nothing we could tweak would get the Solaris box up to speed in
comparison to Linux.

It might be something to do with better shared memory performance or disk
access is faster, or a conglomeration of things.

I think part of it is that Solaris is so heavily optimized to scale to
umpteen processors that the number of spinlocks (rumored to be around
4,000 at last count) in the kernel just make solaris not all that fast on
one or two processors.

My guess is that just going to 7.2.3 would make a big difference, it could
be something as simple as the older query planner in 7.1 making really bad
decisions on the solaris box as well.  While the 7.2 planner isn't
perfect, it seems miles ahead of the one in 7.1.x.

7.3 is still too early in beta for deployment to production, but it's a
good time now to start testing it.


Re: PostgreSQL on Linux and Solaris comparison

From
Neil Conway
Date:
"scott.marlowe" <scott.marlowe@ihs.com> writes:
> Agreed, but the performance issue on Solaris versus Linux for postgresql
> seems to be more than just process startup time.  It's like almost
> everything is about 50% to 100% faster in Linux than on sparc than in
> Solaris on Sparc as regards postgresql (I tested 7.2.x last time, haven't
> played with 7.3 on linux / sparc).
>
> Note that this same performance issue seems to rear its head with things
> like apache 1.3.x, and samba.

Perhaps someone that is using Solaris w/ PostgreSQL and is actually
experiencing this degraded performance can provide some empirical
data? For instance, profile an operation on Solaris, compare it with a
similar profile on Linux/BSD/etc., and try to figure out where the
performance hit is coming from. It may or may not be something that we
can improve on...

> It might be something to do with better shared memory performance or disk
> access is faster, or a conglomeration of things.

Well, we use Intimate Shared Memory (ISM) on Solaris in 7.3 -- that
should at least be a slight performance improvement over shm on other
platforms, as ISM uses huge TLB pages.

Cheers,

Neil

--
Neil Conway <neilc@samurai.com> || PGP Key ID: DB3C29FC

Re: PostgreSQL on Linux and Solaris comparison

From
"scott.marlowe"
Date:
On 7 Nov 2002, Neil Conway wrote:

> "scott.marlowe" <scott.marlowe@ihs.com> writes:
> > Agreed, but the performance issue on Solaris versus Linux for postgresql
> > seems to be more than just process startup time.  It's like almost
> > everything is about 50% to 100% faster in Linux than on sparc than in
> > Solaris on Sparc as regards postgresql (I tested 7.2.x last time, haven't
> > played with 7.3 on linux / sparc).
> >
> > Note that this same performance issue seems to rear its head with things
> > like apache 1.3.x, and samba.
>
> Perhaps someone that is using Solaris w/ PostgreSQL and is actually
> experiencing this degraded performance can provide some empirical
> data? For instance, profile an operation on Solaris, compare it with a
> similar profile on Linux/BSD/etc., and try to figure out where the
> performance hit is coming from. It may or may not be something that we
> can improve on...
>
> > It might be something to do with better shared memory performance or disk
> > access is faster, or a conglomeration of things.
>
> Well, we use Intimate Shared Memory (ISM) on Solaris in 7.3 -- that
> should at least be a slight performance improvement over shm on other
> platforms, as ISM uses huge TLB pages.

sounds like it's time to req one of our semi-retired SPARC boxen then...

:-)