Re: AIO v2.0

From: Andres Freund <andres(at)anarazel(dot)de>
To: 陈宗志 <baotiao(at)gmail(dot)com>
Cc: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: AIO v2.0
Date: 2024-09-06 19:47:35
Message-ID: 4gqgbziuexn57o47t5ovvwok4n4tiuznhrxi44cau6kv6zsfga@vuyxkxznp3uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2024-09-05 01:37:34 +0800, 陈宗志 wrote:
> I hope there can be a high-level design document that includes a
> description, high-level architecture, and low-level design.
> This way, others can also participate in reviewing the code.

Yep, that was already on my todo list. The version I just posted includes
that.

> For example, which paths were modified in the AIO module?
> Is it the path for writing WAL logs, or the path for flushing pages, etc.?

I don't think it's good to document this in a design document - that's just
bound to get out of date.

For now the patchset causes AIO to be used for

1) all users of read_stream.h, e.g. sequential scans

2) bgwriter / checkpointer, mainly to have way to exercise the write path. As
mentioned in my email upthread, the code for that is in a somewhat rough
shape as Thomas Munro is working on a more general abstraction for some of
this.

The earlier patchset added a lot more AIO uses because I needed to know all
the design constraints. It e.g. added AIO use in WAL. While that allowed me to
learn a lot, it's not something that makes sense to continue working on for
now, as it requires a lot of work that's independent of AIO. Thus I am
focusing on the above users for now.

> Also, I recommend keeping this patch as small as possible.

Yep. That's my goal (as mentioned upthread).

> For example, the first step could be to introduce libaio only, without
> considering io_uring, as that would make it too complex.

Currently the patchset doesn't contain libaio support and I am not planning to
work on using libaio. Nor do I think it makes sense for anybody else to do so
- libaio doesn't work for buffered IO, making it imo not particularly useful
for us.

The io_uring specific code isn't particularly complex / large compared to the
main AIO infrastructure.

Greetings,

Andres Freund

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2024-09-06 21:07:10 Re: pg_trgm comparison bug on cross-architecture replication due to different char implementation
Previous Message Tom Lane 2024-09-06 19:43:55 Re: Remove hardcoded hash opclass function signature exceptions