Abhishek Jain
Abhishek Jain

Reputation: 10582

Full duplex socket vs. two sockets used, one for read and other for write

I was wondering,

1st question What are the pros and cons of using one socket (full duplex) vs. two socket (simplex) per peer: one for read and other write? Specially in terms of performance and resource utilization.

2nd question In case, if i choose to use more than 1 sockets per peer, on all i do read and write. Then will it helps me scale out in handling no of messages handled?

3rd question: what should help me determine the number of sockets per peer? Network Bandwidth? No. of message in and out?

All questions are different and do not have any inter-relation.

Upvotes: 5

Views: 4149

Answers (2)

rjmcmahon
rjmcmahon

Reputation: 324

We've added --full-duplex to iperf 2.0.14 which will test a full-duplex socket. One can dompare it to two sockets per the -d or --dualtest option. We've found "your mileage will vary" and there is no universal to answer of having equal performance or not. In theory, it seems they should be equal but, in practice, maybe not.

   -d, --dualtest
          Do a bidirectional test simultanous test using two unidirectional sockets

       --fq-rate n[kmgKMG]
          Set a rate to be used with fair-queueing based socket-level pacing, in bytes or bits per second. Only available on  platforms  supporting  the  SO_MAX_PACING_RATE  socket  option.
          (Note: Here the suffixes indicate bytes/sec or bits/sec per use of uppercase or lowercase, respectively)

       --full-duplex
          run a full duplex test, i.e. traffic in both transmit and receive directions using the same socket

Bob

Upvotes: 2

user207421
user207421

Reputation: 310979

What are the pros and cons of using one socket (full duplex) vs. two socket one for read and other write? Specially in terms of performance and resource utilization.

Pro one socket: resource utilization. Contra one socket: nil. Performance: identical, except that you save on connect and close handshakes if you only use one socket.

In case, I choose to take two socket approach, then will not be useful to use both of them full duplex, that way it helps me scale out in terms of data flowing in and out?

Now you're comparing apples and oranges. You can't compare one full-duplex socket with two full-duplex sockets. I don't know why you think you might need two inbound and two outbound flows, but you don't. Every protocol I can think of except FTP uses only one.

what impact does network bandwidth has on it?

Nil.

or it has on network utilization?

Nil, apart from the connect and close handshakes. But it wastes resources at both ends.

Upvotes: 5

Related Questions