Re: Windows performance

From: George Neuner <gneuner2(at)comcast(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Windows performance
Date: 2016-02-12 22:28:52
Message-ID: ikjsbb1g1gbl67k025mreicopgct17h91a@4ax.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, 12 Feb 2016 15:37:37 +0000, "Sterpu Victor" <victor(at)caido(dot)ro>
wrote:

>Why is Postgres so slow on Windows compared to linux?
>Can I do something to match the performance?
>I have 2 servers:
>- one is Windows 8, CPU XEON, 8 CORES, 32G of RAM - my test query runs
>in 17 seconds
>- the other is Linux CPU XEON, 4 cores, 4 Gh of RAM - my test query runs
>in 2 seconds
>I run the query on the same database.
>
>CPU is not used at max on the servers, RAM is fine.
>Is there a problem with Windows? My gues is that Windows is not using
>the hardware resources as it should be.
>Can I do something to fix this?
>
>Thank you.

Windows and Linux have very different cache, memory management, and
processor affinity behavior.

Additionally, Windows has suboptimal support for many POSIX features.
John Pierce mentioned the possibility of semaphores (locks) being the
problem. If Posgresql uses POSIX locks on Window, that could
significantly impact performace (vs using Windows native locks).

In Linux the distinction between a "workstation" and a "server" is
largely a matter of system configuration. Windows "desktop" and
"server" editions are different code bases: there are no magic
settings that can make one equivalent to the other.

Windows in general needs more RAM than Linux, but given comparable
resources, Windows server editions will have comparable performance.

Windows desktop editions are designed around the expectation that
there is a single interactive user. They are not meant to be used as
servers.

That all said, I think 17 seconds vs 2 is far too much difference.
Assuming that Windows itself is running properly [e.g., not
accidentally using PIO mode for disk I/O or something similarly
stupid], it suggests that the servers are not configured the same, or
that the usage statistics for the Windows version are wildly incorrect
and that is throwing off query planning.

Did you analyze your database after moving it to Windows?

Another possibility is that the Windows tablespace is highly
fragmented. Moderate levels of fragmentation don't really matter for
either Windows or Linux, but high file fragmentation favors Linux.

For best performance Postgresql really should to be tuned differently
for Windows than for Linux. Unfortunately, although I am aware of
many of the differences between the operating systems, I'm not any
kind of expert at tuning Postgresql.

Hope this helps,
George

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message John R Pierce 2016-02-12 22:43:55 Re: Windows performance
Previous Message Sebastian P. Luque 2016-02-12 22:19:07 Re: 9.4 -> 9.5 dump size reduction