Note, a version of this post appeared this morning on ZDnet.

Given that roughly a billion battery-powered computers are sold each year, you’d think that the engineers would be busy rearchitecting the storage stack to take advantage of built-in – and usually non-removable – battery backup. But no-o-o!

Recently three researchers, Hao Luo, Lei Tian and Hong Jiang of the University of Nebraska, asked why we don’t treat our mobile device DRAM as if it were nonvolatile? They designed, implemented and tested a prototype Android phone and, not surprisingly, got promising results.

Their paper, qNVRAM: quasi Non-Volatile RAM for Low Overhead Persistency Enforcement in Smartphones was presented at the latest Usenix HotStorage conference last month.

Typically Android mobile devices rely on SQLite, a shared preference key value store or filesystem APIs to save persistent data to local flash. These employ journaling or file level double writes to ensure persistency.

The motivation behind these techniques is that memory – DRAM – is volatile. Thus the multiple writes to storage, incurring substantial system overhead in devices that are already performance and power constrained.

For example, they found that more than 75% of Twitter data was being written for persistency reasons. Looking at a group of common mobile apps they found that anywhere from 37 percent to 78 percent of the data writes were for atomicity.

Here’s a graph of what they found:

Screen Shot 2014-07-14 at 2.48.07 PM

Of course, battery-backed hardware does no good if the system software is often crashing. They found that Android kernel reliability is quite good, based on bug fixes and user support calls.

They analyzed Android issue reports and found that only 10 reports or 0.05% of all 19,670 reported issues related to Android defects were unexpected or random power-off. That implies a small chance that unexpected power failure may occur.

Proto design.
The researchers constructed a prototype test system with several innovations.

Quasi-NVRAM. They set aside a portion of system DRAM to act as a battery backed up nonvolatile DRAM.
Device driver. A new device driver and library that manage I/O between the qNVRAM and system flash memory.
Persistent Page Cache. A new data structure in SQLite using quasi-NVRAM to perform in-place updates to the database files.
Relaxed data flushing. LazyFlush absorbs repeated writes to table files to further reduce I/O.

Here’s the architecture:


Implemented on an Android smartphone they found that if performed entirely in-memory,

. . . qNVRAM speeds up the insert, update and delete transactions by up to 16.33x, 15.86x and 15.76x respectively, using both.

Furthermore, the amount of data committed to flash was reduced by about 40 percent. Given how common constant feed updates are on mobile devices, this is a significant result.

The StorageMojo take
Give the many complaints about smartphones that don’t have removable batteries, you’d think someone would have looked at this before. This research shows the upside of non-removable batteries: all DRAM can be treated as NVRAM.

Of course, qNVRAM can’t replace flash. DRAM is more power-hungry and costly than flash.

But by reducing I/O overhead qNVRAM shows significant gains in performance – and presumably battery life – can be achieved at little cost. It also simplifies the problem of extending flash endurance which may have important knock-on effects – such as enabling wider use of three-level cells.

I wish the researchers had also documented the overall impact of qNVRAM on system performance and battery life. Hopefully that’s next on the list.

It was obvious five years ago that the advent of non-removable batteries on phones and notebooks suggested a clean-sheet approach to persistency mechanisms. Congratulations to the researchers for taking a rigorous look at the problem.

Courteous comments welcome, of course.