views:

615

answers:

3

I have come up with a disk-based data structure to store incoming realtime data, this is not in memory becuase the array can fill up and cause the jvm to crash. The data-strcture and algorithm work great. My only question is that does this greatly affect the life of an sdcard?

I know sdcards have limited read and writes on them, but how much is "limited". Will writing to the sd Card for say on average 20 minutes per session affect the sd card greatly to the point where the user sees that it was this app that killed it?

+2  A: 

I thought I recalled modern flash memory being good for hundreds of thousands of rewrites. The number of reads, as far as I know, isn't bounded.

If it makes you feel any better, Windows Vista supports a feature called ReadyBoost, which allows you to allocate cache space on a USB flash drive for improving performance. I think as long as you manage to somehow even out the writes, you should be fine.

In addition, some flash memory modules have built-in controllers with integrated write optimization so they'll try to write to different areas of the memory on subsequent write operations. You probably can't count on that, though, unless you find out for certain whether your particular memory card has an integrated controller (SD, in particular, doesn't have an integrated controller, but maybe it still has some other mechanism by which it evens out the writes).

EDIT: here's a link that explains memory wear and "wear leveling" in more detail: http://en.wikipedia.org/wiki/Flash_memory#Memory_wear

rob
+1  A: 

I purchased on of the early eeepc which used an SD card as 'hard drive' and so I've been interested in discussions about this, particularly as because I had the 2Gb model I set up the internal ram to span onto a 4GB SD card. It's difficult to come by real hard data, but all the informed option I can find suggests that this shouldn't be a problem within a reasonable lifetime for the machine (and certainly my eeepc has been running quite happily on a ext3 file system on the SD card - i.e. plenty of activity - with absolutely no issues - since I hacked it).

Opinion seems to be that modern SD cards should give you at least 100,000 cycles so I think you can reasonably expect to be fine if the lifetime of your device is just a few years. However your only way to be sure is set up some tests with your program writing continuously to a batch of sample cards and seeing if they fail within a time period of three months or so. I'd also ask the manufacturers directly.

Cruachan
Good Idea. Thanks!
Faisal Abid
You'd need to check with a statistician, but I think you can get yourself reasonably good numbers from a quite low number of cards. If for example you have 10 cards tested and none fail in three months continuous read/writes you'll be able to derive a practical upper bound for failure rate with a know degree of confidence. I also don't see why if you buy yourself a batch of USB/SD card readers you can't set up a fair few on on PC and run multiple copies of a bespoke program continually writing your data structure. Quoted values are ok, but nothing beats testing yourself.
Cruachan
+2  A: 

The number of writes on the card is in de 100'000s. This is the number of flash sector erases, which can be much larger than a disk sector.

I've found the following document with calculations: STEC SMALL CARDS WEAR LEVELING AND LIFETIME CALCULATOR

One of the examples: Lifetime = 2,000,000 x (512MB – 100MB – 128KB) / (50MB x 10/day) = 4,513 years

So if you do a reasonable job of designing (i.e. don't open/close files for every byte you write as this may force flushses and thus writes) I wouldn't even bother to set up very extensive tests....

Adriaan
Wow thanks so much. Saved me some money :) . Thanks so much !
Faisal Abid