22
CS162 Section Lecture 9

CS162 Section

  • Upload
    amandla

  • View
    58

  • Download
    0

Embed Size (px)

DESCRIPTION

CS162 Section. Lecture 9. Project 3. Client Side Program. Client Side Program. Client Side Program. KVClient (Library). KVClient (Library). KVClient (Library). KVMessage. KVMessage. Socket Server. What port will you listen on?. KVInterface. KVInterface. KVStore. - PowerPoint PPT Presentation

Citation preview

Page 1: CS162 Section

CS162 Section

Lecture 9

Page 2: CS162 Section

KeyValue Server

Project 3

KVClient (Library)

Client Side Program

KVClient (Library)

Client Side Program

KVClient (Library)

Client Side Program

Socket Server

NeworkHandler

KVIn

terf

ace

KVCache(LRU Cache)

KVIn

terf

ace

KVStore

KVMessage KVMessage

Available Threads

Job Queue

Thread Pool

What port will you listen on?

Asynchronous!

Write Through Cache!

Page 3: CS162 Section

“A distributed system is one in which the failure of a computer you didn't even know existed can render your own computer unusable” -- Leslie Lamport

Page 4: CS162 Section

What is Bandwidth?What is Latency?

Page 5: CS162 Section

• RTT of 100ms• Packet size of 1 KB• Initial handshake of 2 RTTs• Bandwidth is 1.5 Mbps

1 2

How long does it take to transfer a 1000 KB file.

Packet Transfer is continuous

Page 6: CS162 Section

• RTT of 100ms• Packet size of 1 KB• Initial handshake of 2 RTTs• Bandwidth is 1.5 Mbps

1 2

How long does it take to transfer a 1000 KB file.

Packet Transfer is one at a time

Page 7: CS162 Section

1 2

Transfer data at speed of light (3 x 108 m/s)

What is the RTT of the link?

385,000 km

Page 8: CS162 Section

How is a packet generated inside the Operating System?

1 2Router

Packet

Page 9: CS162 Section

User Space

Data

Kernel SpaceData

Device Space

Page 10: CS162 Section

• Time to process an interrupt, Tint = 1.5 ms

• CPU cycle time, TCPU = 10 ns

• Packet size, Npkt = 1000B (ignore headers)

• Time to copy or DMA one byte, Tcopy = 1 μs

• Latency of a link, Tlink = 3 ms • Bandwidth of links, B = 8Mbps

How many buffer copies are there to transmit a single packet?

1 2Router

Page 11: CS162 Section

• Time to process an interrupt, Tint = 1.5 ms

• CPU cycle time, TCPU = 10 ns

• Packet size, Npkt = 1000B (ignore headers)

• Time to copy or DMA one byte, Tcopy = 1 μs

• Latency of a link, Tlink = 3 ms • Bandwidth of links, B = 8Mbps

How many interrupts are generated to transmit a single packet?

1 2Router

Page 12: CS162 Section

• Time to process an interrupt, Tint = 1.5 ms

• CPU cycle time, TCPU = 10 ns

• Packet size, Npkt = 1000B (ignore headers)

• Time to copy or DMA one byte, Tcopy = 1 μs

• Latency of a link, Tlink = 3 ms • Bandwidth of links, B = 8Mbps

What is the time to reliably send a single packet from Node 1 to Node 2?

1 2Router

Page 13: CS162 Section

• Time to process an interrupt, Tint = 1.5 ms

• CPU cycle time, TCPU = 10 ns

• Packet size, Npkt = 1000B (ignore headers)

• Time to copy or DMA one byte, Tcopy = 1 μs

• Latency of a link, Tlink = 3 ms • Bandwidth of links, B = 8Mbps

What is the maximum rate possible between Node 1 to Node 2?

1 2Router

Page 14: CS162 Section

10101010011010111Physical Layer

Physical Layer 10101010011010111

Datalink Layer

Trans.Hdr.

Net.Hdr.

FrameHdr.

Datalink Layer

Trans.Hdr.

Net.Hdr.

FrameHdr.Data Data

Network Layer

Trans.Hdr.

Net.Hdr.

Network Layer

Trans.Hdr.

Net.Hdr.Data Data

Transport Layer

Trans.Hdr.

Transport Layer

Trans.Hdr.Data Data

DataApplication

Layer Application

Layer Data

Page 15: CS162 Section

TCP

• Connection Setup – 3 way handshake• Byte Stream Oriented (NOTE!)• Reliable data transfer• Flow control• Congestion control• Connection tear down (4 way)

Page 16: CS162 Section

TCP Connection Setup

Client (initiator) Server

SYN, SeqNum = x

ActiveOpen

PassiveOpen

connect() listen()

Page 17: CS162 Section

TCP Connection Setup

Client (initiator) Server

SYN, SeqNum = x

SYN and ACK, SeqNum = y and Ack = x + 1

ACK, Ack = y + 1

ActiveOpen

PassiveOpen

connect() listen()

accept()

allocatebuffer space

Page 18: CS162 Section

TCP Connection Teardown• 4-ways tear down connection

FIN

FIN ACK

FIN

FIN ACK

Host 1 Host 2

tim

eou

t

Avoid reincarnation Can retransmit FIN ACK if it is lost

closed

close

close

closed

data

Page 19: CS162 Section

Key Value Stores

• Very large scale storage systems• Two operations

– put(key, value)– value = get(key)

• Challenges– Fault Tolerance replication– Scalability serve get()’s in parallel; replicate/cache

hot tuples– Consistency quorum consensus to improve put()

performance

Page 20: CS162 Section

Key Value Stores

• Also called a Distributed Hash Table (DHT)• Main idea: partition set of key-values across

many machines key, value

Page 21: CS162 Section

Chord Lookup • Each node maintains

pointer to its successor

• Route packet (Key, Value) to the node responsible for ID using successor pointers

• E.g., node=4 lookups for node responsible for Key=37

4

20

3235

8

15

44

58

lookup(37)

node=44 is responsible for Key=37

Page 22: CS162 Section

Chord

• Highly scalable distributed lookup protocol• Each node needs to know about O(log(M)),

where M is the total number of nodes• Guarantees that a tuple is found in O(log(M))

steps• Highly resilient: works with high probability

even if half of nodes fail