Skip to content
miniway edited this page Sep 5, 2012 · 20 revisions

Welcome to the jeromq wiki!

Guide

Please read the bible first.

JeroMQ ported guide examples. I just changed the namespace from org.zeromq to org.jeromq, removed '\u0000' terminated string and 0MQ 2.x specific code.

Cautions

  • Context.term() must be called before interrupting a thread by Thread.interrupt. Otherwise internal pipe which is used to signal ZMQ commands will be shutdown unexpectedly.

Common mistakes (Already mentioned at the zguide )

  • Close all the sockets property otherwise Context.term() will wait forever
  • Set a proper linger by using Socket.setLinger(millis) when you want to wait before socket termination. Otherwise some last messages could not be delivered.
  • Set a propert HWM (High Water Mark). At 0MQ 3.x, you should set Socket.setSndHWM and setRcvHWM separately. The default value is 1000 each. -1 is unlimited but it could blow your memory.
  • At PUB/SUB, PUB will drop messages silently when a connected sending pipe has more messages than HWM. Other available SUBs will can receive the messages.
  • At PUSH/PULL, PUSH will block sending messages when there's no available PULL. Otherwise one of available PULL can receive the messages.
  • If you're interested in LWM (Low Water Mark) also please refer compute_lwm at Pipe.java

Recommended JVM options

  • -XX:+AggressiveOpts -XX:+UseCompressedOops would sometimes increase performance
Clone this wiki locally