Re: PostgreSQL, Asynchronous I/O, Buffered I/O and why did fsync-gate not affect Oracle or MySQL? - Mailing list pgsql-general

From Peter J. Holzer
Subject Re: PostgreSQL, Asynchronous I/O, Buffered I/O and why did fsync-gate not affect Oracle or MySQL?
Date
Msg-id 20210502193018.GA6136@hjp.at
Whole thread Raw
In response to PostgreSQL, Asynchronous I/O, Buffered I/O and why did fsync-gate not affect Oracle or MySQL?  (Pól Ua Laoínecháin <linehanp@tcd.ie>)
Responses Re: PostgreSQL, Asynchronous I/O, Buffered I/O and why did fsync-gate not affect Oracle or MySQL?
List pgsql-general
On 2021-05-02 14:46:41 +0100, Pól Ua Laoínecháin wrote:
> Now, I'm not quite sure that I completely comprehend matters: Is there
> a difference between Asynchronous I/O and Buffered I/O?

Yes.

Buffered I/O means that there is a buffer (or maybe several layers of
buffers) between the application and the device: A read request might
return data which has been cached from a previous read request without
touching the device. And a write request will return as soon as the data
is written to the buffer (it will be written to the device at some later
time). The opposite of buffered I/O is direct I/O, which always talks
directly to the device and doesn't use any buffers.

Asynchronous I/O refers to a different programming model: Any read or
write request only initiates the data transfer and returns immediately.
The application will later be notified when the request is finished.
This is very different from the traditional (in Unix) synchronous
programming model where a read would block until the data was actually
available and a write would block until the data was safely transferred
to the OS's buffer cache (and can be overwritten by the application).

In theory all four combinations (buffered synchronous, buffered
asynchronous, direct synchronous, direct asynchronous) are possible, but
some OS's may not implement all of them.

        hp


--
   _  | Peter J. Holzer    | Story must make more sense than reality.
|_|_) |                    |
| |   | hjp@hjp.at         |    -- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |       challenge!"

Attachment

pgsql-general by date:

Previous
From: Ron
Date:
Subject: Re: PostgreSQL, Asynchronous I/O, Buffered I/O and why did fsync-gate not affect Oracle or MySQL?
Next
From: "Peter J. Holzer"
Date:
Subject: Re: Is this the future of I/O for the RDBMS?