[zeromq-dev] Help with pattern design

Michel Pelletier pelletier.michel at gmail.com
Thu Aug 2 18:16:59 CEST 2012


You want to read up on the ROUTER socket.  It's the goto when you need
a custom routing setup other than the built in load balanced
functionality in PUSH and DEALER.  In your server, you would maintain
a mapping of session ids to worker ids.  The LRU pattern in the guide
defines a nice example for this kind of setup.

-Michel

On Thu, Aug 2, 2012 at 8:34 AM, Alex Massover <alex at jajah.com> wrote:
> Hello,
>
>
>
> I'm trying to design a pattern that will fit my application but can't find a
> proper solution. I'd appreciate if someone could enlighten me.
>
>
>
> I have a process that deals with sessions (voip calls). This server produce
> events for every session, e.g.:
>
> Session1: start
>
> Session1: msgA
>
> Session1: msgB
>
> Session1: msgC
>
>>
> Session1: msgX
>
> Session1: stop
>
>
>
> Each event has a session id. Many sessions exist concurrently.
>
>
>
> And there're multiple workers that consume these events. Single event should
> go to single worker. (PUSH/PULL like pattern).
>
>
>
> My initial though was single PUSH (server that produce events) and multiple
> PULL (workers that consume).
>
>
>
> My challenge is avoid race condition in processing events, i.e. workers
> supposed to consume events in the same order as they produced. And this
> should be done in realtime, I can't serialize at worker side. And single
> worker is not enough from performance point of view.
>
>
>
> Is there any ZMQ magic (pattern) that can force all events from single
> session (based on session id?) to be sent to same worker? This way I'll
> ensure that worker process events in the same order they appeared.
>
>
>
> --
>
> Best Regards,
>
> Alex Massover
>
>
>
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>



More information about the zeromq-dev mailing list