Re: Speed differences between two servers

From: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
To: Vincent Veyron <vv(dot)lists(at)wanadoo(dot)fr>
Cc: "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Speed differences between two servers
Date: 2017-05-08 18:48:29
Message-ID: CAOR=d=2pkqevObyW8ZGFjeAF0WoLEmAEYmehwZSZK5f2qxZMSQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Mon, May 8, 2017 at 11:49 AM, Vincent Veyron <vv(dot)lists(at)wanadoo(dot)fr> wrote:
> Hello,
>
> I use two dedicated bare metal servers (Online and Kimsufi). The first one takes much longer to execute a procedure that recreates a database by truncating its tables, then copying the data from a set of text files; it is however much faster for more typical SELECT and INSERT queries done by users.
>
> Here is the timing for the procedure :
>
> #Kimsufi server
> time psql -f myfile.sql mydb
> real 0m12.585s
> user 0m0.200s
> sys 0m0.076s
>
> #Online server
> time psql -f myfile.sql mydb
> real 1m15.410s
> user 0m0.144s
> sys 0m0.028s
>
> My questions:
>
> -Does the difference in 'buffered disk reads' explain the 6 fold increase in execution time for truncate/copy on the Online server?

The most likely cause of the difference would be that one server IS
honoring fsync requests from the db and the other one isn't.

If you run pgbench on both (something simple like pgbench -c 1 -T 60,
aka one thread for 60 seconds) on a machine running on a 7200RPM hard
drive, you should get approximately 120 transactions per second, or
less, since that's how many times a second a disk spinning at that
speed can write out data. If you get say 110 on the slow machine and
800 on the fast one, there's the culprit, the fast machine is not
honoring fsync requests and is not crash-safe. I.e. if you start
writing to the db and pull the power plug out the back of the machine
it will likely power up with a corrupted database.

> -Why are regular queries much faster on this same server?

That's a whole nother subject. Most likely the faster machine can fit
the whole db in memory, or has much faster memory, or the whole
dataset is cached etc etc.

For now concentrate on figuring out of you've got an fsync problem. If
the data is just test data etc that you can afford to lose then you
can leave off fsync and not worry. But in production this is rarely
the case.

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Scott Marlowe 2017-05-08 18:50:41 Re: Postgres performance issue
Previous Message Vincent Veyron 2017-05-08 17:49:22 Speed differences between two servers