I'm not really sure how to generate useful results so here's what I've got so far:
# lsusb Bus 001 Device 004: ID 0781:5151 SanDisk Corp. Cruzer Micro Flash Drive
# ./flashbench -a /dev/sdb --blocksize=1024 align 2147483648 pre 687µs on 599µs post 495µs diff 7.44µs align 1073741824 pre 635µs on 657µs post 499µs diff 90.3µs align 536870912 pre 601µs on 634µs post 495µs diff 86.1µs align 268435456 pre 602µs on 635µs post 490µs diff 89.5µs align 134217728 pre 621µs on 638µs post 496µs diff 79.5µs align 67108864 pre 602µs on 636µs post 509µs diff 80.4µs align 33554432 pre 606µs on 622µs post 494µs diff 71.8µs align 16777216 pre 614µs on 625µs post 498µs diff 69.3µs align 8388608 pre 602µs on 620µs post 490µs diff 73.2µs 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 align 131072 pre 493µs on 510µs post 494µs diff 16.3µs align 65536 pre 495µs on 513µs post 494µs diff 18.8µs align 32768 pre 490µs on 511µs post 489µs diff 21.6µs align 16384 pre 493µs on 511µs post 494µs diff 17.9µs align 8192 pre 511µs on 514µs post 495µs diff 11µs align 4096 pre 538µs on 530µs post 496µs diff 12.9µs align 2048 pre 506µs on 515µs post 513µs diff 5.52µs
# ./flashbench -f /dev/sdb 4MiB 7.41M/s 7.35M/s 7.37M/s 7.33M/s 7.47M/s 7.39M/s 2MiB 7.37M/s 7.38M/s 7.42M/s 7.3M/s 7.1M/s 4.45M/s 1MiB 7.21M/s 7.06M/s 7.05M/s 7.07M/s 7.14M/s 7.22M/s 512KiB 6.97M/s 6.93M/s 6.92M/s 6.79M/s 6.95M/s 6.95M/s 256KiB 7M/s 6.82M/s 6.95M/s 6.89M/s 7.02M/s 6.71M/s 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 16KiB 3.77M/s 3.73M/s 3.75M/s 3.75M/s 3.74M/s 3.75M/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?
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.
# lsusb Bus 001 Device 004: ID 0781:5151 SanDisk Corp. Cruzer Micro Flash Drive
# ./flashbench -a /dev/sdb --blocksize=1024 align 2147483648 pre 687µs on 599µs post 495µs diff 7.44µs align 1073741824 pre 635µs on 657µs post 499µs diff 90.3µs align 536870912 pre 601µs on 634µs post 495µs diff 86.1µs align 268435456 pre 602µs on 635µs post 490µs diff 89.5µs align 134217728 pre 621µs on 638µs post 496µs diff 79.5µs align 67108864 pre 602µs on 636µs post 509µs diff 80.4µs align 33554432 pre 606µs on 622µs post 494µs diff 71.8µs align 16777216 pre 614µs on 625µs post 498µs diff 69.3µs align 8388608 pre 602µs on 620µs post 490µs diff 73.2µs 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 align 131072 pre 493µs on 510µs post 494µs diff 16.3µs align 65536 pre 495µs on 513µs post 494µs diff 18.8µs align 32768 pre 490µs on 511µs post 489µs diff 21.6µs align 16384 pre 493µs on 511µs post 494µs diff 17.9µs align 8192 pre 511µs on 514µs post 495µs diff 11µs align 4096 pre 538µs on 530µs post 496µs diff 12.9µs align 2048 pre 506µs on 515µs post 513µs diff 5.52µ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 4MiB 7.41M/s 7.35M/s 7.37M/s 7.33M/s 7.47M/s 7.39M/s 2MiB 7.37M/s 7.38M/s 7.42M/s 7.3M/s 7.1M/s 4.45M/s 1MiB 7.21M/s 7.06M/s 7.05M/s 7.07M/s 7.14M/s 7.22M/s 512KiB 6.97M/s 6.93M/s 6.92M/s 6.79M/s 6.95M/s 6.95M/s 256KiB 7M/s 6.82M/s 6.95M/s 6.89M/s 7.02M/s 6.71M/s 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 16KiB 3.77M/s 3.73M/s 3.75M/s 3.75M/s 3.74M/s 3.75M/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.
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.
For completeness, please rerun the -f test with these parameters:
flashbench -f /dev/sdb --erasesize=1048576 --blocksize=512 --random
The blocksize in these tests is only the point where the test stops trying smaller numbers. If it gets really slow (< 100K/s), feel free to interrupt at any time and post only the results that you already got.
Arnd
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?
On Sunday 24 April 2011 19:55:32 Sitsofe Wheeler wrote:
On Sun, Apr 24, 2011 at 04:59:27PM +0200, Arnd Bergmann wrote:
# ./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.
Ok, excellent!
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?
It's a bit unexpected: The numbers for the large block sizes are much more random than I'd expect them, which hints that the erase size was actually incorrect. Compare these to your original numbers for 4 MB erasesize, which are almost identical for each column except the first one. In particular, the 64KiB row should give results of around 10 MB/s consistently, which it does not.
The thing that should be seen in this case is one column that is consistently either worse or better than the others, but that is not the case.
The most likely interpretation to me is that this is an MLC flash that has 2 MB erase blocks but in fact writes the faster part of each erase block before it writes the slower part.
Unfortunately, these variations have so far prevented me from automating flashbench to the point where you can run it without manual interaction and a bit experience. Could you run flashbench -f again with a 2 MB erasesize to see if it makes a difference? You can also run the --open-au --random test again with 10 and 11 erase blocks with that size, but I don't expect many changes there other than hopefully a better performance in the 10 * 2 MB erase block case compared to 10 * 1 MB.
An important result of this is that the page size of this USB stick is 4 KB, not how every smaller column is only half the speed of the one above it -- it takes the same time to write 4 KB that it takes to write 512 byte. The good news for you is that this stick has almost perfect characteristics for use in Linux, even with ext3, as long as the partitions are correctly aligned and you use 4 KB block size (or 64 KB clusters in fat32).
Arnd
flashbench-results@lists.linaro.org