wlformyd
wlformyd

Reputation: 237

Multiple TCP streams interfere with each other

I have a client that connects to an NFS server and writes data. It is a multiprocess application that creates as many TCP connections as there are processes. The problem is that if I try one process, the socket blocks on write very little (that is poll() does not pause). If I increase the number of processes to 8 or more, I find myself being blocked by poll() on each socket about 30% of the time. Isn't the purpose of using multiple TCP streams having independent send/receive buffers and so they should not block like this? Why is having multiple streams interfering with each other? The link is far from saturation (as tested with iperf).

My thoughts on this are that the NFS server will create a socket per TCP connection, and they will have their own receive buffers. I know I'm making separate TCP sockets for each process, so they should have their own send buffers. If I'm not saturating the link, why are the sockets blocking?

Upvotes: 0

Views: 1036

Answers (1)

user207421
user207421

Reputation: 310990

You're assuming that the network has infinite bandwidth, and that the server has infinite capacity to service the requests you're sending. It doesn't, in either case. Increasing the number of TCP connections linearly doesn't increase performance linearly. There is only one network; only one server; it only has so many CPUs; and it only has so many disks. Sooner or later the network will fill, or the server will bog down, which will get reflected back to you as a write stall.

Upvotes: 2

Related Questions