Forum Discussion
Difference of connection, session and stream
Hello All, Could you please help me to know what is the difference of connection, session and stream?
Regards, Thiyagu
- Kevin_Stewart
Employee
There are definitely multiple definitions for each, but I'll try to cover in terms of iRules and the F5 data plane.
-
A "connection" is usually associated with a TCP connection, which is generally derived from a unique combination of client and server IP addresses and ports and initiated by a 3-way handshake. TCP lives at OSI layer 4, and is where the CLIENT_ACCEPTED, CLIENT_DATA, SERVER_CONNECTED and SERVER_DATA events get triggered. iRule variables are also typically held in context to a TCP connection. Yes, UDP is also in this area, but we're talking about connections.
-
A "session" is usually associated with OSI layers 5 and 6. Sessions are more generally more complex than connections and are associated with things like SSL, where clients and servers have more information to store about each other. The CLIENTSSL and SERVERSSL events are triggered in this space. A session can also be associated with an application session (at layer 7), where the client and server maintain some form of persistent information between them. An HTTP transaction that uses cookies to maintain application state (ex. a shopping cart) is an example of an application session.
-
A "stream" has even more definitions, but in this context is kind of the opposite of a regular (TCP) connection, where clients and servers need to get lots of data to each other (in streams) without worrying about failures and retransmissions. UDP, and RTSP (for streaming video) are generally considered streaming protocols.
-
And not to confuse the matter, but in iRules, a stream profile is a regex/sed-like text replacement function.
If you think about these in terms of the OSI model, a connection is the thing that establishes connectivity between a client and server (a TCP 3-way handshake). A session is something that rides on top of that connection, either at layers 5/6 (SSL) or layer 7 (HTTP with cookies) and persists across TCP connections. A stream is typically something that doesn't rely on persistence or connections.
-
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com