Thread: Performance of PostgreSQL on Windows vs Linux

Performance of PostgreSQL on Windows vs Linux

From
"Jeremy Haile"
Date:
I am sure that this has been discussed before, but I can't seem to find
any recent posts. (I am running PostgreSQL 8.2)

I have always ran PostgreSQL on Linux in the past, but the company I am
currently working for uses Windows on all of their servers.  I don't
have the luxury right now of running my own benchmarks on the two OSes,
but wanted to know if anyone else has done a performance comparison.  Is
there any significant differences?

Re: Performance of PostgreSQL on Windows vs Linux

From
Magnus Hagander
Date:
Jeremy Haile wrote:
> I am sure that this has been discussed before, but I can't seem to find
> any recent posts. (I am running PostgreSQL 8.2)
>
> I have always ran PostgreSQL on Linux in the past, but the company I am
> currently working for uses Windows on all of their servers.  I don't
> have the luxury right now of running my own benchmarks on the two OSes,
> but wanted to know if anyone else has done a performance comparison.  Is
> there any significant differences?

That depends on your usage pattern. There are certainly cases where the
Win32 version will be significantly slower.
For example, if you open a lot of new connections, that is a lot more
expensive on Windows since each connection needs to execute a new
backend due to the lack of fork().

I don't think you'll find any case where the Windows version is faster
than Linux ;-) But to get a good answer on if the difference is
significant enough to matter, you really need to run some kind of simple
benchmark on *your* workload.

//Magnus

Re: Performance of PostgreSQL on Windows vs Linux

From
Dimitri Fontaine
Date:
Le jeudi 4 janvier 2007 00:18, Magnus Hagander a écrit :
> But to get a good answer on if the difference is
> significant enough to matter, you really need to run some kind of simple
> benchmark on *your* workload.

To easily stress test a couple of servers and compare results on *your*
workload, please consider using both pgfouine[1,2] and tsung[3].

The companion tool tsung-ploter[4] (for plotting several results using common
graph, hence scales), may also be usefull.

[1]: http://pgfouine.projects.postgresql.org/
[2]: http://pgfouine.projects.postgresql.org/tsung.html
[3]: http://tsung.erlang-projects.org/
[4]: http://debian.dalibo.org/unstable/tsung-ploter_0.1-1.tar.gz

Regards,
--
Dimitri Fontaine
http://www.dalibo.com/

Attachment

Re: Performance of PostgreSQL on Windows vs Linux

From
"Jeremy Haile"
Date:
Thanks for the recommendations.  I wasn't familiar with those packages!

On Thu, 4 Jan 2007 00:46:32 +0100, "Dimitri Fontaine" <dim@dalibo.com>
said:
> Le jeudi 4 janvier 2007 00:18, Magnus Hagander a écrit :
> > But to get a good answer on if the difference is
> > significant enough to matter, you really need to run some kind of simple
> > benchmark on *your* workload.
>
> To easily stress test a couple of servers and compare results on *your*
> workload, please consider using both pgfouine[1,2] and tsung[3].
>
> The companion tool tsung-ploter[4] (for plotting several results using
> common
> graph, hence scales), may also be usefull.
>
> [1]: http://pgfouine.projects.postgresql.org/
> [2]: http://pgfouine.projects.postgresql.org/tsung.html
> [3]: http://tsung.erlang-projects.org/
> [4]: http://debian.dalibo.org/unstable/tsung-ploter_0.1-1.tar.gz
>
> Regards,
> --
> Dimitri Fontaine
> http://www.dalibo.com/

Re: Performance of PostgreSQL on Windows vs Linux

From
"Jeremy Haile"
Date:
Thanks for the response!  I know I have to benchmark them to get a real
answer.  I am just looking to hear someone say "We benchmarked Linux vs.
Windows with similar configuration and hardware and experienced a 25%
performance boost in Linux."  or "We benchmarked them and found no
significant difference."

I realize the situation varies based on usage patterns, but I'm just
looking for some general info based on anyone else's experiences.

My usage pattern is a single application that hits the database.  The
application uses a connection pool, so opening lots of connections is
not a huge issue.  However - it does have very large tables and
regularly queries and inserts into these tables.  I insert several
million rows into 3 tables every day - and also delete about the same
amount.



On Thu, 04 Jan 2007 00:18:23 +0100, "Magnus Hagander"
<magnus@hagander.net> said:
> Jeremy Haile wrote:
> > I am sure that this has been discussed before, but I can't seem to find
> > any recent posts. (I am running PostgreSQL 8.2)
> >
> > I have always ran PostgreSQL on Linux in the past, but the company I am
> > currently working for uses Windows on all of their servers.  I don't
> > have the luxury right now of running my own benchmarks on the two OSes,
> > but wanted to know if anyone else has done a performance comparison.  Is
> > there any significant differences?
>
> That depends on your usage pattern. There are certainly cases where the
> Win32 version will be significantly slower.
> For example, if you open a lot of new connections, that is a lot more
> expensive on Windows since each connection needs to execute a new
> backend due to the lack of fork().
>
> I don't think you'll find any case where the Windows version is faster
> than Linux ;-) But to get a good answer on if the difference is
> significant enough to matter, you really need to run some kind of simple
> benchmark on *your* workload.
>
> //Magnus

Re: Performance of PostgreSQL on Windows vs Linux

From
Tom Lane
Date:
"Jeremy Haile" <jhaile@fastmail.fm> writes:
> Thanks for the response!  I know I have to benchmark them to get a real
> answer.  I am just looking to hear someone say "We benchmarked Linux vs.
> Windows with similar configuration and hardware and experienced a 25%
> performance boost in Linux."  or "We benchmarked them and found no
> significant difference."

