Code Monkey home page Code Monkey logo

ebpf-io_uring's Introduction

IO Performance Test

benchmark test for 4 basic IO method: Synchronized I/O, io_uring, posix async I/O, linux async I/O

Requirements

Generate read material

g++ gen.cpp -o gen && ./gen

dict.txt: randomly generated $128MB$ text

Library installation

liburing

sudo dpkg -i packages/liburing2_2.1-2_amd64.deb
sudo dpkg -i packages/liburing-dev_2.1-2_amd64.deb

for ubuntu 22.04 LTS

sudo apt install liburing2 && sudo apt install liburing-dev

libaio

sudo apt install libaio-dev

supports for ebpf

  • USDT
sudo apt-get install systemtap-sdt-dev
  • bcc
sudo apt-get install bpfcc-tools linux-headers-$(uname -r)

Runing

test IOPS

gcc testIOPS.c -o testIOPS -luring -laio -lrt -Wall -O2 -D_GNU_SOURCE
./testIOPS dict.txt -m=rRD
./testIOPS dict.txt -m=sRD
./testIOPS output.txt -m=rWR
./testIOPS output.txt -m=sWR

test latency

gcc testIOLatency.c -o testIOLatency -luring -laio -lrt -Wall -O2 -D_GNU_SOURCE
sudo python3 latency.py --engine sync --infile dict.txt --outfile output.txt
sudo python3 latency.py --engine io_uring --infile dict.txt --outfile output.txt
sudo python3 latency.py --engine posix_aio --infile dict.txt --outfile output.txt
sudo python3 latency.py --engine libaio --infile dict.txt --outfile output.txt

Results

IOPS

$ ./testIOPS dict.txt -m=rRD
sync: random read operates with bs 4 KB, IOPS: 5676 /seconds
io_uring: random read operates with bs 4 KB, IOPS: 25339 /seconds
posix_aio: random read operates with bs 4 KB, IOPS: 6887 /seconds
linux libaio: random read operates with bs 4 KB, IOPS: 24391 /seconds
$ ./testIOPS dict.txt -m=sRD
sync: sequential read operates with bs 4 KB, IOPS: 9230 /seconds
io_uring: sequential read operates with bs 4 KB, IOPS: 176313 /seconds
posix_aio: sequential read operates with bs 4 KB, IOPS: 5456 /seconds
linux libaio: sequential read operates with bs 4 KB, IOPS: 143955 /seconds
$ ./testIOPS output.txt -m=rWR
sync: random write operates with bs 4 KB, IOPS: 6432 /seconds
io_uring: random write operates with bs 4 KB, IOPS: 21622 /seconds
posix_aio: random write operates with bs 4 KB, IOPS: 5154 /seconds
linux libaio: random write operates with bs 4 KB, IOPS: 20240 /seconds
$ ./testIOPS output.txt -m=sWR
sync: sequential writeoperates with bs 4 KB, IOPS: 5869 /seconds
io_uring: sequential writeoperates with bs 4 KB, IOPS: 12838 /seconds
posix_aio: sequential writeoperates with bs 4 KB, IOPS: 4614 /seconds
linux libaio: sequential writeoperates with bs 4 KB, IOPS: 18703 /seconds

IOPS: number of $4KB$ data I/O per second

$64$ entries for each aio queue

fig

In conclusion, io_uring generally outperforms other IO methods in all types of IO tasks.

linux aio method has similar throughput as io_uring, but it can only handle normal files stored in disk, and it is supposed to operate files open in O_DIRECT.

posix_aio method may have smaller throughput than traditional synchronized I/O method due to its massive number of context switch.

IO Latency

$ sudo python3 latency.py --engine sync --infile dict.txt --outfile output.txt
...
latency for sync IO read: 0.1365 ms
latency for sync IO write: 0.1764 ms
$ sudo python3 latency.py --engine io_uring --infile dict.txt --outfile output.txt
...
latency for io_uring IO read: 2.9033 ms
latency for io_uring IO write: 6.8054 ms
$ sudo python3 latency.py --engine posix_aio --infile dict.txt --outfile output.txt
...
latency for posix_aio IO read: 6.1566 ms
latency for posix_aio IO write: 7.0417 ms
$ sudo python3 latency.py --engine libaio --infile dict.txt --outfile output.txt
...
latency for libaio IO read: 11.6784 ms
latency for libaio IO write: 11.676 ms

fig2

Average latency for totally $64$ reads and $64$ writes

Comparing each aio methods, io_uring method has smaller latency.

ebpf-io_uring's People

Contributors

lhtie avatar

Watchers

 avatar

Forkers

zhangying098

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.