[nanomsg] Re: Trying to implement "directory" pattern

  • From: Paul Colomiets <paul@xxxxxxxxxxxxxx>
  • To: Martin Sustrik <sustrik@xxxxxxxxxx>
  • Date: Tue, 26 Feb 2013 21:41:15 +0200

Hi Martin,


On Tue, Feb 26, 2013 at 11:28 AM, Martin Sustrik <sustrik@xxxxxxxxxx> wrote:

> On 2013-02-26 09:49, Paul Colomiets wrote:
>
>> Hi Martin,
>>
>>
>> On Mon, Feb 25, 2013 at 11:48 PM, Martin Sustrik <sustrik@xxxxxxxxxx>
>> wrote:
>>
>>  On 25/02/13 21:55, Paul Colomiets wrote:
>>>
>>
>  You caught me, I don't use subscriptions at all :) I always subscribe on
>> empty string.
>>
>
> I've never seen it used either. It would be nice if someone with a real
> use case could explain it.
>
>
But I promise, I will use them in "directory" pattern :)


>
>  Do you have an idea what should subscription forwarding should do in case
>>> of TCP pushback?
>>>
>>
>>
>> At the moment I don't see any other solutions, except buffering, and if
>> connection does no progress for some time, drop it.
>>
>
> The problem with that is auto-reconnect. Subscriber sends a lot of
> subscriptions, more that the producer is able to accept. It is not
> processing them, so TCP pushback happens. Subscriber sees that the
> subscription stream is stuck and disconnects the peer. The producer tries
> to reconnect and immediately gets hit by a subscription storm. As so on ad
> infinitum.
>

That's why I've written "if connection does no progress". I mean disconnect
if no bytes where sent for 10 seconds, or something like that. It means
that any number of subscriptions can be sent, even if it would take minutes
to upload them. I think in all realistic situations (up to thousands
subscriptions in up to few seconds) it will work. There is an edge case,
when you create new subscriptions in the tight loop, and publisher can't
keep up with it. But I don't think it's a situation that's need to be taken
care of.



> Note that this only happens when it is publisher who connects. Which is
> the scenario with multiple publishers that's currently disabled in PUB/SUB
> protocol.
>
>
Ah, why? You don't disconnect nn_connect()'ed socket? I think connected
sockets should disconnect on the same rights as connections are dropped
from bound sockets.

-- 
Paul

Other related posts: