It seems absent from the BSDs, but on Linux you can pass the MSG_MORE flag to send() to override TCP_NODELAY for a specific write
On Wed, 15 May 2024, at 19:40, Job Snijders via Bird-users wrote: > Dear Marco, > > On Wed, 15 May 2024 at 19:27, Marco d'Itri <m...@linux.it> wrote: >> On May 15, Job Snijders via Bird-users <bird-users@network.cz> wrote: >> >> > But please be very careful in considering this patch, because it does >> > introduce some subtle changes in the on-the-wire behaviour of BIRD. For >> > example, without this patch an UPDATE for a handful of routes and the >> > End-of-RIB marker might end up in the same TCP packet (if this fits); >> > but with this patch, the End-of-RIB marker ends up in its own TCP >> > packet. As things are today, setting TCP_NODELAY will increase the > >> >> I think that this can be fixed easily with TCP_CORK. >> Basically, with TCP_NODELAY + TCP_CORK you can have the optimal balance >> of latency and overhead without using writev. > > > Yes, thanks for sharing this suggestion. > > Note that TCP_CORK is a Linux-only feature (on FreeBSD it seems aliased to > TCP_NOPUSH, but I might be misunderstanding that code). There are subtle > differences between NOPUSH and CORK: resetting CORK triggers a flush, whereas > resetting NOPUSH does not. > > It is of course reasonable to optimize one platform and not others, we work > with the tools that we have - but a portable approach (using writev()?) would > seem attractive to me :-) > > Kind regards, > > Job >>