Bug #20110
closed
RBD aio_ API does not provide awaiting of any completion from a list.
Added by Марк Коренберг almost 7 years ago.
Updated over 6 years ago.
Description
Suppose I want to copy RBD image in parallel 10 streams. Well, I can run 10 aio_read() functions and associate them with 10 completions respectively. Next I want to wait until any of them is complete to run another read operation (to keep 10 running streams reading).
This is impossible now without using of threads. But what is purpose of these aio functions if I have to use threads ?
Other async frameworks (Python's asyncio, tornado, twisted, also Nodejs) have such functions. But CEPH does not.
So, I want to have function that will wait until all scheduled aio operations are complete. This function should also wait for aio operations that was added from callbacks associated with operations it waits for.
Another way is to have function that receives an array of completions and returns which one has completed.
Ideally, with optional timeout.
- Project changed from Ceph to rbd
- Status changed from New to Need More Info
@Марк: I am probably not understanding your goal, but since you can associate a callback with a completion, and said callback can kick off a new IO if desired, there really shouldn't be any need for multiple threads for high-queue depth IO.
So, how should I wait for whole transfer completion?
What is the difference between rbd_read2() and rbd_aio_read2()+rbd_aio_wait_for_complete() ? If I want to track more than one AIO operation simultaneously, I should create threads. But if I use threads, I can use rbd_read2() directly.
The main idea: If we have abstract AIO operations, we should have some event loop. This mean waiting for ANY event (or timer) from multiple streams. Today, we have no such thing.
About kicking additional IO from callbacks -- Yes, I already done that. But it is proven, that callback-chains is very bad pattern. Thiat's why all modern asynchronous frameworks hav "await" functionality.
Please don't close the bug, I will say more if it is required.
@Марк: can you provide an example? Your ticket description clearly states "next I want to wait until any of them is complete to run another read operation" which you can do via the AIO completion callback. You can either have your callback directly kick off the next IO operation or have your callback decrement a counter and signal a condition variable to wake up your paused main thread (which is what the rbd CLI does when using AIO for import/export/benchmark).
I am not saying this is invalid and will be closed, but perhaps it's just very low priority unless you would like to contribute a PR for this feature.
- Status changed from Need More Info to Closed
Closing due to lack of input. Please re-open if data can be provided.
Also available in: Atom
PDF