Skip to main content

Topologies

The NGSI-LD specification doesn't prescribe an architecture. It describes three prototypes, centralised, distributed and federated, expects real systems to mix them, and requires the API to serve all of them. Andromeda serves every one with the same binary. What changes from one topology to the next is how many brokers you run and what you register in them.

Choosing one​

Start with a single broker and move on only when data has to stay where it is. Moving later costs little, because registering a source adds to what the broker answers with and leaves the entities it already holds alone.

Split entities is not a shape of its own. Every distributed, federated or hierarchical setup decides whether a source holds whole entities or only some attributes of entities that other sources also hold, and that choice sets how much work a query costs.

Side by side​

Every Andromeda broker has a PostgreSQL server of its own, so a deployment needs as many databases as it runs brokers.

TopologyBrokersWhere the data livesSources run by
Single broker1In the brokerNo sources
Distributed1In the broker and the sourcesYou
Federated1, plus 1 per domainIn the domainsOther teams
Hierarchical1 per level and domainMostly at the lowest levelEach level's own team

How brokers are joined​

Every topology beyond a single broker is built from one thing, a registration. A registration tells a broker that another system holds some entities and attributes, and where to reach it. The broker keeps its registrations itself, so there is no separate registry to run. The Distributed guide shows how to write them, and Distributed operations describes what the broker does with them.

A broker that holds registrations forwards each request to the sources it matches and merges their answers with its own data. A source that fails becomes a warning on the answer, and the request still succeeds. The system at the other end needs nothing special. It serves the ordinary NGSI-LD API and doesn't have to be Andromeda.

The examples​

Each topology page ends with an example deployment, a Docker Compose file you can run as it stands, followed by the requests that register the sources and query through them. The files follow the Docker page, with the same images, the same .env holding the database password and docker compose up -d to start. Where one file runs several brokers, a suffix names the domain, as in andromeda-parks, postgresql-parks and postgresql-parks-data. The highlighted lines hold the federation settings, and the stand-ins for your own services where a page has any.

The domains of the federated and hierarchical examples are meant to be independent, which is why each one keeps its own database. The examples publish no database port, and publish a broker's port only where a client outside Compose needs it. Security describes what to put in front of a broker that clients reach.

Everything else about a deployment, from sizing to TLS and the proxy in front, works the same in every topology. Choosing a setup goes through it, and the Deployment planner builds the configuration for one broker.

Settings every topology shares​

  • federation.identity.source_alias

    The name a broker adds to the Via header of every request it forwards. A request whose Via already holds this name is treated as a loop and goes no further, so every broker needs a name of its own. Left out, it is the host of server.public_url, or the machine's host name when there is no public URL. Set it whenever two brokers could share a host name.

  • federation.identity.source_id

    The identifier a broker reports at /ngsi-ld/v1/info/sourceIdentity. Left out, it is urn:ngsi-ld:ContextSourceIdentity: followed by the alias.

  • server.public_url

    The address other brokers reach this one at. Forwarded subscriptions name it as the endpoint their notifications come back to, so without it the broker forwards no subscriptions to its sources.

  • federation.forwarding.connect_timeout, federation.forwarding.request_timeout and federation.forwarding.max_concurrent

    How long connecting to a source may take (3 seconds), how long a whole forwarded request may take (5 seconds), and how many forwarded requests one operation has in flight at once (16). The request timeout has to stay below request_limits.timeout, and a registration's own management.timeout takes precedence over it.

  • federation.cooldown.mode

    Whether a source that fails is held back so that it doesn't slow every request. The default, "disabled", holds back only registrations that set management.cooldown. "constant" holds every failed source back for the same time, and "exponential" doubles the hold with each failure in a row.

  • federation.query.max_entities

    The most distinct entities one federated query gathers, 10,000 by default. A query that would gather more is refused with 403 TooManyResults rather than answered with a cut-off list.