sctp介绍

转自:http://www.csm.ornl.gov/~dunigan/net100/sctp.html
 Stream Control Transmission Protocol ( SCTP)

"Faster than a speeding bullet. More powerful than a locomotive. Able to leap tall buildings in a single bound---Look! Up in the sky"???
NO...It's not a bird or a plane or Superman---Look out on the Net--it's SCTP! Stream Control Transmission Protocol is being hyped asone of the Top 10 Hottest Technologies of 2001 by TelecommunicationsMagazine. According to a marketing blurb accompanying the book,
Stream Control Transmission Protocol (SCTP):A Reference Guide byRandall R. Stewart and Qiaobing Xie,
   " SCTP is considered by many tobe the TCP of the future....more robust and secure...the technology ofchoice
    for building next-generation commercial grade infrastructuresfor telecommunications and e-commerce."

To understand this new protocol, it is important to know the lineage of SCTP. The protocol was directly motivated by the need to transport telecommunication signalingmessages over an IP-based network. The signaling system SS7 hasbeen the dominant bearer of control information in telecommunicationnetworks where high performance and reliability are critical toexisting services and applications. However,the SS7 signaling network is logically a separate network which requires dedicated network infrastructure and only shares some physicalresources with regular user traffic. The IETF working group, 'Signalling Transport (SIGTRAN)' is proposing a different approach for the transport ofsignaling messages: Stream Control Transmission Protocol. Stream Control Transmission Protocol is primarily defined within rfc2960 as a new IP transport protocol existing at the same level as UDP and TCP.In this approach, signaling messages are exchanged over a commonpacket-switched (IP-based) network instead of a logically separatenetwork but, it is instructive to note, this new protocol has beenshaped largely by the fact that telephony signaling has rigid timing and reliability requirements often prescribed by government regulations.

Time to look under the hood!We'll address the questions:

  1. What are the core features of SCTP ?
  2. What does SCTP do the same as TCP ?
  3. What does it do differently?
  4. Which applications will benefit most from using SCTP ?
  5. Which applications would benefit little to none?
We'll also look at two implementations--a kernel implementation requiring kernel patches and a user-spaceimplementation using UDP and raw sockets.

SCTP Core Features.
The primary distinguishing features of this new protocol are "multi-homing" and "multi-streaming". A connection between 2 endpoints in this context is called an "association".
Multi-homing is defined as the ability of an association to supportmultiple IP addresses or interfaces at a given end point. In itscurrent form SCTP does not do load-sharing. The benefit of multi-homingis potentially greater survivability of the session in case of networkfailures. Use of more than one address could allow re-routing of packets in event of failure and also provide an alternate path for retransmissions. Endpoints can exchange lists of addresses during initiation of theassociation. One address is designated as the primary address to receivedata. A single port number is used across the entire addresslist at an endpoint for a specific session. Heartbeat chunks are usedto monitor availibility of alternate paths with thresholds set todetermine failure of alternate and primary paths.
Multi-streaming does not refer to multiple streams in the TCPsense but rather each stream represents a sequence of messages withina single association--thesemay be short or long messages which include flags for control ofsegmentation and reassembly. Stream Identifiers and Stream Sequencenumbers are included in the data packet to allow sequencing of messages on a per-stream basis. This can mean thatthere would be no unnecessary head-of-line blockingbetween independent streams of messages in case of loss in one stream.SCTP also provides a mechanism for designating order-of-arrival delivery as opposed to ordered delivery.

Comparisons to TCP.
Like TCP, SCTP:

  • uses a checksum and sequence number(Transmission Sequence Number)
  • is connection oriented
  • implements tcp-like mechanisms of:
    • reliable transmission
    • ordered delivery
    • flow and congestion control follow TCP algorithms
    • slowstart
    • fast recovery
    • fast retransmit--upon receiving 4 consecutive SACKs
    • delayed acks
    • SACK
    • ssthresh, RTO, CWND, etc.
