[zeromq-dev] jeromq mdlclient2 loses/lost messages
Yu Dongmin
miniway at gmail.com
Sat Sep 7 04:56:41 CEST 2013
Hi,
I also found that there're two issues here.
- At the examples, HWM is not set. so the default value, 1000 is applied. Messages can be dropped silently in broker, worker or client.
- Late binding issue. So the first message can be loss.
I'm going to set required socket options to the examples.
Thanks
Min
On Sep 7, 2013, at 6:09 AM, Roger <roger.ne.ll at gmail.com> wrote:
> I'm using jeromq.
>
> I ran the mdworker, mdbroker and mdclient2 (the async example) and the
> client loses about 15% of the messages.
>
> If I run msclient (sync example) all messages are received.
>
> To exaggerate the message loss, and record the number of messages lost I
> made a few changes to mdclient2.
>
> ----
> import org.zeromq.ZMsg;
>
>
> /**
> * Majordomo Protocol client example, asynchronous. Uses the mdcli API to
> hide
> * all MDP aspects
> */
>
> public class mdclient2 {
>
> public static void main( String[] args ) throws Exception {
> boolean verbose = ( args.length > 0 && "-v".equals( args[ 0 ] ) );
> mdcliapi2 clientSession = new mdcliapi2( "tcp://localhost:5555", verbose
> );
>
>
> System.out.println( "Sending" );
> int count, recvCount = 0;
> for( count = 0; count < 100000; count++ ) {
> ZMsg request = new ZMsg();
> request.addString( "Hello world " + count );
> clientSession.send( "echo", request );
> }
>
> System.out.println( "Sleeping" );
> Thread.sleep( 5000 );
>
> System.out.println( "Receiving" );
>
> for( int i = 0; i < 100000; i++ ) {
> ZMsg reply = clientSession.recv();
> if( reply != null ) {
> ++recvCount;
> reply.destroy();
> }
> else {
> break;
> }
> }
>
> System.out.printf( "%d requests, %d replies\n", count, recvCount );
> clientSession.destroy();
> }
>
> }
>
>
> _______________________________________________
> 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