Open shupx opened 1 year ago
sender->set(zmqpp::socket_option::send_high_water_mark, 1); // HWM should be set before bind/connect!
receiver->set(zmqpp::socket_option::receive_high_water_mark, 1); // HWM should be set before bind/connect!
Adding these two lilnes does not seem to take much effects.
ZeroMQ will create a message queue for each send threads. The queue size is specified by HWM(High Water Mark). If the queue fills up the new sending messages will be dropped/discarded by zeroMQ PUB socket.
Swarm_ros_bridge does not set HWM of send sockets, thus a default HWM value of 1000 is used. This means that the max sending queue size is 1000 ( maybe half in practice actually).
Large HWM value leads to less dropping of non-streaming sending messages if the consuming/receiving rate is less than the sending rate . But for streaming messages, large HWM leads to high latency for streaming messages as the receiving messages are those being queued 1000 before. If you wants high-real-time messages, then HWM should be set small.
Maybe we need add the HWM attributes in ros_topics.yaml and let user define the HWM in their need.