Skip to main content

Tracing

The distribution layer leverages tracing to provides insights into the queries executed in the cluster. Check tracing to configure it.

Logging

Without tracing activated, the distribution layer provides some logging.

Logger naming

To retrieve all the distribution logs, two loggers should be activated:
  • atoti.server.distribution (new namespace)
  • com.activeviam.activepivot.dist (legacy namespace)
The issue with the legacy logger is that its name hierarchy (e.g. com.activeviam.activepivot.dist.impl.private_) contains internal packages and classes, thus making it hard to filter using a more granular logger, as the full logger name hierarchy is not public, and can be changed between two bugfix versions. The new logger (atoti.server.distribution) will provide some more granular loggers, to focus on one particular aspect of the distribution such as “atoti.server.distribution.messaging”, … The exhaustive list will be made available in the future, but will be fully contained under atoti.server.distribution. As loggers will be moved gradually from com.activeviam.activepivot.dist to atoti.server.distribution, it is recommended to activate both loggers in your project, to avoid missing any logs when upgrading to a newer bugfix version.

What is the distribution state of a query cube?

The distribution state is the view a query cube holds of its cluster. It has three levels: the query cube, its remote data cubes, and the branches of those data cubes. The state is built only from what the query cube has received, starting with the messages published by its data cubes and the JGroups cluster membership notifications. Reading it tells you how far each data cube and each branch has got: which ones the query cube has fully accepted, which are still waiting for a message, and which have failed. This section assumes familiarity with the distributed architecture and with the communication flow between data cubes and query cubes.
The distribution state reports exactly one thing: what the query cube has received.
  • It is not what the data cubes have sent. A message a data cube has already published, but that has not reached the query cube yet, leaves no trace in the state.
  • It is not what the query cube has applied onto its own cube. A transaction message that has arrived already advances the state of the branch it targets, while the transaction itself may not have been committed onto the query cube yet, so a query does not return its data.
A data cube reported as LIVE therefore means that the query cube received its discovery, not that every message it sent has arrived, and not that the work has been applied. The endpoints listed in Where does an event stand in the processing pipeline report where that input stands in the processing pipeline.

How to request the distribution state

Every distribution observability endpoint is served under the same prefix:
They are all GET endpoints. Each one takes the name of a query cube as a path variable and returns JSON. Each one answers 404 when no query cube goes by that name, and when distribution is not started on that cube. They are documented request by request in the REST service. The state of a query cube is read from the state endpoint:
The response nests the three levels:
  1. The top object carries queryCube, the state of the query cube itself, and dataCubes, a map keyed by data cube address.
  2. Each entry of dataCubes carries dataCube, the state of that data cube, and branches, a map keyed by branch name.
  3. Each entry of branches carries the state of that branch.
The response below describes a converged cluster. It holds one data cube, known under the address data-cube-A, with a single master branch:

What are the query cube states?

The query cube reports one of two states. The queryCube object carries these fields. Every field but state is null except in the AWAITING_DISCOVERY state. See Wait for All Applications to configure the property that makes that state reachable.

What are the remote data cube states?

Each data cube the query cube knows reports one of six states. Each dataCube object carries these fields. A reservation expires after the delay set by Pending discovery timeout, and the number of reservations held at once is capped by Pending initial discoveries.

What are the remote branch states?

Each branch of a data cube reports one of four states. Each branch object carries these fields.

Where does an event stand in the processing pipeline?

The state endpoint stops at what the query cube received. Four more endpoints report where that input stands in the processing pipeline.

Which messages is a query cube holding back?

A data cube publishes its messages in a sequence. The query cube buffers a message whose predecessor in that sequence has not arrived. It keeps that message until the gap is filled. A growing buffer means the cluster is waiting on a message that never came.
The response groups the buffered messages by data cube address, then by branch, in ascending sequence order. A data cube buffering nothing is left out. An empty response therefore means every data cube is up to date.

How to request the same information over JMX

Every endpoint above has a JMX counterpart, each carried by its own monitored child of the query cube MBean. See JMX monitoring to connect an MBean client to the server.
listQueuedMessages is reported per data cube, as one child of DistributionState per data cube address, while the queuedMessages endpoint returns every data cube in a single response.