[nanomsg] Re: Lock in nn_sock_send

  • From: Steven Wu <stevenwu.ucd@xxxxxxxxx>
  • To: Martin Sustrik <sustrik@xxxxxxxxxx>
  • Date: Mon, 16 Sep 2013 10:20:43 -0400

Hi Martin,

Thanks, my comments are embedded below.


>
>  I'm afraid that all of the
>> connections of a super socket sharing a single lock may have performance
>> penalty underneath.
>>
>
> There are shared algorithms inside nn sockets. Like load-balancer or
> fair-queuer. Then there are multiple threads using them: user threads as
> well as internal nanomsg worker threads. What's the alternative to a lock
> in such case?
>
>
Oh,  so my understanding is that the nn sockets at a send function have two
stages happened which are connections selection by the load balancer or
fair-queuer, and the data sending or queued on the selected connections.
I think it may be a good idea but of cause it will require more work if we
can separate the single shared lock to be a shared lock for the connection
selection and locks of connection-wise for the data sending/queued, which
can reduce the blocking by overlapping lock on the shared lock when the
socket is used by multiple threads.


> Martin
>
>

Other related posts: