Giter Site home page Giter Site logo

uring-positioned-io's Introduction

uring-positioned-io

Fully asynchronized positioned I/O with io_uring.

Basic Usage

let files = vec![File::open("test.txt").unwrap()];
let context = UringContext::new(files, 256, 1, false).unwrap();
let mut buf = vec![0; 4];
let (_, sz) = context.read(0, 0, &mut buf).await.unwrap();
assert_eq!(&buf[..sz], b"test");

Limitations

Read buffer must be valid until a read is complete. This means that you must poll a read future until completion. You could not abort a read future. Later we may mark read as unsafe.

Benchmark

First, generate benchmark 128 files, with 1GB (262144 * 4K block) size each. Each block is filled with hash(file_id, block_id).

cargo run -p uring_bench --release generate --nf 128 --nb 262144 --dir ~/Work/uring_bench

Then, benchmark with io_uring. Benchmark script will read 4K block and verify it.

RUST_LOG=info cargo run -p uring_bench --release -- read --nf 128 --nb 262144 --dir ~/Work/uring_bench --duration 60 --concurrent 32 --ql 512
RUST_LOG=info cargo run -p uring_bench --release -- read --nf 128 --nb 262144 --dir ~/Work/uring_bench --duration 60 --concurrent 512 --ql 512

Finally, compare io_uring with mmap by benchmarking.

RUST_LOG=info cargo run -p uring_bench --release -- read_mmap --nf 128 --nb 262144 --dir ~/Work/uring_bench --duration 60 --threads 8
RUST_LOG=info cargo run -p uring_bench --release -- read_mmap --nf 128 --nb 262144 --dir ~/Work/uring_bench --duration 60 --threads 32

Benchmark result can be found on my blog.

uring-positioned-io's People

Contributors

skyzh avatar st1page avatar zhongzc avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.