rethink the sync

22
Rethink the Sync Ed Nightingale Kaushik Veeraraghavan Peter Chen Jason Flinn University of Michigan

Upload: kasimir-key

Post on 02-Jan-2016

25 views

Category:

Documents


0 download

DESCRIPTION

Rethink the Sync. Ed Nightingale Kaushik Veeraraghavan Peter Chen Jason Flinn University of Michigan. Problem. Asynchronous I/O is a poor abstraction for: Reliability Ordering Durability Ease of programming Synchronous I/O is superior but 100x slower - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Rethink the Sync

Rethink the Sync

Ed Nightingale Kaushik VeeraraghavanPeter ChenJason Flinn

University of Michigan

Page 2: Rethink the Sync

Rethink the Sync

University of Michigan 2

Problem

Asynchronous I/O is a poor abstraction for: Reliability Ordering Durability Ease of programming

Synchronous I/O is superior but 100x slower Caller blocked until operation is complete

Page 3: Rethink the Sync

Rethink the Sync

University of Michigan 3

Solution

Synchronous I/O can be fast

New model for synchronous I/O External synchrony Same guarantees as synchronous I/O Only 8% slower than asynchronous I/O

Page 4: Rethink the Sync

Rethink the Sync

University of Michigan 4

When a sync() is really async On sync() data written only to volatile

cache 10x performance penalty and data NOT safe

VolatileCacheOperating

SystemCylinders

Disk

100x slower than asynchronous I/O if disable cache

Page 5: Rethink the Sync

Rethink the Sync

University of Michigan 5

To whom are guarantees provided? Synchronous I/O definition:

Caller blocked until operation completes

Disk Screen

App App

Guarantee provided to application

App

Network

OS Kernel

Page 6: Rethink the Sync

Rethink the Sync

University of Michigan 6

To whom are guarantees provided?

Guarantee really provided to the user

OS KernelDisk Screen

App App App

Network

Page 7: Rethink the Sync

Rethink the Sync

University of Michigan 7

Providing the user a guarantee User observes operation has completed

User may examine screen, network, disk…

Guarantee provided by synchronous I/O Data durable when operation observed to

complete

To observe output it must be externally visible Visible on external device

Page 8: Rethink the Sync

Rethink the Sync

University of Michigan 8

Network

Why do applications block?

Since application external we block on syscall

Internal

External

External

OS KernelDisk Scree

n

App App

Application is internal therefore no need to block

App

Page 9: Rethink the Sync

Rethink the Sync

University of Michigan 9

A new model of synchronous I/O

Provide guarantee directly to user Rather than via application

Called externally synchronous I/O Indistinguishable from traditional sync I/O Approaches speed of asynchronous I/O

Page 10: Rethink the Sync

Rethink the Sync

University of Michigan 10

Example: Synchronous I/O

OS Kernel DiskProcess

101 write(buf_1);

102 write(buf_2);

103 print(“work done”);

104 foo();

Application blocksApplication blocks

%work done%

TEXT

%

Page 11: Rethink the Sync

Rethink the Sync

University of Michigan 11

Observing synchronous I/O

101 write(buf_1);

102 write(buf_2);

103 print(“work done”);

104 foo();

Sync I/O externalizes output based on causal ordering Enforces causal ordering by blocking an application

Ext sync: Same causal ordering without blocking applications

Depends on 1st write

Depends on 1st & 2nd write

Page 12: Rethink the Sync

Rethink the Sync

University of Michigan 12

Example: External synchrony

OS Kernel DiskProcess

101 write(buf_1);

102 write(buf_2);

103 print(“work done”);

104 foo();

TEXT

%work done%

%

Page 13: Rethink the Sync

Rethink the Sync

University of Michigan 13

Tracking causal dependencies Applications may communicate via IPC

Socket, pipe, fifo etc.

Need to propagate dependencies through IPC

We build upon Speculator [SOSP ’05] Track and propagate causal dependencies Buffer output to screen and network

Page 14: Rethink the Sync

Rethink the Sync

University of Michigan 14

Tracking causal dependencies

DiskProcess 1

101 write(file1);

102 do_something();

%hello%%

101 print (“hello”);

102 read(file1);

103 print(“world”);

Process 1 Process 2

Process 2

Commit Dep 1

Process 1

OS Kernel

Process 2TEXTTEXT world

Page 15: Rethink the Sync

Rethink the Sync

University of Michigan 15

Output triggered commits

OS Kernel DiskProcess

%work done%

TEXT

%

Maximize throughput until output buffered

When output buffered, trigger commit Minimize latency only when important

Page 16: Rethink the Sync

Rethink the Sync

University of Michigan 16

Evaluation

Implemented ext sync file system Xsyncfs Based on the ext3 file system Use journaling to preserve order of writes Use write barriers to flush volatile cache

Compare Xsyncfs to 3 other file systems Default asynchronous ext3 Default synchronous ext3 Synchronous ext3 with write barriers

Page 17: Rethink the Sync

Rethink the Sync

University of Michigan 17

When is data safe?

File SystemConfiguration

Data durable on write()

Data durable on fsync()

Asynchronous NoNot on

power failure

SynchronousNot on

power failureNot on

power failure

Synchronousw/ write barriers

Yes Yes

External synchrony

Yes Yes

Page 18: Rethink the Sync

Rethink the Sync

University of Michigan 18

Postmark benchmark

Xsyncfs within 7% of ext3 mounted asynchronously

1

10

100

1000

10000

Tim

e (S

eco

nd

s)

ext3-asyncxsyncfsext3-syncext3-barrier

Page 19: Rethink the Sync

Rethink the Sync

University of Michigan 19

The MySQL benchmark

Xsyncfs can group commit from a single client

0500100015002000250030003500400045005000

0 5 10 15 20

Number of db clients

New

Ord

er T

ran

sact

ion

s P

er M

inu

te

xsyncfsext3-barrier

Page 20: Rethink the Sync

Rethink the Sync

University of Michigan 20

Specweb99 throughput

Xsyncfs within 8% of ext3 mounted asynchronously

0

50

100

150

200

250

300

350

400

Th

rou

gh

pu

t (K

b/s

)

ext3-async

xsyncfs

ext3-sync

ext3-barrier

Page 21: Rethink the Sync

Rethink the Sync

University of Michigan 21

Specweb99 latencyRequest

sizeext3-async xsyncfs

0-1 KB 0.064 seconds 0.097 seconds

1-10 KB 0.150 second 0.180 seconds

10-100 KB 1.084 seconds 1.094 seconds

100-1000 KB 10.253 seconds10.072 seconds

Xsyncfs adds no more than 33 ms of delay

Page 22: Rethink the Sync

Rethink the Sync

University of Michigan 22

Conclusion

Synchronous I/O can be fast

External synchrony performs with 8% of async

Questions?