why is Publication ID drawn randomly?

22 views
Skip to first unread message

Darren Smith

unread,
Mar 16, 2019, 8:35:17 AM3/16/19
to WAMP
Hi

According to the spec, the Publication ID is a Global Scope ID and so "MUST be drawn randomly from a uniform distribution".

What is the reason for drawing it randomly, rather than, say, an increment by 1 approach (e.g. a Session Scope ID) ?

I think it would be more natural to act like a Session Scope ID since it is the broker that establishes the ordered history of Events, and so each successive Event could be incremented by 1.  It is also computationally cheaper.  There is less likelihood of duplicate IDs being used (unique to individual topics).

If a broker implementation were instead to generate these ID via increment-by-1 approach, what problems might this cause for subscriber-clients that expected randomly drawn IDs?  

Thanks,

Tobias Oberstein

unread,
Mar 17, 2019, 5:33:15 AM3/17/19
to wam...@googlegroups.com, Darren Smith
Hi Darren,

Am 16.03.19 um 13:35 schrieb Darren Smith:
>
> Hi
>
> According to the spec, the Publication ID is a Global Scope ID
> and so "MUST be drawn randomly from a uniform distribution".

yes, correct!

>
> What is the reason for drawing it randomly, rather than, say,
> an increment by 1 approach (e.g. a Session Scope ID) ?

globally scoped IDs need to be, well, "globally unique". global here
means within a routing realm of WAMP - and across potentially all
physical WAMP routers clustered or federated.

the latter is important (not with a single node router, but beyond ..)
in a distributed system (the presumed cluster/federation of physical
WAMP routers), stuff can fail .. in many ways.

coming up with a requirement of a "globally unique sequence" for eg WAMP
registrations or subscriptions would make above quite hard: you need a
strictly consistent store for the sequence.

ultimately, random numbers are super cheap at achieving the same goal:
globally unique - practically.

>
> I think it would be more natural to act like a Session Scope
> ID since it is the broker that establishes the ordered history
> of Events, and so each successive Event could be incremented
> by 1.  It is also computationally cheaper.  There is less
> likelihood of duplicate IDs being used (unique to individual
> topics).
>
> If a broker implementation were instead to generate these ID
> via increment-by-1 approach, what problems might this cause
> for subscriber-clients that expected randomly drawn IDs?

I'm afraid, rgd the "ID question": the discussion on this is closed and
the protocol is fixed in the WAMP spec. However, we should absolutely
explain the why and reasoning;)

I took the chance and added this post to he following tracking issue on
above: https://github.com/wamp-proto/wamp-proto/issues/231

Anyways, hope above helps already on that! Cheers,
/Tobias

>
> Thanks,
>
> --
> You received this message because you are subscribed to the Google
> Groups "WAMP" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to wampws+un...@googlegroups.com
> <mailto:wampws+un...@googlegroups.com>.
> To post to this group, send email to wam...@googlegroups.com
> <mailto:wam...@googlegroups.com>.
> Visit this group at https://groups.google.com/group/wampws.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/wampws/ad41e7f7-70db-4f05-859d-dffe25f1506a%40googlegroups.com
> <https://groups.google.com/d/msgid/wampws/ad41e7f7-70db-4f05-859d-dffe25f1506a%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages