A Tor exit node communicating with a high volume web server may be sending streams from multiple Tor clients to that web server at the same time. If the clients used the Tor browser there should be no identifying data sent to the web server. The exit node keeps state for each client and its Tor path. When the web server sends its response, how will he Tor exit node recognize which stream the response belongs to? More specifically, what piece of data in the response will allow the Tor exit node to identify the appropriate Tor path and client?
How does the exit node recognize which response from a server is tied to which request?
The Tor software maintains status information about the circuits. So this means if Alice and Bob are connecting to the same webpage via the same exit relay, Tor sends the correct data back to Alice and Bob. Tor on the other side uses TCP to communicate with the web site. The Tor exit relay opens a port on the local machine (e.g. port 34567) and connects to the port where the webserver lives (usually port 80 or 443). When they're connected Tor asks for the webpage and the webserver transmits the content to port 34567. As Tor has two separate circuits for Alice and Bob, it will also open two distinct ports where it sends and receives data. Thatswhy the data from Alice and Bob would never mix up.
Actually, the answer is much simple: Tor exit node is using a TCP connections for making outbound requests, and each request is tunneled through it's own connection. So even if everything is identical, i.e. many clients are came from the very same node chain, e.t.c. - they will be a different circuits for an Exit node and will have a different TCP "waterpipes" for their tasks. It's like a water at your kitchen : hot and cold are going one-to-another, but in a separate pipes, so they're not mixed up in transit.
Hi Alexey - this is really just the same as Jens' answer, isn't it? May 12, 2016 at 19:19
Hi Richard! It's not : Jens' answer lacks the mentioning that TCP connections made by exit node are the only factor separating the requests/sessions/users. And - strictly speaking - it's related to TCP protocol itself internals rather than Tor's behaviour. That's what I've tried to focus in my answer.– Alexey Vesnin ♦May 12, 2016 at 19:24