More tea please.

‘Interesting’ USB key bandwidth step

In about a month’s time, Student Robotics will be shipping robotics kit to several schools in the Southampton and Bristol area. Sixth formers from these schools will be competing their robots against each other some time in April next year. The robots are programmed using USB keys. In the past, we’ve tended to purchase the absolute cheapest USB key we possibly could, and we’ve had quite a lot of them fail.

So this year, we’ll be using some USB keys from a known brand. I bought a couple of Kingston 2GB DataTraveler keys and went about abusing one to try to discover if it’s likely to fail. I hacked together some scripts that continuously rewrote the same 10MB space (of the block device that the key presents) over and over again. Out of curiosity I also logged the time it took for this space to be written to each time.

So I ran my scripts and rewrote the 10MB block 2000 times. Here’s what the bandwidth did:

The step is interesting. It could be something to do with the USB key’s wear-levelling. My bet is that the key uses its flash as a big circular buffer (like JFFS). Initially, all the blocks of flash are erased, so no erases have to happen when writing to them. When the end of the circular buffer is reached, it has to erase each block before it can write to it, which drops the bandwidth. Obviously this is pure postulation…

I’m reasonably convinced that this type of USB key won’t fall apart in the robots. The file the students will be loading onto the robot is of the order of 100k. Also I think it quite unlikely that they’ll reach 2000 programming iterations. So I’m for shipping these keys.

The hacky scripts that I used are in a git repo.

Posted at 8:19 pm on Saturday 11th September 2010

Site by Rob Gilton. © 2008 - 2019