Home

Naoki Rinmous edited this page Aug 3, 2017 · 20 revisions
Clone this wiki locally

Welcome to the jeromq wiki!

Guide

Please read the bible first.

JeroMQ ported guide examples.

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.
  • Sharing ZContext

Common mistakes (Already mentioned at the zguide )

  • Close all the sockets properly 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

JVM options

  • -server -XX:+UseConcMarkSweepGC
  • -XX:+TieredCompilation (if you're using the latest JVM)
  • At java7, tiered compilation is now the default mode for the server VM
  • -XX:+AggressiveOpts
  • -XX:+UseCompressedOops might increase performance a little bit or not at 64bit OS
  • enabled by default in Java SE 6u23 and later. In Java SE 7, use of compressed oops is the default for 64-bit JVM processes when -Xmx isn't specified and for values of -Xmx less than 32 gigabytes.
  • -XX:+UseBiasedLocking might increase performance a little bit or not
  • -XX:+UseNUMA could increase performance