Three researchers, Hao Luo, Lei Tian and Hong Jiang of the University of Nebraska, asked a simple and seemingly obvious question. Since our mobile devices have non-removable batteries why don't we treat DRAM as if it were nonvolatile?
Their paper, qNVRAM: quasi Non-Volatile RAM for Low Overhead Persistency Enforcement in Smartphones was presented at the Usenix HotStorage conference last month.
Typically Android mobile devices rely on SQLite, a shared preference key value store or the filesystem API to save persistent data on local flash. These employ journaling or file-level double-writes to ensure persistency.
The problem is that these techniques require 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 percent of Twitter data was 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. From the paper:
Furthermore, it turns out that Android kernel reliability — where these data structures reside — 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 percent of all 19,670 reported issues related to Android defects with unexpected or random power-off. That implies a small chance that unexpected power failure may occur.
The researchers constructed a prototype test system with the 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. Absorbs repeated writes to table files to further reduce I/O.
Implemented on an Android smartphone they found that
"...qNVRAM speeds up the insert, update and delete transactions by up to 16.33x, 15.86x and 15.76x respectively."
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 Storage Bits take
Some are miffed that many smartphones don't have easily removable batteries. This research shows the upside of such designs: all DRAM can be treated as NVRAM whether on Android or Apple's iOS.
Note that qNVRAM can't replace flash. DRAM is more power-hungry and costly than flash.
But research shows that by reducing the I/O overhead of the system with qNVRAM, significant gains in performance — and presumably battery life — can be achieved at very little cost. It also simplifies the problem of extending flash endurance.
It was obvious five years ago with the advent of non-removable batteries on phones and notebooks that engineers could take a new look at achieving persistency. Congratulations to the researchers for taking a rigorous approach to the problem.
Comments welcome, as always. What problems do you see with qNVRAM?