[nanomsg] scatter gather of send/recv ?

  • From: "Garrett D'Amore" <garrett@xxxxxxxxxx>
  • To: "nanomsg@xxxxxxxxxxxxx" <nanomsg@xxxxxxxxxxxxx>
  • Date: Mon, 23 Jan 2017 11:08:39 -0800

As I’m working on nng, I realize that I’ve neglected to really expose a
scatter/gather facility (iovs) in the public API (I do use them under the
hood for separating message headers.)

I could fix this, but doing so “performantly” (without data copying) may be
somewhat complex.

I’d like to avoid that complexity if possible.

So I’d like to get a sense as to how often folks use scatter (send) or
gather (recv)?  How big are the message sizes?  Would copying be untenable
in this situation?  (Note that for small sizes, copying is quite fast, and
so I wouldn’t worry for messages that are under a couple of KB.  For larger
messages it starts to make a lot more difference.)

(Note also that for some case we *have* to do data copies because of the
internals of nng’s architecture.  Any time the user supplies a buffer of
his own instead of letting nng allocate the buffer, for example, we have to
copy on send, since the buffer may be modified by the user after send()
returns.)

Anyway, insights into how folks are using (or not using) scatter/gather
would be helpful to me.
(Personally, I’ve never found any use for gather ever, and only limited use
for scatter in protocol stacks where I have to prepend headers coming from
applications not under my own control.)

 - Garrett

Other related posts: