[zeromq-dev] concurrent test design - need advices

Laurent Alebarde l.alebarde at free.fr
Thu Oct 10 18:38:31 CEST 2013


Hi Pieter,

Thank you for your quick reply.

"/you do realize that there is no real concurrency, right? It's all 
serialized/" : yes, proved by design. My personnal use case for this 
test is my PARANO mechanism, where nonces are sent encrypted in the box 
for use by the next peer send. No information in plain text at all ! 
Paranoid isn't it ?

  For the handshake, it is easy. But after, we can have simultaneous 
sends from client and server. Without considering multi-clients, the 
algorithm to manage correctly the nonces between the client and the 
server is tricky. So I need to test concurrent send from the client and 
the server.

At this point, introducing multi-clients in the test is free. A side 
effect will be to have a multi-client concurrency test available for any 
socket type where it makes sense.

In order to avoid sending a burst of say 100,000 messages, I need a 
"precise" synchronisation. Thus something close to the kernel looks like 
a good choice. As I want the test to be portable, zmutex has looked a 
good candidate for synchronizing the bursts. You know, it is just for 
testing, not a library functionality.

I don't know if I can reach a sufficient time resolution with PUB/SUB, 
but I am going to try.

Cheers,


Laurent.


Le 10/10/2013 18:15, Pieter Hintjens a écrit :
> Hi Laurent,
>
> You can't use zmutex in a libzmq test case... and in general I'd stay
> away from using that in any code which people might plausibly take as
> an example. It's a class that I regret making in CZMQ and sometimes
> think of killing off.
>
> Use ZeroMQ messages to synchronize the threads; control them from the
> main function. You can easily synchronize N threads using a pub-sub
> socket flow.
>
> As for how many threads and messages... you do realize that there is
> no real concurrency, right? It's all serialized, that is kind of the
> beauty of ZMQ.
>
> -Pieter
>
>
>
> On Thu, Oct 10, 2013 at 5:55 PM, Laurent Alebarde <l.alebarde at free.fr> wrote:
>> Hi Devs,
>>
>> I would like to add a concurrent test to libzmq.
>>
>> Objective : test multi-thread clients concurrent messaging send/receive from
>> the same server.
>>
>> Design : use a mutex to synchronize every round of bursts. Each burst is a
>> TBD number of messages. One burst of send, one of receive, all of it a few
>> times. It will work as bounce i.e. the test program can use it with any type
>> of socket.
>>
>> Questions :
>>
>> Is zmutex a good solution to synchronize the threads ?
>> The doc shows an example of zmutex in the same function. How do I use it in
>> a multithread environment, shall I pass the mutex to the threads as an
>> argument ?
>> If say the resolution is 1ms, how many 32 bytes messages shall I send in
>> each burst to obtain concurrency for sure ?
>> How many clients do you advise ?
>>
>> Cheers,
>>
>> Laurent.
>>
>>
>> _______________________________________________
>> zeromq-dev mailing list
>> zeromq-dev at lists.zeromq.org
>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20131010/477513ce/attachment.htm>


More information about the zeromq-dev mailing list