Benchmarking flash media to determine allocation units and page sizes

Flashbench Source

github : https://github.com/bradfa/flashbench

Samsung Evo 32GB

Make : Samsung

Model : MB-MP32D

Class : Class 10, UHS-1

Capacity : 32GB

Allocation Unit : 16MB

Write Size : ??

Page Size : ??

Bench

sudo ./flashbench -a /dev/sdj --count=100 --blocksize=1024

align 8589934592        pre 1.55ms      on 1.85ms       post 1.46ms     diff 343µs
align 4294967296        pre 1.56ms      on 1.85ms       post 1.48ms     diff 330µs
align 2147483648        pre 1.55ms      on 1.87ms       post 1.55ms     diff 321µs
align 1073741824        pre 1.53ms      on 1.75ms       post 1.39ms     diff 288µs
align 536870912 pre 1.51ms      on 1.75ms       post 1.39ms     diff 297µs
align 268435456 pre 1.57ms      on 1.77ms       post 1.37ms     diff 296µs
align 134217728 pre 1.53ms      on 1.85ms       post 1.48ms     diff 348µs
align 67108864  pre 1.53ms      on 1.87ms       post 1.55ms     diff 328µs
align 33554432  pre 1.53ms      on 1.85ms       post 1.48ms     diff 348µs
align 16777216  pre 1.53ms      on 1.75ms       post 1.37ms     diff 297µs **
align 8388608   pre 1.43ms      on 1.6ms        post 1.39ms     diff 188µs
align 4194304   pre 1.42ms      on 1.59ms       post 1.39ms     diff 188µs
align 2097152   pre 1.42ms      on 1.6ms        post 1.37ms     diff 205µs
align 1048576   pre 1.47ms      on 1.6ms        post 1.37ms     diff 178µs
align 524288    pre 1.39ms      on 1.6ms        post 1.37ms     diff 220µs
align 262144    pre 1.43ms      on 1.6ms        post 1.37ms     diff 208µs
align 131072    pre 1.43ms      on 1.6ms        post 1.37ms     diff 204µs
align 65536     pre 1.37ms      on 1.6ms        post 1.39ms     diff 223µs
align 32768     pre 1.37ms      on 1.6ms        post 1.37ms     diff 232µs
align 16384     pre 1.37ms      on 1.6ms        post 1.37ms     diff 233µs **
align 8192      pre 1.37ms      on 1.37ms       post 1.37ms     diff -1225ns
align 4096      pre 1.37ms      on 1.37ms       post 1.37ms     diff 932ns
align 2048      pre 1.37ms      on 1.37ms       post 1.37ms     diff 2.79µs

Analysis

  • 16MB boundary has performance penalty = allocation unit
  • 16KB performance penalty = page size

Sandisk Ultra

Make : Sandisk

Model : SDSDQU-016G-U46A

Class : Class 10, UHS-1

Capacity : 16GB

Allocation Unit : ??

Write Size : ??

Page Size : ??

Bench

sudo ./flashbench -a /dev/sdi --count=100 --blocksize=1024

align 4294967296        pre 1.24ms      on 1.25ms       post 1.15ms     diff 48.3µs
align 2147483648        pre 1.12ms      on 1.12ms       post 1.12ms     diff 800ns
align 1073741824        pre 1.12ms      on 1.12ms       post 1.12ms     diff 668ns
align 536870912 pre 1.12ms      on 1.12ms       post 1.12ms     diff 414ns
align 268435456 pre 1.24ms      on 1.25ms       post 1.16ms     diff 46.9µs
align 134217728 pre 1.24ms      on 1.25ms       post 1.16ms     diff 44.8µs
align 67108864  pre 1.3ms       on 1.34ms       post 1.23ms     diff 71.7µs
align 33554432  pre 1.3ms       on 1.34ms       post 1.23ms     diff 71.5µs
align 16777216  pre 1.3ms       on 1.33ms       post 1.23ms     diff 69.6µs
align 8388608   pre 1.28ms      on 1.3ms        post 1.18ms     diff 72.1µs
align 4194304   pre 1.28ms      on 1.3ms        post 1.25ms     diff 37µs   **
align 2097152   pre 1.3ms       on 1.34ms       post 1.23ms     diff 70.8µs
align 1048576   pre 1.3ms       on 1.34ms       post 1.23ms     diff 70.7µs **
align 524288    pre 1.26ms      on 1.26ms       post 1.23ms     diff 19.6µs
align 262144    pre 1.26ms      on 1.26ms       post 1.23ms     diff 19.6µs
align 131072    pre 1.25ms      on 1.26ms       post 1.24ms     diff 12.9µs
align 65536     pre 1.26ms      on 1.26ms       post 1.24ms     diff 9.64µs **
align 32768     pre 1.26ms      on 1.26ms       post 1.22ms     diff 18.8µs
align 16384     pre 1.26ms      on 1.26ms       post 1.23ms     diff 18.7µs
align 8192      pre 1.26ms      on 1.26ms       post 1.23ms     diff 19.4µs
align 4096      pre 1.23ms      on 1.26ms       post 1.23ms     diff 35.3µs **
align 2048      pre 1.22ms      on 1.26ms       post 1.24ms     diff 29.4µs

Analysis

  • Results all over the place
  • 4MB dip
  • 1MB boundary has performance penalty = allocation unit?
  • 64KB dip
  • 4KB spike