Download - Stream Control Transmission Protocol
Stream Control Transmission Protocol
Special thanks to Dr. Paul Amer
Presented by – Viren Mahajan
[email protected] 20, 2007
What we have discussed !
• Motivation• PDU and Chunk format• The ‘a’ word - ASSOCIATION• Association setup & termination• Multihoming
Outline of today’s talk !
• Multistreaming• Framing• Chunk Bundling• Data Transfer• Fragmentation/Reassembly
Multistreaming
file transfer
video
voice
textShall we talk SCTP?
Yahoo! Instant Messenger
TCPmultiple
connections
physical
data link
IP
transportTCP
buffersTCP
buffers
filetransfer text voice video
filetransfer text voice video
sender receiver
4 independent connections
SCTPmultistreaming
physicaldata link
IP
transport streambuffers
streambuffers
1 association w/4 streams
filetransfer text voice video
filetransfer text voice video
sender receiver
Init chunk
Type: 1 Flag: 0 Length
Initiation Tag
Outbound Streams Maximum inbound streams
Optional/Variable length parameters
Advertised receiver window credit
Initial TSN
Init ack chunk
Type: 2 Flag: 0 Length
Initiation Tag
Outbound Streams Maximum inbound streams
Optional/Variable length parameters
Advertised receiver window credit
Initial TSN
Parameter Type: 7 Parameter Length
State Cookie
Multistreaming (cont)
• TCP: 1 stream of data per connection • SCTP: 1 or more streams of data per
association• # of streams negotiated during association
establishment• SCTP partial ordering: ordered delivery
within each stream
delivered to application
Data transfer using TCP
retransmission
receive buffer
Web serverWeb client
loss
sent from application
objects in send buffer
HOL blocking!
persistent, pipelinedTCP connection
stream 1
stream 2
stream 3
delivered to application
The multistreaming advantage
retransmission
receive buffer
Web server Web clientSCTP association
loss
objects in send buffer
sent from application
Streams
• Streams by definition are ordered
• Unordered data may be sent in a stream (U bit = 1)
• Sequence number is ignored for U = 1
• Unordered messages should be processed first
• Unordered messages may be used for “out-of-band” signaling, as in telnet.
Application work-around to mitigate HOL blocking
• How?– Multiple persistent TCP connections to transfer
independent web objects
• Problems– Aggressive (not TCP friendly)– Possible HOL blocking within one TCP connection– No shared sequence space => Less robust to loss
detection and recovery– Increased load on web server– Increased connection establishment latency during SYN
losses
Message Boundaries
TCP does not preserve message boundaries
Web serverWeb client
TCP connection
Message 3
Message 2
Message 1
bytes 1 - 100
bytes 101 - 200
bytes 201 - 300
bytes 1 – 75
bytes 176 – 230
bytes 231 – 300
bytes 76 – 175
SCTP preserves message boundaries
Web serverWeb client
SCTP association
Message 3
Message 2
Message 1
Message 1
Message 2
Message 3
bytes 1 - 100
bytes 101 - 200
bytes 201 - 300
bytes 1 - 100
bytes 201 - 300
bytes 101 - 200
Message Boundaries
• UDP honors message boundaries– Each app message becomes a datagram
• TCP does not honor message boundaries– App messages become part of a byte stream
• SCTP maintains message boundaries– Each app message is maintained as one or more data chunks– Data flags manage message boundaries
• Simpler coding of applications– no need to do buffering, framing
• Example - DNS– Response size <= 512, UDP is used– If response size > 512, TCP is used
• Application must preface the header with message length
Chunk Bundling
Without bundling
end pt A end pt B
SCTP association
SCTP-PDUs SCTP-PDUs
Application
Application
A-PDUs A-PDUs
SCTP Association
With bundling
end pt A end pt B
SCTP association
SCTP-PDUs SCTP-PDUs
Application
Application
SCTP Association
A-PDUs A-PDUs
Bundling of Chunks in SCTP
• Control chunks bundled before data chunks• Chunk boundary cannot cross SCTP PDU boundary
Source Port Destination Port
Verification Tag
Checksum
Chunk 1
…
Chunk N
Common Header
Bundling
SCTP PDU
Chunk Bundling
• Multiple chunks in one SCTP PDU
• Gain in n/w bandwidth efficiency – reduces ovhd of additional sctp and IP headers
• Path MTU is the constraint
• Control Chunks are always placed first
• Chunk boundaries do not cross SCTP PDU boundaries
• These chunks cannot be bundled– init, init ack, shutdown complete
Data Transfer
SCTP Chunk Format
Type Flags Length
Chunk Data
•Type – Data, Init, SACK, …
• Flags – bit meanings depend on type
• Length – includes type, flags, length, and data/parameters
Data Chunk
Flags = UBE
Data
User supplied Payload Protocol Identifier
Stream Seq Num (SSN)Stream Identifier (SID)
Transmission Sequence Number (TSN)
LengthType = 0x00
0 31
used for ordering, reassembly and retransmission
used for ordering within a stream
identifies the stream to which the data chunk
belongs
used by the application and network monitoring
equipment to understand the type of data being
transmitted
SACK Chunk
Type = 0x03 Flags (none) Length (variable)
Cumulative TSN ack
Advertised receiver window
Number of Gap ACK blocks = N Number of duplicates = X
Gap ACK blk #1 start TSN offset Gap ACK blk #1 end TSN offset
...
Gap ACK blk #N start TSN offset Gap ACK blk #N end TSN offset
Duplicate TSN 1
…
Duplicate TSN X
highest cumulative TSN
no. of Duplicate TSN reports
includednumber of Gap
Ack Blocks included
end offset for a range of
consecutive TSNs received
start offset for a range of consecutive
TSNs received
TSN received more than
once
Data transferTSN: 1
SID: 1 SSN: 1
TSN: 2SID: 2 SSN: 1
TSN: 3SID: 1 SSN: 2
TSN: 4SID: 2 SSN: 2
ACK 4
TSN: 1
SID: 1 SSN: 1
ACK 1
end A
end B
Data transfer
end A
end BTSN: 12
SID: 1 SSN: 2
ACK 12a_rwnd
TSN: 13SID: 2 SSN: 2TSN: 14SID: 1 SSN: 3
TSN: 15SID: 2 SSN: 3 ACK 12
a_rwnd
#Gaps: 1 #Dup: 0
Gap1_start: 2 Gap1_end: 3TSN: 13SID: 1 SSN: 4
TSN: 16SID: 2 SSN: 4
TSN: 17SID: 1 SSN: 5
ACK 12a_rwnd
#Gaps: 2 #Dup: 0
Gap1_start: 2 Gap1_end: 3
Gap2_start: 5 Gap2_end: 5
TSN: 10SID: 1 SSN: 1
TSN: 11SID: 2 SSN: 1
Fragmentation / Reassembly
SCTP fragmentation/reassembly
Web serverWeb client
SCTP association
A-PDU
SCTP-PDUs SCTP-PDUs
A-PDU
Data Chunk
Reserved U B E
Data
User supplied Payload Protocol Identifier
Stream Seq Num (SSN)Stream Identifier (SID)
Transmission Sequence Number (TSN)
LengthType = 0x00
0 31
Fragmentation/Reassembly Flags
U B E Description
* 1 0 (Begin) First Piece of fragmented A-PDU
* 0 0 Middle piece of fragmented A-PDU
* 0 1 (End) Last piece of fragmented A-PDU
* 1 1 Non-fragmented A-PDU
*U set to 1 specifies unordered message
Note: Fragmentation requires sequential TSNs
A fragmentation example
A-PDU
second fragment
E.g. app A-PDU for Stream 2 exceeds Path-MTU
last fragment
First data fragmentSSN=1SID=2TSN=6U=0, B=1,
E=0
Part of Data Chunk Header
U=0, B=0, E=0
TSN=7 SID=2 SSN=1
U=0, B=0, E=1
TSN=8 SID=2 SSN=1
SCTP - User Data Fragmentation
• Large A-PDU fragmented into DATA chunks
• To avoid intermediate routers having to deal with fragmentation
• Constrained by path MTU
• Unique TSN assigned to each DATA chunk
• Same SSN assigned to each DATA chunk
• B/E (Begin/End) bits identify fragments of user message
• U flag same as that in the original message
Re-Assembly of Fragments
• Receiver checks B/E flags of DATA chunk
• User message reassembled using SSN, SID, B/E bits of DATA chunks.
• Number of fragments determined by the TSN of the first and the last fragments
TSN
5TSN6²
TSN2
TSN4
TSN3
TSN5
TSN6²
TSN2
TSN3
TSN4
TSN1¹
TSN1¹
TSN6²
TSN5
TSN4
TSN3
TSN2
TSN1¹
A Large Message Transfer
A2
A1
B2
B1
receive buffer (6)
delivered to application
TSN1¹
TSN3
TSN2
sent from application
TSN4
TSN5
TSN6²
data
data
data to be sent
1 - B bit set to 12 - E bit set to 1
Path MTU = 512 octets
(2760 octets)
Summary
• Multistreaming– multiple streams avoid HOL blocking
• Framing– message boundaries are preserved
• Chunk Bundling– better bandwidth usage
• Data Transfer– data chunks
• Fragmentation/Reassembly– B/E bits in data chunk
THANKS !
SCTP Vocabulary
• Association
• Chunk
• PMTU – Path Maximum Transfer Unit
• SSN – Stream Sequence Number
• SID – Stream identifier
• TSN - Transmission Sequence Number
• TCB – Transmission Control Block