Should I be concerned with flash memory write cycles resource limits?
Asked Answered
S

3

8

I am writing an Android application which writes data to a file several times a second, the overall file size is around 1MB, after that file gets erased and new file started. Should I be concerned about wearing out the phone's flash memory, causing it to fail? Do you know if Android distributes writes onto different sectors to minimize flash memory degradation, even when the application writes a continuous file? Does the logging system worked in a similar way? In other words if I log a lot (several records per second), will that affect the phone's flash memory resource?

Strobel answered 31/10, 2012 at 13:48 Comment(0)
E
9

Would not hurt to worry about that, but aside from flash write cycles, I'd rework app logic - 1MB is not that much, so buffering data in memory and flushing it to the file periodically (but less frequently) should speed your app (as I assume your writes are synchronous).

EDIT

Wiki got some figures for consideration:

Write endurance

The write endurance of SLC floating-gate NOR flash is typically equal to or greater than that of NAND flash, while MLC NOR and NAND flash have similar endurance capabilities. Example Endurance cycle ratings listed in datasheets for NAND and NOR flash are provided.

  • SLC NAND flash is typically rated at about 100k cycles (Samsung OneNAND KFW4G16Q2M)
  • MLC NAND flash used to be rated at about 5k – 10k cycles (Samsung K9G8G08U0M) but is now typically 1k – 3k cycles
  • TLC NAND flash is typically rated at about 1k cycles (Samsung 840)
  • SLC floating-gate NOR flash has typical endurance rating of 100k to 1M cycles (Numonyx M58BW 100k; Spansion S29CD016J 1,000k) MLC floating-gate NOR flash has typical endurance rating of 100k cycles (Numonyx J3 flash)
Etude answered 31/10, 2012 at 14:4 Comment(4)
Yes, I thought about buffering two. Any idea if I can/should do buffering for my android application logs writes?Strobel
Quite unlikey. And again - if you log a lot, tune your code and log less for performance benefits and log readability - log buffers are not infinite so logging to often usually means high noise/signal ratio. See here: elinux.org/Android_Logging_SystemEtude
Entirely different view hereCousin
Can you make a list of the sizes, it's hard to view the list from an Android mobileElectrum
F
2

It depends on the memory type and file system. NAND flash memories provide higher number of write cycles compared to NOR memories. Also, file systems such as JFFS2 provide a wear leveling algorithm to distribute the data and avoid block damage.

A comparison of NAND and NOR flash techs: https://focus.ti.com/pdfs/omap/diskonchipvsnor.pdf

Flossi answered 24/8, 2015 at 0:3 Comment(3)
This information is incorrect. NOR flashes have more write cycle.Hyphenate
Please look at this: focus.ti.com/pdfs/omap/diskonchipvsnor.pdfFlossi
My bad. Sorry for providing the wrong information (Still there are exception to this). Will be more careful in future. Up-voted.Hyphenate
C
0

Storage media's lifetime depends on physical structure and filesystem. In most of Android device we used eMMc or NAND flash to store rootfs/user data. The best combination is eMMC+ext4 then NAND+UBIFS.

UBIFS is better than JFFS2 not only in speed but in lifetime too. similar to ext4 UBIFS have UBI volume and data write-back, Look at this :http://www.linux-mtd.infradead.org/doc/ubifs.html#L_ubifs_mlc

Don't worry about the log files in /var/log, several records per second do not affect NAND flash's lifetime. Different from JFFS2 writes to flash immediately, UBIFS has data write-back. UBIFS is better than JFFS2 in wear leveling.

Crin answered 31/10, 2023 at 4:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.