Luigit
repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by admin

pi/agent/skills/optimize/references/io.md

Raw
Rendered preview

I/O

disk reads/writes, syscalls, buffering, blocking vs async.

Measure

  • syscall tracing → count, identify blocking calls
  • device profiling → I/O wait, throughput, queue depth
  • block tracing → long synchronous ops
  • metrics → I/O wait %, syscall count, bytes, queue depth

Optimize

  • batching → combine small ops into single
  • buffering → appropriate buffer sizes, avoid tiny reads/writes
  • async I/O → non-blocking or thread pools for concurrency
  • memory-mapped files → map into memory
  • pre-fetching → read ahead
  • reduce syscall overhead → higher-level APIs that batch internally

Pitfalls

  • over-batching → latency + memory waste
  • async complexity → only when I/O path is the bottleneck
  • filesystem matters → different FS, different perf
  • raw throughput ≠ latency under load
# I/O

disk reads/writes, syscalls, buffering, blocking vs async.

## Measure

- syscall tracing → count, identify blocking calls
- device profiling → I/O wait, throughput, queue depth
- block tracing → long synchronous ops
- metrics → I/O wait %, syscall count, bytes, queue depth

## Optimize

- batching → combine small ops into single
- buffering → appropriate buffer sizes, avoid tiny reads/writes
- async I/O → non-blocking or thread pools for concurrency
- memory-mapped files → map into memory
- pre-fetching → read ahead
- reduce syscall overhead → higher-level APIs that batch internally

## Pitfalls

- over-batching → latency + memory waste
- async complexity → only when I/O path is the bottleneck
- filesystem matters → different FS, different perf
- raw throughput ≠ latency under load