Hi all,
I'm planning to migrate a Majordomo like broker from ROUTER/DEALER sockets,
to the threadsafe CLIENT/SERVER ones. Right now the protocol uses multipart
messages (similar to zmq rfc 7) where the broker only pops off the first 2
frames of the message (identity, routing_info), and routes the message
(passes back to libzmq) without ever touching the payload frames.

As I understand threadsafe sockets don't support multipart messages. The
routing_info part of the message has variable size and usually it grows as
a message is passed on. I don't want to reallocate/copy the whole message
to accommodate for a larger routing_info, that would hurt performance. Is
there a common practice to solve this a problem?

I have 2 things in mind:
- Use a fixed buffer size for routing_info that's large enough to hold all
possible sizes. Unfortunately some fields of the routing_info are user
defined with arbitrary size, so finding the right size is not trivial,
moreover I feel that this approach is just too rigid.
- Use some scatter/gather API. api.zeromq.org states that there's intention
to have such API for threadsafe sockets, does it already exist? As I see in
zmq.h there are some deprecated iovector based functions, but I don't think
it's good idea to start building new code on these... (do they work at all
with threadsafe sockets?)

Any other idea, comments?

Regards,
  Gyorgy Szekely
_______________________________________________
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
https://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to