[rabbitmq-discuss] Design for Comet
Marek Majkowski
majek04 at gmail.com
Fri Feb 24 16:57:53 GMT 2012
On Fri, Feb 24, 2012 at 16:13, tsuraan <tsuraan at gmail.com> wrote:
>> Does it mean that every page is user specific? Or is "user" exchange
>> not for per-user messages but rather global ones?
>
> The user exchange is for messages that are addressed to specific
> users, so every web page that a given user has open (on all their
> different browsers, etc) would get all messages addressed to that
> user. Global messages get sent to all pages that are opened in all
> browsers, topic messages get sent to all subscribers to a topic, and
> there are "page" messages that are targeted towards a specific
> instance of a page (i.e. a specific tab that's opened on one of our
> pages).
>
>> Like always - you need to prototype and benchmark it :)
>
> Yeah, I'm really wondering about hidden things, like "that will work
> for a week, but then mnesia will start on fire" or something to that
> effect :)
>
>> But generally, I would probably go for a different setup.
>>
>> I think we can assume with reasonable confidence that number
>> of concurrent users on your site is constant. (as opposed to
>> dynamic pages AFAIU)
>>
>> So why not create queue-per-user? (for users actively browsing).
>>
>> When user enters a page - you can subscribe the queue to a per-page
>> exchange. When user navigates away - you unsubscribe.
>
> Ok, I think I'm missing something. Are you saying to create per-page
> exchanges rather than per-page queues, and then subscribe the
> exchanges to queues? Is it cheaper to create exchanges than to create
> queues?
Yes, exchanges have no state, while queues actually store data.
Exchanges - light, Queues - heavy.
> Also, binding a queue to an exchange isn't something I was
> aware could be done; does it just use the normal queue.bind command,
> but putting the exchange name where the queue name normally goes, and
> vice versa?
I said:
>> When user enters a page - you can subscribe the queue to a per-page
>> exchange. When user navigates away - you unsubscribe.
So, I suggest to bind the per-user-queue to an per-page-exchange.
(or, bind per-user-queue to a all-pages-exchange but with a binding
key that will catch only messages flying to the particular page
on which the user is right now)
Marek
More information about the rabbitmq-discuss
mailing list