I've heard anecdotal reports both ways: "there's no difference" and
"there's a big difference".  So there's no substitute for benchmarking
your own application.

I think one big variable in this is which PG version you are testing.
We've been gradually filing down some of the rough edges in the native
Windows port, so I'd expect that the performance gap is closing over
time.  I don't know how close to closed it is in 8.2, but I'd surely
suggest that you do your benchmarking with 8.2.

            regards, tom lane

Re: Performance of PostgreSQL on Windows vs Linux

From
"Jeremy Haile"
Date:
I'm using 8.2.  I don't know when I'll get a chance to run my own
benchmarks.  (I don't currently have access to a Windows and Linux
server with similar hardware/configuration) But when/if I get a chance
to run them, I will post the results here.

Thanks for the feedback.

Jeremy Haile


On Thu, 04 Jan 2007 10:23:51 -0500, "Tom Lane" <tgl@sss.pgh.pa.us> said:
> "Jeremy Haile" <jhaile@fastmail.fm> writes:
> > Thanks for the response!  I know I have to benchmark them to get a real
> > answer.  I am just looking to hear someone say "We benchmarked Linux vs.
> > Windows with similar configuration and hardware and experienced a 25%
> > performance boost in Linux."  or "We benchmarked them and found no
> > significant difference."
>
> I've heard anecdotal reports both ways: "there's no difference" and
> "there's a big difference".  So there's no substitute for benchmarking
> your own application.
>
> I think one big variable in this is which PG version you are testing.
> We've been gradually filing down some of the rough edges in the native
> Windows port, so I'd expect that the performance gap is closing over
> time.  I don't know how close to closed it is in 8.2, but I'd surely
> suggest that you do your benchmarking with 8.2.
>
>             regards, tom lane

Re: Performance of PostgreSQL on Windows vs Linux

From
"Jim C. Nasby"
Date:
On Wed, Jan 03, 2007 at 12:24:24PM -0500, Jeremy Haile wrote:
> I am sure that this has been discussed before, but I can't seem to find
> any recent posts. (I am running PostgreSQL 8.2)
>
> I have always ran PostgreSQL on Linux in the past, but the company I am
> currently working for uses Windows on all of their servers.  I don't
> have the luxury right now of running my own benchmarks on the two OSes,
> but wanted to know if anyone else has done a performance comparison.  Is
> there any significant differences?

One thing to consider... I've seen a case or two where pgbench running
on windows with HyperThreading enabled was actually faster than with it
turned off. (General experience has been that HT hurts PostgreSQL). I
suspect that the windows kernel may have features that allow it to
better utilize HT than linux.

Of course if you don't have HT... it doesn't matter. :)
--
Jim Nasby                                            jim@nasby.net
EnterpriseDB      http://enterprisedb.com      512.569.9461 (cell)

Re: Performance of PostgreSQL on Windows vs Linux

From
"Jeremy Haile"
Date:
Hey Jim -

Thanks for the feedback.  The server has dual Xeons with HyperThreading
enabled - so perhaps I should try disabling it.  How much performance
boost have you seen by disabling it?  Of course, the bottleneck in my
case is more on the I/O or RAM side, not the CPU side.

Jeremy Haile


On Wed, 10 Jan 2007 14:15:26 -0600, "Jim C. Nasby" <jim@nasby.net> said:
> On Wed, Jan 03, 2007 at 12:24:24PM -0500, Jeremy Haile wrote:
> > I am sure that this has been discussed before, but I can't seem to find
> > any recent posts. (I am running PostgreSQL 8.2)
> >
> > I have always ran PostgreSQL on Linux in the past, but the company I am
> > currently working for uses Windows on all of their servers.  I don't
> > have the luxury right now of running my own benchmarks on the two OSes,
> > but wanted to know if anyone else has done a performance comparison.  Is
> > there any significant differences?
>
> One thing to consider... I've seen a case or two where pgbench running
> on windows with HyperThreading enabled was actually faster than with it
> turned off. (General experience has been that HT hurts PostgreSQL). I
> suspect that the windows kernel may have features that allow it to
> better utilize HT than linux.
>
> Of course if you don't have HT... it doesn't matter. :)
> --
> Jim Nasby                                            jim@nasby.net
> EnterpriseDB      http://enterprisedb.com      512.569.9461 (cell)

Re: Performance of PostgreSQL on Windows vs Linux

From
Scott Marlowe
Date:
On Wed, 2007-01-10 at 14:15, Jim C. Nasby wrote:
> On Wed, Jan 03, 2007 at 12:24:24PM -0500, Jeremy Haile wrote:
> > I am sure that this has been discussed before, but I can't seem to find
> > any recent posts. (I am running PostgreSQL 8.2)
> >
> > I have always ran PostgreSQL on Linux in the past, but the company I am
> > currently working for uses Windows on all of their servers.  I don't
> > have the luxury right now of running my own benchmarks on the two OSes,
> > but wanted to know if anyone else has done a performance comparison.  Is
> > there any significant differences?
>
> One thing to consider... I've seen a case or two where pgbench running
> on windows with HyperThreading enabled was actually faster than with it
> turned off. (General experience has been that HT hurts PostgreSQL). I
> suspect that the windows kernel may have features that allow it to
> better utilize HT than linux.

I've also seen a few comments in perform (and elsewhere) in the past
that newer linux kernels seem to handle HT better than older ones, and
also might give better numbers for certain situations.

Note that you should really test with a wide variety of loads (i.e. a
lot of parallel loads, a few etc...) to see what the curve looks like.
If HT gets you 10% gain on 4 or fewer clients, but 20% slower with 8
clients, then hyperthreading might be a not so good choice.