Boosting Quasi-Asynchronous I/O for Better Responsiveness in Mobile...

50
Boosting Quasi-Asynchronous I/O for Better Responsiveness in Mobile Devices Daeho Jeong *+ , Youngjae Lee + , Jin-Soo Kim + * Samsung Co., Suwon, Korea + Sungkyunkwan University

Transcript of Boosting Quasi-Asynchronous I/O for Better Responsiveness in Mobile...

Page 1: Boosting Quasi-Asynchronous I/O for Better Responsiveness in Mobile Devicescsl.skku.edu/papers/fast15-slides.pdf · 2015-06-09 · Boosting Quasi-Asynchronous I/O for Better Responsiveness

Boosting Quasi-Asynchronous I/O for Better Responsiveness

in Mobile Devices

Daeho Jeong*+, Youngjae Lee+, Jin-Soo Kim+

*Samsung Co., Suwon, Korea

+Sungkyunkwan University

Page 2: Boosting Quasi-Asynchronous I/O for Better Responsiveness in Mobile Devicescsl.skku.edu/papers/fast15-slides.pdf · 2015-06-09 · Boosting Quasi-Asynchronous I/O for Better Responsiveness

2/49

Page 3: Boosting Quasi-Asynchronous I/O for Better Responsiveness in Mobile Devicescsl.skku.edu/papers/fast15-slides.pdf · 2015-06-09 · Boosting Quasi-Asynchronous I/O for Better Responsiveness

3/49

Page 4: Boosting Quasi-Asynchronous I/O for Better Responsiveness in Mobile Devicescsl.skku.edu/papers/fast15-slides.pdf · 2015-06-09 · Boosting Quasi-Asynchronous I/O for Better Responsiveness

4/49

TOUCH!!

Page 5: Boosting Quasi-Asynchronous I/O for Better Responsiveness in Mobile Devicescsl.skku.edu/papers/fast15-slides.pdf · 2015-06-09 · Boosting Quasi-Asynchronous I/O for Better Responsiveness

5/49

………

Page 6: Boosting Quasi-Asynchronous I/O for Better Responsiveness in Mobile Devicescsl.skku.edu/papers/fast15-slides.pdf · 2015-06-09 · Boosting Quasi-Asynchronous I/O for Better Responsiveness

6/49

Page 7: Boosting Quasi-Asynchronous I/O for Better Responsiveness in Mobile Devicescsl.skku.edu/papers/fast15-slides.pdf · 2015-06-09 · Boosting Quasi-Asynchronous I/O for Better Responsiveness

7/49

• CPU?

• Memory?

• I/O?

Page 8: Boosting Quasi-Asynchronous I/O for Better Responsiveness in Mobile Devicescsl.skku.edu/papers/fast15-slides.pdf · 2015-06-09 · Boosting Quasi-Asynchronous I/O for Better Responsiveness

8/49

Linux Approaches in I/O Scheduling

• Block layer

– Classify I/O into {SYNC || ASYNC}

• CFQ I/O scheduler

– SYNC queues have larger time slices than ASYNC

– A SYNC queue per a process

(vs. An ASYNC queue is shared)

– Set a limit for ASYNC requests that can be dispatched in a single time slice

– A new SYNC req. preempts other ASYNC req.

Page 9: Boosting Quasi-Asynchronous I/O for Better Responsiveness in Mobile Devicescsl.skku.edu/papers/fast15-slides.pdf · 2015-06-09 · Boosting Quasi-Asynchronous I/O for Better Responsiveness

9/49

I/O scheduler

Page Cache page page page page page page

Apps

Page 10: Boosting Quasi-Asynchronous I/O for Better Responsiveness in Mobile Devicescsl.skku.edu/papers/fast15-slides.pdf · 2015-06-09 · Boosting Quasi-Asynchronous I/O for Better Responsiveness

10/49

I/O scheduler

Async I/O

Async I/O

Async I/O

Async I/O

Async I/O

Async I/O

Async I/O

Async I/O

Page Cache page page page page page page

By kworker,

Especially, when the number

of dirty pages exceeds

