Replies: 2 comments 2 replies
-
Ime, I've found linked timeouts to have a relatively heavy performance cost when used en masse. What I do nowadays is start a multishot timer alongside my I/O operations that runs continuously. Then I add simple activity tracking to my I/O operations and when the timer periodically expires, it examines the time of the most recent activity and if required, will cancel the appropriate operation. i.e. when an I/O op completes, I'll update the "last activity" with a call to |
Beta Was this translation helpful? Give feedback.
-
edit: removed |
Beta Was this translation helpful? Give feedback.
-
Greetings, io_uring community!
There is a read -> write SQE chain:
prep_read(fd1, buf, buflen, -1) -> prep_write(fd2, buf, buf_size, -1) -> prep_write(fd3, buf, buf_size, -1) -> prep_write(fd4, buf, buf_size, -1) -> ...
We want to specify a timeout for the entire SQE chain. If the timeout is exceeded, the ring will cancel all pending operations in the chain.
The current workaround I have come up with is to issue a single prep_timeout() request along the SQE chain and race them together. If the timeout request completes first, all pending entries in the chain will be cancelled by prep_cancel() requests. Otherwise, the timeout request itself will be cancelled.
What would be the appropriate solution?
Do io_uring/liburing provide something like timeout_link that applies to the entire SQE chain, not just the previous SQE? If not, should we have it?
Beta Was this translation helpful? Give feedback.
All reactions