Tuesday, November 26, 2019

linux - Today I read that flash write performance diminishes with use. I'm a heavy user. Should I change my behavior?


My phone


I own a phone with gigabytes of built-in flash memory. My phone also includes a physical MicroSD card slot. I don't own a MicroSD card to put in the slot, and have never bothered buying one, but am not opposed to the idea of buying one.


I perhaps make heavier use of my phone's flash memory than most people.




  • I run a freeware sleep tracker app most nights, all night long. It has many features. Its most storage-intensive feature? It records sound for at least part of every night.




  • I have Debian Linux installed on my phone as well (even though the phone is not rooted). I launch Debian when desired using an app named GNURoot Debian. Debian Linux is normally stored on an SSD designed to handle an enormous number of write cycles, or on a hard drive which can also handle numerous write cycles — not on a smartphone flash memory chip.





  • I have perhaps a hundred apps installed, and the Google Play store automatically updates some of them from time to time.




  • I make heavy use of a game which was designed for use on Windows and Linux, but has been ported to Android. Every time I move between floors of the game world, the game saves some information to disk. I suspect that, in practice, it rewrites at least part of the game's save file.




The problem


David Cary has more than 10,000 reputation points on Electrical Engineering Stack Exchange. In one post there, Mr. Cary writes:




Flash memory has relatively quick read times but much longer write times. For example, with a Numonyx M25P80-VMW6G 75MHz 8 Mbit serial flash, reading a sector of data (at 75 MHz) requires 7 milliseconds, while erasing and writing new data to a sector is typically 0.6 seconds (max 3 seconds).


In other words, writing this flash memory typically takes 85 times as long as reading, and in the worst case writing a sector takes over 400 times as long as reading. (That's not even taken into account the inefficiencies of partial-sector updating).


In my experience, the time it takes to erase and rewrite a particular sector of flash continues to increase with each erase/rewrite cycle, but read times stay constant.



I don't know that much about hardware, but let's assume that Mr. Cary's experience will be true for my phone too.


My question


I don't like spending money unnecessarily, and it sometimes takes me great effort to choose a phone to buy. When I buy a phone, I like to treat it well and to keep on using it for five to ten years or more — unless it breaks so badly that this becomes absolutely impossible.


Certain operations on my phone are annoyingly slow, such as Debian Linux automatic software update checks (apt-get update) and others. I don't know whether or not they're slow because of the time it takes to write to flash or because of other reasons.


Anyway, assuming that the issue which Mr. Cary has raised above is a real issue, should I worry about it? Should I change my behavior because of it — for example, by moving GNURoot Debian from the phone's built-in flash memory to a MicroSD card inserted into the correct slot?



Note


I have left this question mostly device-agnostic. This is because I'd like to apply what I learn both to the device which I own and any other Android devices which I may buy in the future.


Related




Answer



As a user, and not a developer, this is not an effect you should concern yourself with. For operations like disk defragmentation or use of flash memory as virtual memory, the sustained high disk write rates can wear out flash memory quickly. But "normal" usage by a human will not produce enough writes to create a wear issue.


Let's take the sleep app as an example and estimate how many writes this will cause on a wear-leveled disk. Suppose the app collects 128 kilobit / second audio to store uncompressed and runs and collects audio at all times for 5 years. (128 kilobits / second) * (128 bytes / kilobit) * (5 years) * (365 days / year) * (24 hours / day) * (60 minutes / hour) * (60 seconds / minute) ~= 5.17 * 10^11 bytes. On a wear leveled disk of 1 GB ~= 10^9 bytes, this will be (5.17 * 10^11) / (10^9) ~= 517 cycles over the 5 years, which is well below the expected 100,000 cycles for current flash memory.


Also, note that almost all SSDs are currently built from flash memory, so there is no significant difference between the storage for your Android phone and that in a consumer SSD for a laptop/desktop in terms of expected aging issues.




EDIT



If you are really worried about this, I would benchmark your storage performance. I don't think it is a good assumption that erase/write operations take 0.6 seconds; your flash memory is not the same as that used in the example figures.


This empirical evaluation of flash memory gives actual figures for degradation. The magnitude of the effect is not that large for cycles in the low thousands.


No comments:

Post a Comment

samsung galaxy s 2 - Cannot restore Kies backup after firmware upgrade

I backed up my Samsung Galaxy S2 on Kies before updating to Ice Cream Sandwich. After the upgrade I tried to restore, but the restore fails ...