the background dirty ratio

Page 11: Boosting Quasi-Asynchronous I/O for Better Responsiveness in Mobile Devicescsl.skku.edu/papers/fast15-slides.pdf · 2015-06-09 · Boosting Quasi-Asynchronous I/O for Better Responsiveness

11/49

What if a process waits for

the completion of asynchronous I/O?

Processing Order Wait on Write Back!!

Task A

I/O scheduler

Async I/O

Async I/O

Async I/O

Async I/O

Async I/O

Async I/O

Async I/O

Async I/O

Page 12: Boosting Quasi-Asynchronous I/O for Better Responsiveness in Mobile Devicescsl.skku.edu/papers/fast15-slides.pdf · 2015-06-09 · Boosting Quasi-Asynchronous I/O for Better Responsiveness

12/49

Quasi-Asynchronous I/O (QASIO)

• Quasi-Asynchronous I/O

– Issued asynchronously, but should be treated as synchronous I/O

– Detected at run time

– Causes a problem such as priority inversion problem

• Causes unexpected delay

– Similar to priority inversion problem

Processing Order Wait on Write Back!!

Task A

I/O scheduler

Async I/O

Async I/O

Async I/O

Async I/O

Async I/O

Async I/O

Async I/O

QASIO

Page 13: Boosting Quasi-Asynchronous I/O for Better Responsiveness in Mobile Devicescsl.skku.edu/papers/fast15-slides.pdf · 2015-06-09 · Boosting Quasi-Asynchronous I/O for Better Responsiveness

13/49

Outline • Definition of QASIO

• Dependencies on QASIO

• Impact by QASIO

• Implementation Overview

• Evaluation

• Conclusions

Page 14: Boosting Quasi-Asynchronous I/O for Better Responsiveness in Mobile Devicescsl.skku.edu/papers/fast15-slides.pdf · 2015-06-09 · Boosting Quasi-Asynchronous I/O for Better Responsiveness

14/49

Dependencies on QASIO

Async I/O

QASIO Async

I/O Async

I/O

Direct dependency

Indirect dependency

Process A

Process B

I/O scheduler

Page 15: Boosting Quasi-Asynchronous I/O for Better Responsiveness in Mobile Devicescsl.skku.edu/papers/fast15-slides.pdf · 2015-06-09 · Boosting Quasi-Asynchronous I/O for Better Responsiveness

15/49

Types of Dependencies on QASIO

• Direct Dependencies

– Dmeta : When modifying a metadata page

– Ddata : When modifying a data page

– Dsync : When guaranteeing data to be written back

– Ddiscard : When completing discard commands

• Indirect Dependencies

– Ijhandle : When unable to obtain a journal handle

– Ijcommit : When unable to complete fsync()

Page 16: Boosting Quasi-Asynchronous I/O for Better Responsiveness in Mobile Devicescsl.skku.edu/papers/fast15-slides.pdf · 2015-06-09 · Boosting Quasi-Asynchronous I/O for Better Responsiveness

16/49

Types of Dependencies on QASIO

• Direct Dependencies

– Dmeta : When modifying a metadata page

– Ddata : When modifying a data page

– Dsync : When guaranteeing data to be written back

– Ddiscard : When completing discard commands

• Indirect Dependencies

– Ijhandle : When unable to obtain a journal handle

– Ijcommit : When unable to complete fsync()

Refer to our paper

Page 17: Boosting Quasi-Asynchronous I/O for Better Responsiveness in Mobile Devicescsl.skku.edu/papers/fast15-slides.pdf · 2015-06-09 · Boosting Quasi-Asynchronous I/O for Better Responsiveness

17/49

Types of Dependencies on QASIO

• Direct Dependencies

– Dmeta : When modifying a metadata page

– Ddata : When modifying a data page

– Dsync : When guaranteeing data to be written back

– Ddiscard : When completing discard commands

• Indirect Dependencies

– Ijhandle : When unable to obtain a journal handle

– Ijcommit : When unable to complete fsync()

