Skip to content

Congifuration Guide

Eugene Kirpichov edited this page Mar 18, 2015 · 1 revision

How to configure the server and the client bindings

Server

Command-line options

java -jar greg-server.jar OPTIONS

OPTIONS (option defaultValue):

Ports:

  • -port 5676 - which port to accept messages on
  • -calibrationPort 5677 - which port to accept calibration exchanges on

During calibration, we do preCalibrationIters + minCalibrationIters..maxCalibrationIters iterations, until we achieve confidenceLevel confidence that this client's clock offset is within confidenceRangeMs of the true value. preCalibrationIters iterations are done without measurement to warm-up and stabilize the network connection.

  • -confidenceLevel 0.95
  • -confidenceRangeMs 1
  • -minCalibrationIters 10
  • -maxCalibrationIters 100
  • -preCalibrationIters 10

The server's flow is:

  • Put messages from clients into an uncalibrated buffer
  • Once a client's clock offset is known, its messages' timestamps are adjusted accordingly and the messages go to calibrated buffer
  • Messages are pulled from calibrated buffer in order of global time

However, since order of global time != order of arrival, we use the following strategy:

Assume that a message can't be "trumped" by a message that arrived later than (default)5s after it - t.i. if a message has the smallest global timestamp AND it arrived >5s ago, then it goes to output.

  • -maxPendingCalibrated 1000000 - how many calibrated messages to buffer (more will be dropped)

  • -maxPendingUncalibrated 100000 - how many uncalibrated messages to buffer (more will be dropped)

  • -timeWindowSec 5 - the aforementioned time window for calibrated buffer. If you want messages to be output in order of global time, do not make this <2*flushPeriodMs (see below - client configuration). If you don't care, set it to 0 and enjoy the highest throughput possible.

  • -verbose false - whether to print internal information to stderr

Java client

It is configured by system properties. Set them before you use Greg.log() for the first time.

Format: property=defaultValue.

  • greg.server=localhost - speaks for itself.
  • greg.port=5676 - same as -port for the server.
  • greg.calibrationPort=5677 - same as -calibrationPort for the server.
  • greg.flushPeriodMs=1000 - interval between flushing record batches to server (but if there are more than 10,000 messages in a batch, the batch will be cut into pieces of 10,000).
  • greg.clientId=unknown - corresponds to CLIENTID in the server output. Usually a component's name, for example, "BasketService".
  • greg.maxBufferedRecords=100000 - how many records to buffer; more will be dropped.
  • greg.useCompression=true - whether to gzip-compress record batches.
  • greg.calibrationPeriodSec=10 - how often to initiate calibration cycle.
  • greg.trace.enabled=false - whether to print internal information to stderr

Clone this wiki locally