Re: [HACKERS] lseek/read/write overhead becomes visible at scale ..

From: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Tobias Oberstein <tobias(dot)oberstein(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] lseek/read/write overhead becomes visible at scale ..
Date: 2018-04-16 05:40:35
Message-ID: CAEepm=3BGNbWaznawm3LVk69ucKqXdAcb-aboG8cK375GcsMdQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jun 23, 2017 at 4:50 AM, Andres Freund <andres(at)anarazel(dot)de> wrote:
> On 2017-06-22 12:43:16 -0400, Robert Haas wrote:
>> On Wed, Jan 25, 2017 at 2:52 PM, Andres Freund <andres(at)anarazel(dot)de> wrote:
>> > You'll, depending on your workload, still have a lot of lseeks even if
>> > we were to use pread/pwrite because we do lseek(SEEK_END) to get file
>> > sizes.
>>
>> I'm pretty convinced that the lseek overhead that we're incurring
>> right now is excessive.
>
> No argument there.

My 2c:

* every comparable open source system I looked at uses pread() if it's available
* speedups have been claimed
* it's also been claimed that readahead heuristics are not defeated on
Linux or FreeBSD, which isn't too surprising because you'd expect it
to be about blocks being faulted in, not syscalls
* just in case there exists an operating system that has pread() but
doesn't do readahead in that case, we could provide a compile-time
option to select the fallback mode (until such time as you can get
that bug fixed in your OS?)
* syscalls aren't getting cheaper, and this is a 2-for-1 deal, what's
not to like?

+1 for adopting pread()/pwrite() in PG12.

I understand that the use of lseek() to find file sizes is a different
problem and unrelated.

--
Thomas Munro
http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Gierth 2018-04-16 06:13:30 Re: [HACKERS] lseek/read/write overhead becomes visible at scale ..
Previous Message Kyotaro HORIGUCHI 2018-04-16 02:54:35 Re: Reopen logfile on SIGHUP