Page 18: Boosting Quasi-Asynchronous I/O for Better Responsiveness in Mobile Devicescsl.skku.edu/papers/fast15-slides.pdf · 2015-06-09 · Boosting Quasi-Asynchronous I/O for Better Responsiveness

18/49

Case Study of Dmeta

page

1. async. bulky write

Page Cache

2. flush out

page page page

Apps

I/O Scheduler

kworker

rename(), write(), unlink(), chmod(), chown(), fsync()

Page 19: Boosting Quasi-Asynchronous I/O for Better Responsiveness in Mobile Devicescsl.skku.edu/papers/fast15-slides.pdf · 2015-06-09 · Boosting Quasi-Asynchronous I/O for Better Responsiveness

19/49

Case Study of Dmeta

page

1. async. bulky write

Page Cache

2. flush out

JBD2 Journaling 3. COMMIT

& make “dirty” page page page

Apps

inode entries, directory entries,

block bitmaps, inode bitmaps,

group descriptors, super block

metadata buffer

I/O Scheduler

kworker

Page 20: Boosting Quasi-Asynchronous I/O for Better Responsiveness in Mobile Devicescsl.skku.edu/papers/fast15-slides.pdf · 2015-06-09 · Boosting Quasi-Asynchronous I/O for Better Responsiveness

20/49

I/O Scheduler Async I/O

Case Study of Dmeta

4. flush out & lock buffer

page

1. async. bulky write

Page Cache

2. flush out

JBD2 Journaling 3. COMMIT

& make “dirty” page page page

Apps

metadata buffer

kworker

Page 21: Boosting Quasi-Asynchronous I/O for Better Responsiveness in Mobile Devicescsl.skku.edu/papers/fast15-slides.pdf · 2015-06-09 · Boosting Quasi-Asynchronous I/O for Better Responsiveness

21/49

Case Study of Dmeta

4. flush out & lock buffer

page

1. async. bulky write

Page Cache

2. flush out

JBD2 Journaling 3. COMMIT

& make “dirty”

rename(), write(), unlink(), chmod(), chown(), fsync()

page page page

Apps

metadata buffer

I/O Scheduler Async I/O

kworker

Page 22: Boosting Quasi-Asynchronous I/O for Better Responsiveness in Mobile Devicescsl.skku.edu/papers/fast15-slides.pdf · 2015-06-09 · Boosting Quasi-Asynchronous I/O for Better Responsiveness

22/49

Case Study of Dmeta

4. flush out & lock buffer

5. invoke file operations (lock_buffer())

Dmeta

page

1. async. bulky write

Page Cache

2. flush out

metadata buffer

JBD2 Journaling 3. COMMIT

& make “dirty”

rename(), write(), unlink(), chmod(), chown(), fsync()

page page page

Apps

I/O Scheduler QASIO

kworker

Page 23: Boosting Quasi-Asynchronous I/O for Better Responsiveness in Mobile Devicescsl.skku.edu/papers/fast15-slides.pdf · 2015-06-09 · Boosting Quasi-Asynchronous I/O for Better Responsiveness

23/49

Case Study of Dsync

write()

I/O Scheduler

Page Cache

page

UI Task Normal Case

Page 24: Boosting Quasi-Asynchronous I/O for Better Responsiveness in Mobile Devicescsl.skku.edu/papers/fast15-slides.pdf · 2015-06-09 · Boosting Quasi-Asynchronous I/O for Better Responsiveness

24/49

Case Study of Dsync

fsync() (flush & wait)

I/O Scheduler

Page Cache

Sync. Req.

page

UI Task Normal Case

Page 25: Boosting Quasi-Asynchronous I/O for Better Responsiveness in Mobile Devicescsl.skku.edu/papers/fast15-slides.pdf · 2015-06-09 · Boosting Quasi-Asynchronous I/O for Better Responsiveness

25/49

Case Study of Dsync

page

1. async. bulky write

Page Cache

2. flush out

page page page

Apps

UI Task

I/O Scheduler

kworker

Page 26: Boosting Quasi-Asynchronous I/O for Better Responsiveness in Mobile Devicescsl.skku.edu/papers/fast15-slides.pdf · 2015-06-09 · Boosting Quasi-Asynchronous I/O for Better Responsiveness