Unlike TCP, SCTP:
  • uses a 32 bit checksum as opposed to a 16 bit checksum
  • can have several streams within an association
  • defines a stream as a sequence of messages(chunks)--not bytes--there are presently 13 chunk types defined
  • a packet includes a common header plus one or more chunks whichcan be control or data
  • uses 4 messages in setting up an association anddata may be sent with 3 & 4
  • uses 3 messages for shutdown--there are no half-open connections
  • can use multi-homed endpoints for redundancy
  • employs a signed cookie mechanism specifically to guard againstSYN flooding
  • uses a Verification Tag as a protection against blindmasquerade attacks and stale packets from a previous association
  • supports in-order and order-of-arrival delivery on a perdatagram basis
  • IP multicast and broadcast are NOT supported
  • Sack messages may carry a larger number of SACK blocks thanTCP's 3 or 4
Compare the TCP state machine with the SCTP state machine.

SCTP applications.
Applications would benefit most that:

  • have sufficient traffic levels to justify the overhead ofassociation establishment and congestion and flow control measures
  • require framing of reliable data streams
  • transfer multiple independent message sequences that are unrelated
  • need to transfer messages that do not need to be delivered in sequence
  • require network layer redundancy
The transport of Public Switched Telephone Network signaling protocols or loading of web pages are examples of applications that might benefit.

Applications would benefit little that:

  • generate small amounts of unrelated transactions toward a destination
  • require strict ordering of all data
  • are oriented toward byte-stream transfer as opposed to message transfer
  • do not require network-level redundancy or run on machines withonly one network interface card
File transfer is an example of an application is oriented toward byte-streamtransfer and, therefore, would derive little or no benefit from framing or multi-stream capabilities. E-mail generates smallamounts of unrelated transactions toward a destination.

Implementations
  A. The SCTP library being developed by the Computer Networking Group at the University of Essen (Germany) and Siemens AG (Germany).
SCTP for Beginners by Andreas Jungmaier isa very good place to start to understand SCTP. The online tutorialis well documented giving the important information and links relatingto SCTP. Thank you Andreas!
This user-space implementation is multifaceted and consists of:

  • server/clientprograms that must be run as root since they rely on raw sockets tobe able to send and receive SCTP packets.
  • a SCTP daemon that will receive packets from clients on thesame host over UDP sockets and then push them out a raw socket as SCTPpackets to a SCTP daemon on another host. After receiving the SCTPpacket, the second daemon will then send them to the correct clientvia UDP sockets. This means the clients do not have to run as root--only the daemons.
  • a socket library written in C++ with several examples of programs using the socket API library.
There are two kinds of events that SCTP reacts to:
  - network read events
  - timer events
A typical ULP (User Level Program) main function would:
  - set up the callback procedures
  - read and check command line arguments and initialize variables
  - call sctp_initLibrary() to open raw sockets for capturing SCTPpackets from the network and initialize the timer list. This needs tobe called before any other sctp library functions!
  - call sctp_registerInstance() to initialize one SCTP instance
  - call sctp_associate() to set up the association. This triggerssending an INIT chunk to a server/peer and when the association getsestablished, the CommunicationUp-callback function is executed.
  - run the event handler in a while(1) loop
The application will react to a previously scheduled timer or anyfile descriptor event by executing the appropriate registered callbackfunction.
The "main" function of User Level Programs will need to contain similar elements with the differences between programs being primarilywhat happens in the callback functions.

We wrote an application modeled on the well-known ttcp but using theSCTP library client/server model and raw sockets. Since we are interested in optimizing bulk transfers in high delay/bandwidth networks, we wanted to see how well the implementation performed. Bearing in mind that this is not a kernel implementation so would not be expected to be as optimized for speed andthat file transfer has been identified above as an applicationthat would benefit little or none from SCTP's features, we did not findSCTP performed well for bulk transfers.

  B. The Linux kernel implementation being developed by La Monte Yarroll (Motorola) and others.
This is still in the development stage and, while we wouldexpect a better performance from a kernel implementation, given the needs of bulk transfer and the key features of SCTP, we do not expectthis will provide a great performance improvement over TCP.Since SCTP is block-oriented and not byte-oriented, it should bemuch easier to do OS-bypass and get better performance.   

你可能感兴趣的:(sctp介绍)