R&D/클라우드

aio vs. io_uring 성능 비교

sunshout1 2026. 4. 10. 13:00
반응형

개념 차이

AIO (Linux Native AIO)

  • Linux의 전통적인 비동기 I/O 인터페이스 (libaio)
  • 커널에 I/O 요청을 제출하고 완료를 polling 또는 event 방식으로 수신
  • 구조적으로는 비동기지만 실제 내부는 제한적 비동기

👉 핵심 특징

  • syscall 기반 (io_submit, io_getevents)
  • 제한적인 operation 지원 (주로 direct I/O)
  • completion polling 비용 존재

io_uring

  • Linux 5.1+에서 도입된 차세대 I/O 인터페이스
  • Submission Queue (SQ) / Completion Queue (CQ) 기반 공유 메모리 구조
  • syscall을 최소화하고 zero-copy + batch 처리 최적화

👉 핵심 특징

  • ring buffer 기반 (user ↔ kernel 공유)
  • 거의 모든 I/O 지원 (file, network, fsync 등)
  • polling 없이도 high performance 가능

KVM / QEMU 관점에서 비교

KVM 자체는 하이퍼바이저이고, 실제 I/O는 QEMU + host kernel에서 처리됩니다.
즉 비교 포인트는 “QEMU block layer에서 어떤 I/O 엔진을 쓰느냐”입니다.

구조 비교

AIO (기존 방식)

Guest VM
→ virtio-blk/scsi
→ QEMU
→ libaio
→ kernel block layer
 

io_uring

Guest VM
→ virtio-blk/scsi
→ QEMU
→ io_uring
→ kernel (shared ring)
 

성능 비교

(1) Latency

  • AIO: syscall overhead + context switch 존재
  • io_uring: syscall 최소화 → latency 감소

👉 결과

  • io_uring이 10~30% 낮은 latency (워크로드에 따라 더 큼)

(2) Throughput (IOPS)

  • AIO: 큐 depth 증가 시 병목 발생
  • io_uring: batch + lockless 구조

👉 결과

  • io_uring이 고QD 환경에서 압도적 (특히 NVMe)

(3) CPU 사용량

  • AIO: syscall + wakeup 비용 큼
  • io_uring: polling + shared memory

👉 결과

  • io_urin

(4) Scaling (멀티 VM 환경)

  • AIO: contention 발생
  • io_uring: per-ring 구조 → 확장성 우수
 
 io_uring 기반 vm 생성
sudo /usr/bin/qemu-system-aarch64   -enable-kvm   -cpu host   -smp 4   -m 4096   -machine virt   -bios /usr/share/qemu-efi-aarch64/QEMU_EFI.fd   -drive file=/home/sunshout/vm/jammy-server-cloudimg-arm64.img,format=qcow2,if=virtio,aio=io_uring   -nographic   -serial mon:stdio -drive file=seed.iso,format=raw,if=virtio -netdev tap,id=net0,ifname=vnet0,script=no,downscript=no   -device virtio-net-pci,netdev=net0,mac=52:54:00:12:34:57

aio 기반 vm 생성

sysbench 성능 측정

# 1. 2GB 테스트 파일 생성 (이제 No space left 에러 없이 진행될 겁니다)
sysbench fileio --file-total-size=2G prepare

# 2. 성능 측정 실행 (4개의 스레드, 비동기 모드)
sysbench fileio --file-total-size=2G \
  --file-test-mode=rndrw \
  --num-threads=4 \
  --file-io-mode=async \
  --file-extra-flags=direct \
  --time=60 \
  run

 

io_uring

Guest multiqueue + Host  single queue (io_uring)

File operations:
    reads/s:                      23107.98
    writes/s:                     15406.87
    fsyncs/s:                     22806.78

Throughput:
    read, MiB/s:                  361.06
    written, MiB/s:               240.73

General statistics:
    total time:                          60.0107s
    total number of events:              3679596

Latency (ms):
         min:                                    0.00
         avg:                                    0.06
         max:                                   13.60
         95th percentile:                        0.08
         sum:                               235822.23

Threads fairness:
    events (avg/stddev):           919899.0000/2698.18
    execution time (avg/stddev):   58.9556/0.00

Guest multiqueue + Host multi queue (iothread)

File operations:
    reads/s:                      30538.67
    writes/s:                     20362.64
    fsyncs/s:                     30300.34

Throughput:
    read, MiB/s:                  477.17
    written, MiB/s:               318.17

General statistics:
    total time:                          60.0038s
    total number of events:              4872100

Latency (ms):
         min:                                    0.00
         avg:                                    0.05
         max:                                   24.47
         95th percentile:                        0.06
         sum:                               235004.18

Threads fairness:
    events (avg/stddev):           1218025.0000/5765.36
    execution time (avg/stddev):   58.7510/0.01
    
    
    
File operations:
    reads/s:                      29887.46
    writes/s:                     19925.78
    fsyncs/s:                     29716.34

Throughput:
    read, MiB/s:                  466.99
    written, MiB/s:               311.34

General statistics:
    total time:                          60.0034s
    total number of events:              4771751

Latency (ms):
         min:                                    0.00
         avg:                                    0.05
         max:                                   38.71
         95th percentile:                        0.06
         sum:                               234999.41

Threads fairness:
    events (avg/stddev):           1192937.7500/3808.45
    execution time (avg/stddev):   58.7499/0.00

 

aio

Guest multiquque + Host single queue

File operations:
    reads/s:                      21936.94
    writes/s:                     14625.35
    fsyncs/s:                     21806.89

Throughput:
    read, MiB/s:                  342.76
    written, MiB/s:               228.52

General statistics:
    total time:                          60.0048s
    total number of events:              3502058

Latency (ms):
         min:                                    0.00
         avg:                                    0.07
         max:                                   27.57
         95th percentile:                        0.07
         sum:                               234956.16

Threads fairness:
    events (avg/stddev):           875514.5000/3233.71
    execution time (avg/stddev):   58.7390/0.00

Guest multiqueue + Host multi queue

File operations:
    reads/s:                      28671.55
    writes/s:                     19114.65
    fsyncs/s:                     28418.94

Throughput:
    read, MiB/s:                  447.99
    written, MiB/s:               298.67

General statistics:
    total time:                          60.0037s
    total number of events:              4572160

Latency (ms):
         min:                                    0.00
         avg:                                    0.05
         max:                                   28.39
         95th percentile:                        0.08
         sum:                               235281.31

Threads fairness:
    events (avg/stddev):           1143040.0000/4828.72
    execution time (avg/stddev):   58.8203/0.00
    
    
    
    
File operations:
    reads/s:                      29058.11
    writes/s:                     19371.99
    fsyncs/s:                     28807.90

Throughput:
    read, MiB/s:                  454.03
    written, MiB/s:               302.69

General statistics:
    total time:                          60.0041s
    total number of events:              4634237

Latency (ms):
         min:                                    0.00
         avg:                                    0.05
         max:                                   19.13
         95th percentile:                        0.07
         sum:                               235252.50

Threads fairness:
    events (avg/stddev):           1158559.2500/1889.27
    execution time (avg/stddev):   58.8131/0.00
728x90
반응형