dmlc / ps-lite

A lightweight parameter server interface
http://ps-lite.readthedocs.org
Apache License 2.0
1.53k stars 542 forks source link

About the lock in ZMQVan::SendMsg #84

Open microwish opened 7 years ago

microwish commented 7 years ago

Might the granularity of the lock be smaller? I'm not sure.

I feel that reasons why the lock guards the whole function body are: 1) protect senders_ from racing 2) keep the data transfer to the socket continuously and avoid being interrupted

As for reason 1, smaller granularity is acceptable. As for reason 2, perhaps other operations than locking could be tried.

ymjiang commented 5 years ago

@microwish SendMsg is an asynchronous call and will return immediately (http://api.zeromq.org/2-1:zmq-send), so the lock granularity does not matter too much in terms of the performance.