Core Smartphone OS Topics

advertisement
Cellular Networks and Mobile
Computing
COMS 6998-11, Fall 2012
Instructor: Li Erran Li
(lierranli@cs.columbia.edu)
http://www.cs.columbia.edu/~lierranli/coms
6998-11Fall2012/
10/16/2012: Smart phone virtualization and
storage
Announcements
• Preliminary project report due next Friday,
October 26th
10/16/12
Cellular Networks and Mobile Computing
(COMS 6998-11)
Syllabus
• Mobile App Development (lecture 2,3)
– Mobile operating systems: iOS and Android
– Development environments: Xcode, Eclipse with Android SDK
– Programming: Objective-C and android programming
• System Support for Mobile App Optimization (lecture 4,7)
– Mobile device power models, energy profiling and ebug debugging
– Core OS topics: virtualization, storage and OS support for power and context management
• Interaction with Cellular Networks (lecture 1,5, 8)
– Basics of 3G/LTE cellular networks
– Mobile application cellular radio resource usage profiling
– Measurement-based cellular network and traffic characterization
• Interaction with the Cloud (lecture 6,9)
– Mobile cloud computing platform services: push notification, iCloud and Google Cloud
Messaging
– Mobile cloud computing architecture and programming models
• Mobile Platform Security and Privacy (lecture 10,11,12)
– Mobile platform security: malware detection, attacks and defenses
– Mobile data and location privacy: attacks, monitoring tools and defenses
10/16/12
Cellular Networks and Mobile Computing
(COMS 6998-11)
Smart Phone Virtualization: on Devices
Cells video:
http://www.youtube.com/watch?v=i_F92AS9a6
s
10/16/12
Cellular Networks and Mobile Computing
(COMS 6998-11)
Smart Phone Virtualization: on Servers
MegaDroid
• Off-the-shelf PCs emulates a town of
300,000 Android phones
– Emulate cellular and GPS behavior
• Usage:
– Tracing the wider effects of natural
disasters
– Hacking attempts
– Software bugs
– Assist real phone (e.g. offload
computation, virus check)
• Video:
http://www.engadget.com/2012/10/03/
sandia-labs-megadroid-projectsimulates-300-000-android-phones/
10/16/12
Cellular Networks and Mobile Computing
(COMS 6998-11)
Personal Phone
Business Phone
Developer Phone
Children’s Phone
10/16/12
Cellular Networks and Mobile Computing
(COMS 6998-11)
Courtesy: Jason Nieh et al.
Virtualization
10/16/12
Cellular Networks and Mobile Computing
(COMS 6998-11)
Courtesy: Jason Nieh et al.
Server Virtualization
Bare-Metal
Hypervisor
poor device support / sharing
OS
Kernel
OS
Kernel
OS
Kernel
Hypervisor / VMM
Hardware
10/16/12
Cellular Networks and Mobile Computing
(COMS 6998-11)
Courtesy: Jason Nieh et al.
Desktop Virtualization
Hosted Hypervisor
poor device
performance
host user space
OS
OS
OS
Hypervisor / VMM
kernel
module
Host OS Kernel
emulated
devices
Hardware
10/16/12
Cellular Networks and Mobile Computing
(COMS 6998-11)
Courtesy: Jason Nieh et al.
Non-Virtualization
User Space SDK
no standard apps
less secure
custom user
space API for
isolated apps
OS Kernel
Hardware
10/16/12
Cellular Networks and Mobile Computing
(COMS 6998-11)
Courtesy: Jason Nieh et al.
Key Challenges
• device diversity
Power
Cell Radio
Touchscreen
WiFi
microphone
headset
Buttons
GPS
GPU
Framebuffer
h.264 accel.
pmem
Binder IPC
Compass
camera(s)
speakers
Accelerometer
RTC / Alarms
• mobile usage model
➡graphics-accelerated UI
10/16/12
Cellular Networks and Mobile Computing
(COMS 6998-11)
Courtesy: Jason Nieh et al.
Cells
Key Observation
small:
one app at a time
large: lots of windows/apps
10/16/12
Cellular Networks and Mobile Computing
(COMS 6998-11)
Courtesy: Jason Nieh et al.
Cells
Key Observation
screen real-estate is limited, and
mobile phone users are accustomed
to interacting with one thing at time
10/16/12
Cellular Networks and Mobile Computing
(COMS 6998-11)
Courtesy: Jason Nieh et al.
Cells
Usage Model
foreground / background
10/16/12
Cellular Networks and Mobile Computing
(COMS 6998-11)
Courtesy: Jason Nieh et al.
Cells
Complete Virtualization
• multiple, isolated virtual phones (VPs)
on a single mobile device
• 100% device support in each VP
‣ unique phone numbers - single SIM!
‣ accelerated 3D graphics!
10/16/12
Cellular Networks and Mobile Computing
(COMS 6998-11)
Courtesy: Jason Nieh et al.
Cells
Efficient Virtualization
• less than 2% overhead in runtime tests
• imperceptible switch time among VPs
10/16/12
Cellular Networks and Mobile Computing
(COMS 6998-11)
Courtesy: Jason Nieh et al.
Single Kernel: Multiple VPs
isolated collection
of processes
VP 1
VP 2
VP 3
•••
virtualize at OS interface
Linux
Kernel
10/16/12
Cellular Networks and Mobile Computing
(COMS 6998-11)
Courtesy: Jason Nieh et al.
Single Kernel: Device Support
VP 1
Power
Cell Radio
WiFi
VP 3
microphone
headset
Buttons
GPS
hw codec
pmem
GPU
Framebuffer
camera(s)
speakers
Binder IPC
Compass
Accelerometer
RTC / Alarms
Linux
Kernel
10/16/12
Touchscreen
VP 2
Cellular Networks and Mobile Computing
(COMS 6998-11)
•••
Courtesy: Jason Nieh et al.
Single Kernel: Device Support
VP 1
VP 2
VP 3
all VPs access the same device
simultaneously
•••
10/16/12
Cellular Networks and Mobile Computing
(COMS 6998-11)
•••
Android...
RTC / Alarms
Audio/Video
Sensors
Input
Power
GPU
Framebuffer
Cell Radio
WiFi
Linux
Kernel
Courtesy: Jason Nieh et al.
Device Namespaces
VP 1
VP 2
VP 3
safely, correctly
multiplex access
to devices
Cellular Networks and Mobile Computing
(COMS 6998-11)
•••
Android...
RTC / Alarms
Audio/Video
Sensors
Input
Power
GPU
Cell Radio
WiFi
Framebuffer
device namespaces
Linux
Kernel
10/16/12
•••
Courtesy: Jason Nieh et al.
Cells
device namespaces
+
foreground / background
=
Complete, Efficient, Transparent
Mobile Virtualization
10/16/12
Cellular Networks and Mobile Computing
(COMS 6998-11)
Courtesy: Jason Nieh et al.
efficient basic graphics virtualization
hardware accelerated graphics
proprietary/closed interface
Cellular Networks and Mobile Computing
(COMS 6998-11)
•••
Android...
RTC / Alarms
Audio/Video
Sensors
Input
Power
GPU GPU
Cell Radio
WiFi
10/16/12
Framebuffer
Framebuffer
device namespaces
Linux
Kernel
Courtesy: Jason Nieh et al.
Approach 1: Single Assignment
virtual addresses
physical addresses
screen memory
Framebuffer
10/16/12
Cellular Networks and Mobile Computing
(COMS 6998-11)
Courtesy: Jason Nieh et al.
Approach 2: Emulated Hardware
emulated framebuffer
screen memory
Framebuffer
10/16/12
Cellular Networks and Mobile Computing
(COMS 6998-11)
virtual
state
Courtesy: Jason Nieh et al.
Cells: Device Namespaces
VP 1
VP 2
VP 3
background
background
mux_fb presents
foreground
identical device
interface to all VPs
using device
namespaces
swap virt addr mappings:
point to different phys addr
mux_fb
virtual addresses
physical addresses
screen memory
Framebuffer
10/16/12
Cellular Networks and Mobile Computing
(COMS 6998-11)
Courtesy: Jason Nieh et al.
Accelerated Graphics
VP 1
VP 2
VP 3
VP: just a set
of processes!
OpenGL
OpenGL
OpenGL
context
context
context
screen memory
process
isolation
Framebuffer
MMU
GPU
10/16/12
Cellular Networks and Mobile Computing
(COMS 6998-11)
graphics virtual addresses
physical addresses
Courtesy: Jason Nieh et al.
Device Namespace + Graphics
Context VP 1
VP 2
VP 3
foreground
background
background
OpenGL
OpenGL
OpenGL
context
context
context
screen memory
MMU
GPU
10/16/12
Cellular Networks and Mobile Computing
(COMS 6998-11)
graphics virtual addresses
physical addresses
Courtesy: Jason Nieh et al.
VoIP?
RilD
Vendor RIL
VoIP
Drivers
VoIP
Linux
Kernel
Baseband: GSM / CDMA
10/16/12
Cellular Networks and Mobile Computing
(COMS 6998-11)
Courtesy: Jason Nieh et al.
Dual-SIM?
RilD
RilD
Vendor RIL
10/16/12
Vendor RIL
Linux
Kernel
Drivers
Drivers
GSM/CDMA
GSM / CDMA
Cellular Networks and Mobile Computing
(COMS 6998-11)
Courtesy: Jason Nieh et al.
Cells: User-Level Namespace Proxy
vendor API
VP 1
VP 2
VP 3
foreground
background
background
RilD
Vendor
Cells RILRIL
RilD
RilD
proprietary hardware/software
requires a well-defined interface.
Cells RIL
Cells RIL
CellD
Drivers
Linux
Kernel
Root Namespace
Baseband: GSM / CDMA
10/16/12
Cellular Networks and Mobile Computing (COMS 6998-11) Courtesy: Jason Nieh et al.
Experimental Results
Setup
• Nexus S
• five virtual phones
• overhead vs. stock 〈Android 2.3〉
10/16/12
Cellular Networks and Mobile Computing
(COMS 6998-11)
Courtesy: Jason Nieh et al.
Experimental Results
Setup
• CPU 〈Linpack〉
• graphics 〈Neocore〉
• storage 〈Quadrant〉
• web browsing 〈Sun Spider〉
• networking 〈Custom WiFi Test〉
10/16/12
Cellular Networks and Mobile Computing
(COMS 6998-11)
Courtesy: Jason Nieh et al.
Experimental Results
Runtime Overhead
Negligible
Overhead In 3D
Measurements!
Courtesy: Jason Nieh et al.
Cells
Complete, Efficient, Transparent
Mobile Virtualization
• device namespaces
‣ safely and efficiently share devices
• foreground / background
‣ designed specifically for mobile devices
• implemented on Android
• less than 2% overhead on Nexus S
10/16/12
Cellular Networks and Mobile Computing
(COMS 6998-11)
Courtesy: Jason Nieh et al.
More Info
cells.cs.columbia.edu
10/16/12
cellrox.com
Cellular Networks and Mobile Computing
(COMS 6998-11)
Courtesy: Jason Nieh et al.
Revisiting Storage
for Smartphones
Hyojun Kim
10/16/12
Nitin Agrawal
Cellular Networks and Mobile Computing
(COMS 6998-11)
Cristian Ungureanu
Background
• blktrace: collect block level traces for device
I/O
• monkeyrunner
– installed at android-sdk-macosx/tools/monkeyrunner
– functional testing framework for Interactive
Android applications
10/16/12
Cellular Networks and Mobile Computing
(COMS 6998-11)
blktrace
• Block IO layer
10/16/12
Cellular Networks and Mobile Computing
(COMS 6998-11)
blktrace (Cont’d)
10/16/12
Cellular Networks and Mobile Computing
(COMS 6998-11)
Source: Alan D. Brunell
http://www.gelato.org/pdf/apr2006/gelato_IC
E06apr_blktrace_brunelle_hp.pdf
blktrace (Cont’d)
• blktrace sample traces
10/16/12
Source: Alan D. Brunell
Cellular Networks and Mobile Computing http://www.gelato.org/pdf/apr2006/gelato_IC
(COMS 6998-11)
E06apr_blktrace_brunelle_hp.pdf
monkeyrunner
Example code
1.
2.
# Imports the monkeyrunner modules used by this program
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
3.
4.
5.
6.
def main():
# Connects to the current device, returning a MonkeyDevice object
device = MonkeyRunner.waitForConnection()
print 'waiting for connection...\n’
7.
8.
package = 'coms6998.cs.columbia.edu’
activity = 'coms6998.cs.columbia.edu.VoiceRegonitionDemoActivity'
9.
10.
# sets the name of the component to start
runComponent = package + '/' + activity
11.
12.
# Runs the component
device.startActivity(component=runComponent)
13.
14.
# Presses the speaker button
device.press(’DPAD_DOWN', MonkeyDevice.DOWN_AND_UP)
device.press(’DPAD_CENTER', MonkeyDevice.DOWN_AND_UP)
15.
16.
# Takes a screenshot
screenshot = device.takeSnapshot()
17.
18.
19.
20.
21.
# Writes the screenshot to a file
screenshot.writeToFile('./device1.png','png')
reference = MonkeyRunner.loadImageFromFile(./device.png')
if not screenshot.sameAs('./device.png', 0.9):
print "comparison failed!\n"
22.
23.
if __name__ == '__main__':
main()
10/16/12
Cellular Networks and Mobile Computing
(COMS 6998-11)
monkeyrunner
• Demo
10/16/12
Cellular Networks and Mobile Computing
(COMS 6998-11)
Life in the “Post-PC” Mobile Era
Mobile
• Smartphone and tablet markets are huge & growing
– 100 Million smartphones shipped in Q4 2010, 92 M PCs
[IDC]
– Out of 750 Million Facebook users, 250 Million (&
growing) access through mobile; mobile users twice as
active [FB]
• Innovation in mobile hardware: packing everything
you need in your pocket
– Blurring the phone/tablet divide: Samsung Galaxy Note
– Hardware add-ons: NEC Medias (6.7mm thick,
waterproof shell, TV tuner, NFC, HD camera, ..)
• Manufacturers making it easier to replace PCs
– Motorola Atrix dock converts a phone into laptop
10/16/12
Cellular Networks and Mobile Computing
(COMS 6998-11)
Courtesy: Nitin Agrawal et al.
10/16/12
Cellular Networks and Mobile Computing
(COMS 6998-11)
Courtesy: Nitin Agrawal et al.
10/16/12
Cellular Networks and Mobile Computing
(COMS 6998-11)
Courtesy: Nitin Agrawal et al.
Waiting is undesirable!
Annoying for the user
More so for interactive
mobile users
More time, more battery
Easy to lose customers
Aren’t network and CPU the real problem?
Why are we talking about storage?
10/16/12
Cellular Networks and Mobile Computing
(COMS 6998-11)
Courtesy: Nitin Agrawal et al.
Understanding Mobile Performance
Well understood!
• Network performance can impact user experience
– 3G often considered the bottleneck for apps like browsing
– Service providers heavily investing in 4G and beyond
• CPU and graphics performance crucial as well
– Plenty of gaming, video, flash-player apps hungry for
compute
–
Quad-core
CPUs, GPUs to appear on mobile devices
Not
well understood!
• Does storage performance impact mobile experience?
– For storage, vendors & consumers mostly refer to capacity
10/16/12
Cellular Networks and Mobile Computing
(COMS 6998-11)
Courtesy: Nitin Agrawal et al.
Wireless Network Throughput Progression
Standard (theoretical)
Measured in Lab
Mobile Flash
802.11 a/g
3G
• Flash storage on mobile performs better than wireless networks
• Most apps are interactive; as long as performance exceeds that
of the network, difficult for storage to be bottleneck
10/16/12
Cellular Networks and Mobile Computing
(COMS 6998-11)
Courtesy: Nitin Agrawal et al.
Outline
 Introduction
Why storage is a problem
Android storage background and setup
Experimental results
Solutions
10/16/12
Cellular Networks and Mobile Computing
(COMS 6998-11)
Courtesy: Nitin Agrawal et al.
Why Storage is a Problem
• Performance for random
I/O significantly worse
than seq; inherent with
flash storage
• Mobile flash storage
classified into speed
classes based on
sequential throughput
 Random write performance is
orders of magnitude worse
Vendor
(16GB)
Speed
Class
Cost
US $
Seq
Write
Rand
Write
Transcend
2
26
4.2
1.18
RiData
2
27
7.9
0.02
Sandisk
4
23
5.5
0.70
Kingston
4
25
4.9
0.01
Wintec
6
25
15.0
0.01
A-Data
6
30
10.8
0.01
Patriot
10
29
10.5
0.01
PNY
10
29
15.3
0.01
Consumer-grade SD performance
However, we find that for several popular apps, substantial
fraction of I/O is random writes (including web browsing!)
10/16/12
Cellular Networks and Mobile Computing
(COMS 6998-11)
Courtesy: Nitin Agrawal et al.
Performance MB/s
Random versus Sequential Disparity
Why Storage is a Problem
Shifting Performance Bottlenecks
Standard (theoretical)
Measured in Lab
Mobile Flash Seq
802.11 A/G
3G
Mobile Flash Rand
• Storage coming under increasingly more scrutiny in mobile usage
– Random I/O performance has not kept pace with network improvements
– 802.11n (600 Mbps peak) and 802.11ad (7 Gbps peak) offer potential for
significantly faster network connectivity to mobile devices in the future
10/16/12
Cellular Networks and Mobile Computing
(COMS 6998-11)
Courtesy: Nitin Agrawal et al.
Deconstructing Mobile App
Performance
• Focus: understanding contribution of storage
– How does storage subsystem impact performance of popular
and common applications on mobile devices?
– Performed analysis on Android for several popular apps
• Several interesting observations through measurements
– Storage adversely affects performance of even interactive apps,
including ones not thought of as storage I/O intensive
– SD Speed Class not necessarily indicative of app performance
– Higher total CPU consumption for same activity when using
slower storage; points to potential problems with OS or apps
• Improving storage stack to improve mobile experience
10/16/12
Cellular Networks and Mobile Computing
(COMS 6998-11)
Courtesy: Nitin Agrawal et al.
Outline
 Introduction
 Why storage is a problem
Android storage background and setup
Experimental results
Solutions
10/16/12
Cellular Networks and Mobile Computing
(COMS 6998-11)
Courtesy: Nitin Agrawal et al.
Storage Partitions on Android
/misc
/recovery
/boot
/system
/cache
/data
/sdcard
896KB
settings
rootfs
4MB
alternate boot
rootfs
3.5MB
kernel
yaffs2
145MB
read-only
yaffs2
95MB
read write
yaffs2
196.3MB
read write
FAT32
16GB
read write
Internal NAND Flash Memory (512MB)
Partition
External SD
Function
Misc
H/W settings, persistent shared space between OS & bootloader
Recovery
Alternative boot-into-recovery partition for advanced recovery
Boot
Enables the phone to boot, includes the bootloader and kernel
System
Contains the remaining OS, pre-installed system apps ; read-only
Cache
Used to stage and apply “over the air” updates; holds system images
Data
Stores user data (e.g., contacts, messages, settings) and installed apps;
SQLite DB containing app data also stored here. Wiped on factory reset
Sdcard
External SD card partition to store media, documents, backup files etc
Sd-ext
Non-standard partition on SD card that can act as data partition
10/16/12
Cellular Networks and Mobile Computing
(COMS 6998-11)
Courtesy: Nitin Agrawal et al.
Phone and Generic Experimental
Setup
• Rooted and set up a Google Nexus One phone
for development
– GSM phone with a 1 GHz Qualcomm QSD8250
Snapdragon processor
– 512 MB RAM, and 512 MB internal flash storage
• Setup dedicated wireless access point
– 802.11 b/g on a laptop for WiFi experiments
• Installed AOSP (Android Open Source Project)
– Linux kernel 2.6.35.7 modified to provide resource
usage information
10/16/12
Cellular Networks and Mobile Computing
(COMS 6998-11)
Courtesy: Nitin Agrawal et al.
Custom Experimental Setup
Requirements beyond stock Android
• Ability to compare app performance on different storage devices
– Several apps heavily use the internal non-removable storage
– To observe and measure all I/O activity, we modified Android’s init process to
mount all internal partitions on SD card
– Measurement study over the internal flash memory and 8 external SD cards,
chosen 2 each from the different SD speed classes
• Observe effects of shifting bottlenecks w/ faster wireless networks
– But, faster wireless networks not available on the phones of today
– Reverse Tethering to emulate faster networks: lets the smartphone access
the host computer’s internet connection through a wired link (miniUSB cable)
• Instrumentation to measure CPU, storage, memory, n/w utilization
• Setup not typical but allows running what-if scenarios with storage
devices and networks of different performance characteristics
10/16/12
Cellular Networks and Mobile Computing
(COMS 6998-11)
Courtesy: Nitin Agrawal et al.
Apps and Experiments Performed
WebBench
Browser
Facebook
Visits 50 websites
Based on WebKit
Using HTTP proxy server
Android Email
App Install
Top 10 apps on Market
Google Maps
Pulse News Reader
App Launch
Games, Weather, YouTube
GasBuddy, Gmail, Twitter,
Books, Gallery, IMDB
RLBench SQLite
Synthetic SQL benchmark
10/16/12
Background
Apps: Twitter, Books, Gmail
Contacts, Picasa, Calendar
Widgets: Pulse, YouTube,
News, Weather, Calendar,
Facebook, Market, Twitter
Cellular Networks and Mobile Computing
(COMS 6998-11)
Courtesy: Nitin Agrawal et al.
Outline
 Introduction
 Why storage is a problem
 Android storage background and setup
Experimental results (talk focuses on runtime of apps)
Paper has results on I/O activity, CPU, App Launch
behavior, etc
Solutions
10/16/12
Cellular Networks and Mobile Computing
(COMS 6998-11)
Courtesy: Nitin Agrawal et al.
WebBench Results: Runtime
WIFI
USB
3000
2000
100
Time (s)
Time (seconds)
4000
WiFi
80
60
40
1000
20
0
0
USB
Time taken for iPerf
to download 100MB
Runtime on WiFi varies by 2000% between internal and Kingston
• Even with repeated experiments, with new cards across speed classes
Even without considering Kingston, significant performance variation (~200%)
Storage significantly affects app performance and consequently user experience
With a faster network (USB in RT), variance was 222% (without Kingston)
With 10X increase in N/W speed, hardly any difference in runtime
10/16/12
Cellular Networks and Mobile Computing
(COMS 6998-11)
Courtesy: Nitin Agrawal et al.
WebBench Results: Runtime
WIFI
USB
500
100
Time (s)
Time (seconds)
600
400
300
200
WiFi
80
60
40
100
20
0
0
USB
Time taken for iPerf
to download 100MB
Runtime on WiFi varies by 2000% between internal and Kingston
• Even with repeated experiments, with new cards across speed classes
Even without considering Kingston, significant performance variation (~200%)
Storage significantly affects app performance and consequently user experience
With a faster network (USB in RT), variance was 222% (without Kingston)
With 10X increase in N/W speed, hardly any difference in runtime
10/16/12
Cellular Networks and Mobile Computing
(COMS 6998-11)
Courtesy: Nitin Agrawal et al.
Runtimes for Popular Apps (without
FaceBook
Kingston)
Maps
200
40
100
100
20
0
0
0
200
App Install
RLBench
Email
Pulse News
400
200
100
200
100
50
0
0
0
We find a similar trend for several popular apps
Storage device performance important, better card  faster apps
Apart from the benefits provided by selecting a good flash device,
are there additional opportunities for improvement in storage?
10/16/12
Cellular Networks and Mobile Computing
(COMS 6998-11)
Courtesy: Nitin Agrawal et al.
WebBench: Sequential versus
Random I/O
Vendor
I/O Breakdown
•
•
•
•
Seq:Rand
perf ratio
Rand
IOPS
Transcend
4
302
Sandisk
8
179
RiData
395
5
Kingston
490
2.6
Wintec
1500
2.6
A-Data
1080
2.6
Patriot
1050
2.6
PNY
1530
2.6
Few reads, mostly at the start; significantly more writes
About 2X more sequential writes than random writes
Since rand is worse than seq by >> 2X, random dominates
Apps write enough randomly to cause severe performance drop
Paper has a table on I/O activity for other apps
10/16/12
Cellular Networks and Mobile Computing
(COMS 6998-11)
Courtesy: Nitin Agrawal et al.
How Apps Use Storage?
• Exactly what makes web browsing slow on Android?
– Key lies in understanding how apps use SQLite and FS interface
/data/data/com.necla.webview
WebBench
Storage Schema
lib (empty)
cache
webviewCache
databases
These files written to
SQLite in sync
These files written to FS in
write-behind
6aaa3f00, 03051d8d, …
many files (5.5MB)
webview.db (14KB)
webviewCache.db (129KB)
 Apps typically store some data in FS (e.g., cache files)
and some in a SQLite database (e.g., cache map)
– All data through SQLite is written synchronously  slow!
– Apps often use SQLite oblivious to performance effects
10/16/12
Cellular Networks and Mobile Computing
(COMS 6998-11)
Courtesy: Nitin Agrawal et al.
What-If Analysis for Solutions
A. Web Cache in RAM
B. DB (SQLite) in RAM
C. All in RAM
D. All on SD w/ no-sync
What is the potential for improvements?
–E.g., if all data could be kept in RAM?
–Analysis to answer hypothetical questions
600
Time (seconds)
500
Placing Cache on Ramdisk
does not improve perf.
much
WebBench on RiData
Both Cache and DB on
SD without sync
recoups most perf
DB on Ramdisk
alone improves
perf. significantly
400
300
Both Cache and
DB in RAM  no
extra benefit
200
100
A
0
Baseline
10/16/12
Courtesy: Nitin Agrawal et al.
Cache in
RAM
B
C
DB in RAM All in RAM
Cellular Networks and Mobile Computing
(COMS 6998-11)
D
Disable
fsync
Implications of Experimental Analysis
• Storage stack affects mobile application performance
– Depends on random v/s sequential I/O performance
• Key bottleneck is ``wimpy’’ storage on mobile devices
– Performance can be much worse than laptops, desktops
– Storage on mobile being used for desktop-like workloads
• Android exacerbates poor storage performance through
synchronous SQLite interface
– Apps use SQLite for functionality, not always needing reliability
– SQLite write traffic is quite random  further slowdown!
• Apps use Android interfaces oblivious to performance
– Browser writes cache map to SQLite; slows cache writes a lot
10/16/12
Cellular Networks and Mobile Computing
(COMS 6998-11)
Courtesy: Nitin Agrawal et al.
Outline
 Introduction
 Why storage is a problem
 Android storage background and setup
 Experimental results
Solutions
10/16/12
Cellular Networks and Mobile Computing
(COMS 6998-11)
Courtesy: Nitin Agrawal et al.
600
• RAID-0 over SD card and internal flash
500
– Leverage I/O parallelism already existent
– Simple software RAID driver with striped I/O
– As expected speedup, along with super linear
speedup due to flash idiosyncrasies (in paper)
• Back to log-structured file systems
Time (seconds)
Pilot Solutions
– Using NilFS2 to store SQLite databases
– Moderate benefit; suboptimal
implementation
PCM
300
RAM
200
100
LogFS
120
Time (seconds)
– Turn off sync for files that are deemed async
per our analysis (e.g., WebCache Map DB)
– Benefits depend on app semantics & structure
– Store performance sensitive I/O (SQLite DB)
– Small amount of PCM goes a long way
RAID
0
• Application-specific selective sync
• PCM write buffer for flash cards
400
Base
Base
100
80
RAID
Courtesy: Nitin Agrawal et al.
PCM
RAM
60
40
20
0
LogFS
10/16/12
SelSync
Cellular Networks and Mobile Computing
(COMS 6998-11)
SelSync
WebBench on RiData
Conclusion
• Contrary to conventional wisdom, storage does affect
mobile application performance
– Effects are pronounced for a variety of interactive apps!
• Pilot solutions hint at performance improvements
– Small degree of application awareness leads to efficient solutions
– Pave the way for robust, deployable solutions in the future
• Storage subsystem on mobile devices needs a fresh look
– We have taken the first steps, plenty of exciting research ahead!
– E.g., poor storage can consume excessive CPU; potential to
improve energy consumption through better storage
10/16/12
Cellular Networks and Mobile Computing
(COMS 6998-11)
Courtesy: Nitin Agrawal et al.
Questions?
10/16/12
Cellular Networks and Mobile Computing
(COMS 6998-11)
Download