views:

142

answers:

2

During undergrad i opted to take a network programming course using the POSIX sockets for linux. As a reference we used the book Internetworking using TCP/IP (comer and stevens). 2008 its a pretty dated and still applicatable texts which takes one through several server designs.

One design that is not really featured in the book is the case there a client connects to the backend application server sends multiple requests to the server over a single TCP connection. Since multiple requests comes via the slave socket to the server and responses send via the same slave socket. The slave socket is becomes congested as response and requests are received via the same socket, would it be a better option to allow for a second TCP connection between the to end-points to allow full duplex communication speed? What other architectures can be used to improve server performance?

+2  A: 

Since a socket is simply a number attached to a packet (call it a routing number or address), I can't imagine the socket itself getting congested.

Your code handling the socket could, but that should be pretty easily fixed by distributing packets as they arrive.

You could also code incoming and outgoing packet processing to happen on different threads, or even queue packets for distribution to many threads.

But I really don't see the original supposition as being completely accurate. I could be wrong...

Bill K
+1  A: 

TCP connections are already full-duplex. You could (simplifying things) think of a TCP connection as a pair of unidirectional connections (one sending and one receiving).

Sending multiple requests via a single connection is actually used to increase performance in several protocols (since resusing a connection avoids the handshake and slow-start overheads). One example would be HTTP keep-alive connections. Another way to increase performance is to use pipelining (sending several requests without waiting for the responses), which obviously can only be done if you are reusing the TCP connection for multiple requests.

CesarB