Skip to main content

Module uring

Module uring 

Source
Expand description

io_uring-based I/O for disks with high IOPS capacity (e.g. NVMe)

This module provides two implementations of the Reader trait using Linux’s io_uring interface for asynchronous I/O.

One of these uses a pool of dedicated background threads which each own an io_uring instance. Read requests are submitted to a background thread’s pool.

The other implementation uses a thread-local io_uring instance. This only works if the future is polled by the same thread that submitted the request. This means that the runtime must be a single-threaded runtime.

§Configuration

The io_uring reader is enabled by using the file+uring:// URI scheme instead of file://. Additional tuning parameters are controlled by environment variables:

  • LANCE_URING_CURRENT_THREAD - Use thread-local io_uring (default: false)
  • LANCE_URING_BLOCK_SIZE - Block size in bytes (default: 4KB)
  • LANCE_URING_IO_PARALLELISM - Max concurrent operations (default: 128)
  • LANCE_URING_QUEUE_DEPTH - io_uring queue depth (default: 16K)
  • LANCE_URING_THREAD_COUNT - Number of io_uring threads to use (default: 2)
  • LANCE_URING_SUBMIT_BATCH_SIZE - Number of requests to batch before submitting (default: 128)
  • LANCE_URING_POLL_TIMEOUT_MS - Thread poll timeout in milliseconds (default: 10)

Note: the block size and io parallelism are not actually used by the io_uring implementation. These variables just control what the filesystem reports up to Lance.

§Platform Support

This module is only available on Linux and requires kernel 5.1 or newer. On other platforms, the code falls back to LocalObjectReader.

§Example

// Enable io_uring by using the file+uring:// scheme
let uri = "file+uring:///path/to/file.dat";
let (store, path) = ObjectStore::from_uri(uri).await?;
let reader = store.open(&path).await?;

// Reader will use io_uring
let data = reader.get_range(0..1024).await?;

Structs§

UringReader
io_uring-based reader for local files.

Constants§

DEFAULT_URING_BLOCK_SIZE
Default block size for io_uring reads (4KB)
DEFAULT_URING_IO_PARALLELISM
Default I/O parallelism for io_uring (128 concurrent operations)
DEFAULT_URING_QUEUE_DEPTH
Default io_uring queue depth (16K entries)