rgw: async support for posix backend
in today's refactoring call, we discussed the topic of async reads/writes for file-based backends, using zipper's optional_yield argument we can start by trying out asio's new asio::stream_file[1] and asio::random_access_file[2] classes based on io_uring. both classes can be constructed with an existing file descriptor using the 'native_handle_type' overload an example read function: // read into the given buffer, returning the number of bytes read. throws on errors size_t read_some(asio::stream_file& file, std::span<char> buffer, optional_yield y) { if (y) { return file.async_read_some(buffer, y.get_yield_context()); } else { return file.read_some(buffer); } } the synchronous case probably won't be that simple, since we won't have an asio::io_context to construct the asio::stream_file with. we might just fall back to the read system call there [1] https://www.boost.org/doc/libs/1_79_0/doc/html/boost_asio/reference/stream_f... [2] https://www.boost.org/doc/libs/1_79_0/doc/html/boost_asio/reference/random_a...
On Wed, Mar 22, 2023 at 3:12 PM Casey Bodley <cbodley@redhat.com> wrote:
we can start by trying out asio's new asio::stream_file[1] and asio::random_access_file[2] classes based on io_uring. both classes can be constructed with an existing file descriptor using the 'native_handle_type' overload
now that's encouraging
the synchronous case probably won't be that simple, since we won't have an asio::io_context to construct the asio::stream_file with. we might just fall back to the read system call there
what is the synchronous case? normally sync can be implemented on async? Matt -- Matt Benjamin Red Hat, Inc. 315 West Huron Street, Suite 140A Ann Arbor, Michigan 48103 http://www.redhat.com/en/technologies/storage tel. 734-821-5101 fax. 734-769-8938 cel. 734-216-5309
On Wed, Mar 22, 2023 at 4:14 PM Matt Benjamin <mbenjami@redhat.com> wrote:
On Wed, Mar 22, 2023 at 3:12 PM Casey Bodley <cbodley@redhat.com> wrote:
we can start by trying out asio's new asio::stream_file[1] and asio::random_access_file[2] classes based on io_uring. both classes can be constructed with an existing file descriptor using the 'native_handle_type' overload
now that's encouraging
the synchronous case probably won't be that simple, since we won't have an asio::io_context to construct the asio::stream_file with. we might just fall back to the read system call there
what is the synchronous case? normally sync can be implemented on async?
now that i think on it more, there isn't really a synchronous case here at all even with civetweb, the rados object reads/writes were asynchronous via librados' aio_operate(). both because librados can read/write chunks on separate OSDs in parallel, and because we're also streaming data to/from the frontend socket at the same time for file i/o, we need to implement rgw::Aio::OpFunc for the reads and writes, similar to the Aio::librados_op()s for librados::ObjectReadOperation and ObjectWriteOperation. i opened a draft PR at https://github.com/ceph/ceph/pull/50635 that shows what those OpFuncs look like
Matt
--
Matt Benjamin Red Hat, Inc. 315 West Huron Street, Suite 140A Ann Arbor, Michigan 48103
http://www.redhat.com/en/technologies/storage
tel. 734-821-5101 fax. 734-769-8938 cel. 734-216-5309
participants (2)
-
Casey Bodley
-
Matt Benjamin