26/49

Case Study of Dsync

page

1. async. bulky write

Page Cache

2. flush out

write()

page page page

Apps

UI Task

page

3. async. write

I/O Scheduler

kworker

Page 27: Boosting Quasi-Asynchronous I/O for Better Responsiveness in Mobile Devicescsl.skku.edu/papers/fast15-slides.pdf · 2015-06-09 · Boosting Quasi-Asynchronous I/O for Better Responsiveness

27/49

Case Study of Dsync

page

1. async. bulky write

Page Cache

2. flush out

write()

page page page

Apps

UI Task

page

3. async. write

4. flush out

I/O Scheduler Async I/O

kworker

Page 28: Boosting Quasi-Asynchronous I/O for Better Responsiveness in Mobile Devicescsl.skku.edu/papers/fast15-slides.pdf · 2015-06-09 · Boosting Quasi-Asynchronous I/O for Better Responsiveness

28/49

Case Study of Dsync

5. invoke fsync() (wait_on_page_writeback())

Dsync

page

1. async. bulky write

Page Cache

2. flush out

fsync()

page page page

Apps

UI Task

page

3. async. write

I/O Scheduler QASIO

kworker

4. flush out

Page 29: Boosting Quasi-Asynchronous I/O for Better Responsiveness in Mobile Devicescsl.skku.edu/papers/fast15-slides.pdf · 2015-06-09 · Boosting Quasi-Asynchronous I/O for Better Responsiveness

29/49

Case Study of Ijhandle

Page Cache

page

write()

page page

Apps

Task A

JBD2 Journaling

handle

Running Transaction

1. 1K partial write

I/O Scheduler

kworker

Page 30: Boosting Quasi-Asynchronous I/O for Better Responsiveness in Mobile Devicescsl.skku.edu/papers/fast15-slides.pdf · 2015-06-09 · Boosting Quasi-Asynchronous I/O for Better Responsiveness

30/49

Case Study of Ijhandle

Page Cache

page

write()

page page

Apps

Task A

JBD2 Journaling

handle

Running Transaction

1. 1K partial write

2. flush out

I/O Scheduler Async I/O

kworker

Page 31: Boosting Quasi-Asynchronous I/O for Better Responsiveness in Mobile Devicescsl.skku.edu/papers/fast15-slides.pdf · 2015-06-09 · Boosting Quasi-Asynchronous I/O for Better Responsiveness

31/49

Case Study of Ijhandle

Page Cache

page

write()

page page

Apps

Task A

JBD2 Journaling

Running Transaction

1. 1K partial write

2. flush out

handle

3. 1K partial write

I/O Scheduler Async I/O

kworker

Page 32: Boosting Quasi-Asynchronous I/O for Better Responsiveness in Mobile Devicescsl.skku.edu/papers/fast15-slides.pdf · 2015-06-09 · Boosting Quasi-Asynchronous I/O for Better Responsiveness

32/49

Case Study of Ijhandle

Page Cache

page

write()

page page

Apps

Task A

JBD2 Journaling

Running Transaction

1. 1K partial write

2. flush out

handle

3. 1K partial write

4. wait_on_page_writeback()

Ddata I/O Scheduler QASIO

kworker

Page 33: Boosting Quasi-Asynchronous I/O for Better Responsiveness in Mobile Devicescsl.skku.edu/papers/fast15-slides.pdf · 2015-06-09 · Boosting Quasi-Asynchronous I/O for Better Responsiveness

33/49

Case Study of Ijhandle

2. flush out

Page Cache

page

4. wait_on_page_writeback()

page page

Apps

Task A

JBD2 Journaling

handle

Running Transaction

1. 1K partial write

3. 1K partial write

5. COMMIT & locked

Ddata I/O Scheduler QASIO

kworker

Page 34: Boosting Quasi-Asynchronous I/O for Better Responsiveness in Mobile Devicescsl.skku.edu/papers/fast15-slides.pdf · 2015-06-09 · Boosting Quasi-Asynchronous I/O for Better Responsiveness

