On Sun, Apr 24, 2011 at 04:59:27PM +0200, Arnd Bergmann wrote:
On Sunday 24 April 2011 13:44:53 Sitsofe Wheeler wrote:
I'm not really sure how to generate useful results so here's what I've got so far:
There is a README file which should give you some background. The other information that would be nice to get is the exact size in KB (from /proc/partitions or from fdisk -lu /dev/sdb), and most importantly the results from the --open-au test run.
# fdisk -lu /dev/sdb
Disk /dev/sdb: 8086 MB, 8086617600 bytes 249 heads, 62 sectors/track, 1023 cylinders, total 15794175 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x0891c517
Device Boot Start End Blocks Id System /dev/sdb1 * 2048 15793073 7895513 b W95 FAT32
# lsusb Bus 001 Device 004: ID 0781:5151 SanDisk Corp. Cruzer Micro Flash Drive
# ./flashbench -a /dev/sdb --blocksize=1024 align 4194304 pre 601µs on 637µs post 508µs diff 83µs align 2097152 pre 601µs on 653µs post 495µs diff 106µs align 1048576 pre 494µs on 584µs post 511µs diff 81.5µs align 524288 pre 491µs on 510µs post 495µs diff 17µs align 262144 pre 491µs on 511µs post 494µs diff 18.2µs
It's rather clear from this run that the erase block size is 1 MB, which is the poin the the last column where the numbers get drastically lower. For all other tests, you should pass --erasesize=1048576, otherwise flashbench will assume an incorrect value of 4 MB.
# ./flashbench -f /dev/sdb 128KiB 7.51M/s 7.8M/s 7.64M/s 7.43M/s 7.6M/s 7.6M/s 64KiB 10.4M/s 10.2M/s 10.1M/s 10.1M/s 10.1M/s 10.2M/s 32KiB 4.53M/s 4.55M/s 4.48M/s 4.53M/s 4.47M/s 4.45M/s
A further question is how do I use these results so as to get good performance? Should I be setting the first partition in any particular way and/or passing any special options to mkfs.vfat?
Most importantly, you should align each partition to full multiples of 1 MB. You can also see here that 64 KB writes are much faster than smaller ones, so you should use 64 KB clusters if possible, this would mean mkdosfs -s 128.
As the next step, please run
./flashbench --open-au /dev/sdb --erasesize=1048576 --blocksize=2048 --random --open-au-nr=2
and then do the same with larger values for --open-au-nr= until you get to the point where the drive gets drastically slower. The number you are looking for is the last value for --open-au-nr= that is still fast.
# ./flashbench --open-au /dev/sdb --erasesize=1048576 --blocksize=2048 --random --open-au-nr=9 1MiB 7.6M/s 512KiB 3.33M/s 256KiB 2.63M/s 128KiB 2.61M/s 64KiB 2.04M/s 32KiB 2.76M/s 16KiB 1.74M/s 8KiB 653K/s 4KiB 621K/s 2KiB 316K/s
# ./flashbench --open-au /dev/sdb --erasesize=1048576 --blocksize=2048 --random --open-au-nr=10 1MiB 7.57M/s 512KiB 3.31M/s 256KiB 2.67M/s 128KiB 2.64M/s 64KiB 2.15M/s 32KiB 2.2M/s 16KiB 1.74M/s 8KiB 679K/s 4KiB 575K/s 2KiB 317K/s
# ./flashbench --open-au /dev/sdb --erasesize=1048576 --blocksize=2048 --random --open-au-nr=11 1MiB 4.66M/s 512KiB 2.69M/s 256KiB 1.94M/s 128KiB 1.23M/s 64KiB 687K/s 32KiB 356K/s 16KiB 189K/s 8KiB 104K/s 4KiB 51.2K/s 2KiB 25.9K/s
So the best --open-au-nr is 10.
Once you are there, try the same without --random to see if the cutoff is at the same point. It usually is, so you'd only have to try the highest fast one and the lowest slow one from the --random test.
# ./flashbench --open-au /dev/sdb --erasesize=1048576 --blocksize=2048 --open-au-nr=7 1MiB 7.74M/s 512KiB 3.39M/s 256KiB 2.86M/s 128KiB 2.8M/s 64KiB 2.77M/s 32KiB 2.15M/s 16KiB 2.02M/s 8KiB 1.1M/s 4KiB 982K/s 2KiB 637K/s
# ./flashbench --open-au /dev/sdb --erasesize=1048576 --blocksize=2048 --open-au-nr=8 1MiB 3.16M/s 512KiB 3.01M/s 256KiB 2.77M/s 128KiB 2.85M/s 64KiB 2.88M/s 32KiB 2.33M/s 16KiB 2.11M/s 8KiB 1.1M/s 4KiB 1.03M/s 2KiB 540K/s
# ./flashbench --open-au /dev/sdb --erasesize=1048576 --blocksize=2048 --open-au-nr=9 1MiB 7.67M/s 512KiB 3.31M/s 256KiB 2.69M/s 128KiB 2.88M/s 64KiB 2.48M/s 32KiB 3.03M/s 16KiB 1.89M/s 8KiB 1.1M/s 4KiB 893K/s 2KiB 604K/s
# ./flashbench --open-au /dev/sdb --erasesize=1048576 --blocksize=2048 --open-au-nr=10 1MiB 5.6M/s 512KiB 3.29M/s 256KiB 2.82M/s 128KiB 2.44M/s 64KiB 2.65M/s 32KiB 2.76M/s 16KiB 1.87M/s 8KiB 1.11M/s 4KiB 909K/s 2KiB 583K/s
# ./flashbench --open-au /dev/sdb --erasesize=1048576 --blocksize=2048 --open-au-nr=11 1MiB 5.16M/s 512KiB 2.57M/s 256KiB 2.08M/s 128KiB 1.26M/s 64KiB 729K/s 32KiB 368K/s 16KiB 190K/s ^C
So pretty much similar to random.
For completeness, please rerun the -f test with these parameters:
flashbench -f /dev/sdb --erasesize=1048576 --blocksize=512 --random
# ./flashbench -f /dev/sdb --erasesize=1048576 --blocksize=512 --random 1MiB 2.08M/s 7.73M/s 2.03M/s 7.74M/s 2.06M/s 7.73M/s 512KiB 7.94M/s 2.04M/s 7.44M/s 7.58M/s 7.11M/s 7.26M/s 256KiB 7.29M/s 2.1M/s 1.73M/s 7.49M/s 7.33M/s 2.04M/s 128KiB 7.28M/s 7.79M/s 2.07M/s 7.41M/s 6.57M/s 2.03M/s 64KiB 2.09M/s 10.8M/s 2.23M/s 11.1M/s 5.24M/s 2.23M/s 32KiB 1.74M/s 4.64M/s 4.88M/s 1.75M/s 4.4M/s 4.75M/s 16KiB 1.05M/s 1.03M/s 1.03M/s 1.03M/s 1.01M/s 1.59M/s 8KiB 436K/s 427K/s 427K/s 330K/s 430K/s 327K/s 4KiB 400K/s 394K/s 395K/s 309K/s 396K/s 311K/s 2KiB 176K/s 198K/s 187K/s 339K/s 306K/s 303K/s 1KiB 87.8K/s 87.7K/s 88.4K/s 88.4K/s 88.2K/s 88.2K/s 512B 43.2K/s 43.9K/s 44K/s 42.7K/s 44K/s 58.4K/s
What does this last result show?