[zeromq-dev] Need help in creating multiple publisher and subscribers

girish kumar girishbangaram at gmail.com
Thu Aug 23 11:21:47 CEST 2012


Hi Thanks for your response.

On 22 August 2012 18:31, Chuck Remes <lists at chuckremes.com> wrote:

> On Aug 22, 2012, at 2:17 AM, girish kumar wrote:
>
> > Hi All,
> >
> > We have started recently working on zero MQ. We could able to run the
> sample applications successfully.
> >
> > We have two problems, which we are facing issues in getting answers.
> >
> > 1. We have a scenario where there are multiple publishers(threads) and
> multiple subscribers(threads). We are not able to understand a model in
> zero MQ, that works for this scenario.
> >   - As zero MQ sockets are not thread safe, can we make zero MQ sockets
> threadsafe by applying explicit locks?.
>
> Each publisher thread should have its own socket. Each subscriber thread
> should also have its own socket. Create a single context and share it
> amongst all of your threads and create the sockets when the thread spins
> up. The library uses lockfree algos internally so if you decide to share a
> single pub/sub socket amongst several threads, the lock contention in your
> application code will kill performance. Let the library do the hard work
> since it is already optimized for this purpose.
>
> >> Typically, we do zero MQ bind to a port in publisher code. But, in this
case how to bind the multiple publisher threads on to the same port. This
is fine with subscriber threads as they simply do zero MQ socket connect.

I am trying to have a global message queue shared between multiple
publisher threads and multiple subscriber threads. Can you please give
suggestions in these lines. Can this be achieved at all, with out using
locking mechanisms.

> 2. Another problem is we are running some performance tests for best
> results. We would like to know the highest possible numbers(latency and
> throughput) achieved with zero MQ.
>
> Use the tests in the perf/ subdirectory on the hardware you will be using.
> Latency and throughput are extremely sensitive to CPU speeds, bus speeds,
> network speeds and other hardware characteristics. Any numbers that I could
> quote you would be specific to my environment and therefore useless to you.
>
> cr
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>



-- 
With Best Regards,
Girish
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20120823/7ee4b401/attachment.htm>


More information about the zeromq-dev mailing list