34/49

Case Study of Ijhandle

2. flush out

Ijhandle

Page Cache

page

4. wait_on_page_writeback()

page page

Apps

Task A

JBD2 Journaling

handle

Running Transaction

1. 1K partial write

3. 1K partial write

5. COMMIT & locked

Other Tasks

Ddata I/O Scheduler QASIO

kworker

Page 35: Boosting Quasi-Asynchronous I/O for Better Responsiveness in Mobile Devicescsl.skku.edu/papers/fast15-slides.pdf · 2015-06-09 · Boosting Quasi-Asynchronous I/O for Better Responsiveness

35/49

How Severe is the delay by QASIO?

• The delay by QASIOs depends on

– The number of outstanding requests

– The maximum number of requests

– I/O performance of underlying storage device

• A file system call can be blocked for

–Over 1 second on an MLC eMMC (S.W.: 57.4 MB/s)

–Over 4 seconds on a TLC eMMC (S.W.: 26.0 MB/s)

I/O scheduler

Async I/O

Async I/O

Async I/O

Async I/O

Async I/O

Async I/O

Async I/O

QASIO

S.W. => Sequential Write Bandwidth

Page 36: Boosting Quasi-Asynchronous I/O for Better Responsiveness in Mobile Devicescsl.skku.edu/papers/fast15-slides.pdf · 2015-06-09 · Boosting Quasi-Asynchronous I/O for Better Responsiveness

36/49

Degradations by QASIOs in Real-Life Scenarios

App start time is slowed down by 2.4x in the worst case

Shot count is decreased by 19%

App install time is increased by 35%

Page 37: Boosting Quasi-Asynchronous I/O for Better Responsiveness in Mobile Devicescsl.skku.edu/papers/fast15-slides.pdf · 2015-06-09 · Boosting Quasi-Asynchronous I/O for Better Responsiveness

37/49

How to Boost a QASIO

• Just focus on Direct Dependencies

• Two requirements

– Req.(1): When a task is waiting for an asynchronous I/O’s completion, the kernel gives information about QASIO to the I/O scheduler

– Req.(2): The I/O scheduler should prioritize them among asynchronous I/Os based on the hint

Page 38: Boosting Quasi-Asynchronous I/O for Better Responsiveness in Mobile Devicescsl.skku.edu/papers/fast15-slides.pdf · 2015-06-09 · Boosting Quasi-Asynchronous I/O for Better Responsiveness

38/49

How to Boost a QASIO

• Just focus on Direct Dependencies

• Two requirements

– Req.(1): When a task is waiting for an asynchronous I/O’s completion, the kernel gives information about QASIO to the I/O scheduler

=> VFS, MM, FS, Block Layer

– Req.(2): The I/O scheduler should prioritize them among asynchronous I/Os based on the hint

=> Each I/O Scheduler

Page 39: Boosting Quasi-Asynchronous I/O for Better Responsiveness in Mobile Devicescsl.skku.edu/papers/fast15-slides.pdf · 2015-06-09 · Boosting Quasi-Asynchronous I/O for Better Responsiveness

39/49

Implementation Overview

Page 40: Boosting Quasi-Asynchronous I/O for Better Responsiveness in Mobile Devicescsl.skku.edu/papers/fast15-slides.pdf · 2015-06-09 · Boosting Quasi-Asynchronous I/O for Better Responsiveness

40/49

Implementation Overview

Page 41: Boosting Quasi-Asynchronous I/O for Better Responsiveness in Mobile Devicescsl.skku.edu/papers/fast15-slides.pdf · 2015-06-09 · Boosting Quasi-Asynchronous I/O for Better Responsiveness

41/49

Evaluations

• Samsung Galaxy S5

– Exynos 5422 (quad Cortex-A15 & quad Cortex-A7)

– 2GB DRAM

– 16GB eMMC storage (S.W.: 54.5MB/s, R.W.: 10.4MB/s)

– Android platform version 4.4.2 (KitKat)

– Linux kernel version 3.10.9

• Evaluation methodology

