From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
---|---|
To: | Dave Chinner <david(at)fromorbit(dot)com> |
Cc: | Kevin Grittner <kgrittn(at)ymail(dot)com>, Jan Kara <jack(at)suse(dot)cz>, Hannu Krosing <hannu(at)2ndquadrant(dot)com>, Andres Freund <andres(at)2ndquadrant(dot)com>, Josh Berkus <josh(at)agliodbs(dot)com>, Trond Myklebust <trondmy(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, Joshua Drake <jd(at)commandprompt(dot)com>, James Bottomley <James(dot)Bottomley(at)hansenpartnership(dot)com>, Mel Gorman <mgorman(at)suse(dot)de>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "lsf-pc(at)lists(dot)linux-foundation(dot)org" <lsf-pc(at)lists(dot)linux-foundation(dot)org>, Magnus Hagander <magnus(at)hagander(dot)net> |
Subject: | Re: [Lsf-pc] Linux kernel impact on PostgreSQL performance |
Date: | 2014-01-15 13:55:02 |
Message-ID: | CA+TgmoZk5z4A_eU6VqQcRupK=Z6os5h2e=zeoNm3gUq8vc1f2w@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Tue, Jan 14, 2014 at 5:23 PM, Dave Chinner <david(at)fromorbit(dot)com> wrote:
> By default, background writeback doesn't start until 10% of memory
> is dirtied, and on your machine that's 25GB of RAM. That's way to
> high for your workload.
>
> It appears to me that we are seeing large memory machines much more
> commonly in data centers - a couple of years ago 256GB RAM was only
> seen in supercomputers. Hence machines of this size are moving from
> "tweaking settings for supercomputers is OK" class to "tweaking
> settings for enterprise servers is not OK"....
>
> Perhaps what we need to do is deprecate dirty_ratio and
> dirty_background_ratio as the default values as move to the byte
> based values as the defaults and cap them appropriately. e.g.
> 10/20% of RAM for small machines down to a couple of GB for large
> machines....
I think that's right. In our case we know we're going to call fsync()
eventually and that's going to produce a torrent of I/O. If that
torrent fits in downstream caches or can be satisfied quickly without
disrupting the rest of the system too much, then life is good. But
the downstream caches don't typically grow proportionately to the size
of system memory. Maybe a machine with 16GB has 1GB of battery-backed
write cache, but it doesn't follow that 256GB machine has 16GB of
battery-backed write cache.
> Essentially, changing dirty_background_bytes, dirty_bytes and
> dirty_expire_centiseconds to be much smaller should make the kernel
> start writeback much sooner and so you shouldn't have to limit the
> amount of buffers the application has to prevent major fsync
> triggered stalls...
I think this has been tried with some success, but I don't know the
details. I think the bytes values are clearly more useful than the
percentages, because you can set them smaller and with better
granularity.
One thought that occurs to me is that it might be useful to have
PostgreSQL tell the system when we expect to perform an fsync.
Imagine fsync_is_coming(int fd, time_t). We know long in advance
(minutes) when we're gonna do it, so in some sense what we'd like to
tell the kernel is: we're not in a hurry to get this data on disk
right now, but when the indicated time arrives, we are going to do
fsyncs of a bunch of files in rapid succession, so please arrange to
flush the data as close to that time as possible (to maximize
write-combining) while still finishing by that time (so that the
fsyncs are fast and more importantly so that they don't cause a
system-wide stall).
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
From | Date | Subject | |
---|---|---|---|
Next Message | Marko Tiikkaja | 2014-01-15 13:58:58 | Re: plpgsql.warn_shadow |
Previous Message | Robert Haas | 2014-01-15 13:42:16 | Re: [Lsf-pc] Linux kernel impact on PostgreSQL performance |