sahlberg / libnfs

NFS client library
Other
532 stars 203 forks source link

Have we tested TCP_NODELAY option with RPC connections? #481

Closed linuxsmiths closed 3 months ago

linuxsmiths commented 4 months ago

With limited testing I've found that turning nagle off on RPC connections seem to help the throughput in some cases (tried with read). @sahlberg, have you explored/tested that in the past? If not, I would suggest we enable it after decent validation testing.

sahlberg commented 4 months ago

I haven't tested it. I didn't expect the lack of TCP_NODELAY would have much effect unless on a mostly idle connection but.

Libnfs already collects all the data that needs to be sent into an iovector and sends it all out in a single writev() call so TCP_NODELAY should be fine.

There are some embedded platforms that don't have writev() and instead emulate it by a loop of write() commands. Those platforms would hurt a little due to the extra cpu utilization due to the many more segments that would need to send. Those platforms are not really high-performance anyway so it should be fine.

I don't thing we need an api to enable/disable TCP_NODELAY so we can just set it unconditionally. Some platforms don't have TCP_NODELAY so please add the code to set it inside a

ifdef TCP_NODELAY block.

sahlberg commented 3 months ago

As there are no drawbacks for using TCP_NODELAY in libnfs I have pushed a change to master that sets it unconditionally every time a tcp socket is created.