– Microbenchmarks, Real-life scenarios, Android I/O benchmarks

Page 42: Boosting Quasi-Asynchronous I/O for Better Responsiveness in Mobile Devicescsl.skku.edu/papers/fast15-slides.pdf · 2015-06-09 · Boosting Quasi-Asynchronous I/O for Better Responsiveness

42/49

Microbenchmarks

• Five microbenchmarks (M1 ~ M5)

• M1

– Iterates the creation of a 4KB file, 500 times

– performs fsync() to each created file

– creat() -> write(4KB) -> fsync() -> close()

– Mimics the I/O pattern of DB

Page 43: Boosting Quasi-Asynchronous I/O for Better Responsiveness in Mobile Devicescsl.skku.edu/papers/fast15-slides.pdf · 2015-06-09 · Boosting Quasi-Asynchronous I/O for Better Responsiveness

43/49

Microbenchmarks

• The normalized total elapsed time

The total elapsed time is reduced by up to 83.1%↓

Page 44: Boosting Quasi-Asynchronous I/O for Better Responsiveness in Mobile Devicescsl.skku.edu/papers/fast15-slides.pdf · 2015-06-09 · Boosting Quasi-Asynchronous I/O for Better Responsiveness

44/49

Microbenchmarks

• The latency of key file system calls

97.3%↓ 98.4%↓ 90.2%↓

Page 45: Boosting Quasi-Asynchronous I/O for Better Responsiveness in Mobile Devicescsl.skku.edu/papers/fast15-slides.pdf · 2015-06-09 · Boosting Quasi-Asynchronous I/O for Better Responsiveness

45/49

Real-life scenarios

• Scenario A: Launching the “Contacts” App

The worst case launch time is reduced by up to 44.8%↓

The total wait time by Dmeta and Ddiscard is reduced

by 96.1%↓ and 87.4%↓

Page 46: Boosting Quasi-Asynchronous I/O for Better Responsiveness in Mobile Devicescsl.skku.edu/papers/fast15-slides.pdf · 2015-06-09 · Boosting Quasi-Asynchronous I/O for Better Responsiveness

46/49

Real-life scenarios

• Scenario B: Burst Mode in the “Camera” App

The shot count is improved by up to 14.4%↑ The total wait time by Ddata is reduced by 98.4%↓

Page 47: Boosting Quasi-Asynchronous I/O for Better Responsiveness in Mobile Devicescsl.skku.edu/papers/fast15-slides.pdf · 2015-06-09 · Boosting Quasi-Asynchronous I/O for Better Responsiveness

47/49

Real-life scenarios

• Scenario C: Installing the “Angry Birds” App

The app install time is improved by up to 11.5%↓

Page 48: Boosting Quasi-Asynchronous I/O for Better Responsiveness in Mobile Devicescsl.skku.edu/papers/fast15-slides.pdf · 2015-06-09 · Boosting Quasi-Asynchronous I/O for Better Responsiveness

48/49

Android I/O benchmarks

12.0%↑ 17.1%↓ 10.2%↑

Page 49: Boosting Quasi-Asynchronous I/O for Better Responsiveness in Mobile Devicescsl.skku.edu/papers/fast15-slides.pdf · 2015-06-09 · Boosting Quasi-Asynchronous I/O for Better Responsiveness

49/49

Conclusions

• A new type of I/O, QASIO – Seemingly asynchronous, but has the synchronous property

– Types of dependency on QASIO

• Novel scheme to detect and boost QASIO – The worst case latency of a file system call, 98.4%↓

– The worst case “Contacts” app start time, 44.8%↓

• Future work – Analyze the impact of QASIO on other types of systems

– Devise another solutions optimized for each type of QASIO

Page 50: Boosting Quasi-Asynchronous I/O for Better Responsiveness in Mobile Devicescsl.skku.edu/papers/fast15-slides.pdf · 2015-06-09 · Boosting Quasi-Asynchronous I/O for Better Responsiveness

Q & A

Thank You

Daeho Jeong ([email protected])

Youngjae Lee ([email protected])

Jin-Soo Kim ([email protected])