简体   繁体   中英

How does io_uring handle short recvs when more data arrives on the socket?

Trying to find to retrieve data from io_uring efficiently. Short recv/send and the fragile SQE links have me blasting requests at the kernel to with most being cancelled.

If I request a recv of 8MB (basically the size of my user space buffer) and a 50 byte packet arrives (assume no LWM), a short recv will be posted to the completion queue with data in the buffer.

And since it is not a complete read, it will cause any linked operations to cancel.

If more data arrives on the socket, it kernel can't post more can it? When trying to reduce latency to a minimum, do i need to have multiple outstanding, non-linked request that will easily all have short reads while sitting in the completion queue.

It there anything that describes this flow in detail?

And since it is not a complete read

What read opcode you using? IORING_OP_READ_FIXED, IORING_OP_READV, IORING_OP_READ or IORING_OP_RECV? Only last one have flag for "wait for all data" - first 3 ones will do success completion after receiving any amount of data - from 1 byte to your buffer size.

About linked requests - what you linking with read? Writing to another socket? For that - better use reverse way: write (already received data, non-linked read first time) first, then linked read for new data.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM