Multitenancy

sxs is a multi-tenant, multi-space SDMX endpoint: one running deployment can serve many independent tenants, and inside a tenant many isolated workspaces. Each (member, space) pair is fully separated — its own structures, datasets and metadata — so tenants never see each other's data.

Principle

Terminology:

  • a member (also called a tenant) is an organisation using the platform;
  • a space is an isolated workspace inside a member (for example collect, disseminate, qa-stable).

Isolation is physical: every (member, space) pair has its own databases. Nothing is shared between them.

StoreDatabase nameExample
MongoDB{MONGODB_DATABASE}:{member} or :{member}:{space}sxs:orox:collect
ClickHouse{member}_{space} (./-/: → _)orox_collect

A member that has no space is itself a single tenant, stored in a member-level database:

StoreDatabase nameExample
MongoDBsxs:{member}sxs:mrox
ClickHouse{member}_defaultmrox_default

This is exactly the .stat Suite model, where the tenant is injected upstream (by the Proxy / config layer) on every request rather than chosen by the API consumer.

How a request selects a tenant and a space

The space is the first segment of the request path. The member is injected by the proxy (or explicitly provided).

Request pathSpaceSDMX version
/{space}/sdmx/...{space}v3 (default)
/{space}/v2/sdmx/...{space}v2
/{space}/v3/sdmx/...{space}v3
/sdmx/...nonev3

For example:

GET https://sxs.example.org/collect/sdmx/data/dataflow/ECB/EXR/1.0?member=orox

The member is resolved, in order, from:

  1. the member query parameter (?member=orox);
  2. the x-member request header;
  3. the tenant query parameter or the x-tenant header;
  4. the DEFAULT_MEMBER environment variable.

In a typical deployment the proxy injects the member (header or query) based on the incoming host or user, so consumers only deal with /{space}/... URLs.

Where the configuration lives

Members and spaces are declared in a single tenants.json document served by the config service (Confy) at {CONFIG_URL}/configs/tenants.json. It is keyed by member id:

{
  "orox": {
    "label": "OROX",
    "defaultLanguage": "en",
    "languages": "en,fr",
    "spaces": {
      "collect": { "label": "OROX collect", "url": "https://sxs.example.org/collect/sdmx" },
      "design": { "label": "OROX design", "url": "https://sxs.example.org/design/sdmx" }
    }
  },
  "mrox": {
    "label": "MROX",
    "defaultLanguage": "en",
    "languages": "en,fr,es",
    "url": "https://sxs.example.org/sdmx"
  }
}
  • orox has two spaces → two isolated database pairs.
  • mrox has no spaces → it is a single member-level tenant.

Each space carries its own properties (label, languages, access modes, feature flags). Read and write access are configured per space — see Authorization.

Loading and refreshing

  • At boot sxs loads tenants.json and keeps it in memory. If the config service is unreachable at boot, sxs fails to start.
  • At runtime the cache is refreshed:
    • on the configs.tenants.updated event pushed through the message broker, and
    • periodically (every 10 minutes) as a safety net.
  • Editing an existing member or space (access, settings, feature flags) is picked up without a restart.
  • Adding a new member or a new space should be done with a restart, so sxs creates and ensures the databases and indexes at boot.

How to use it

Add a space

Add an entry under the member's spaces in tenants.json, then define its access:

{
  "orox": {
    "spaces": {
      "new-space": {
        "label": "New space",
        "read": "public",
        "write": "member"
      }
    }
  }
}

Scope settings to a space

Any space-level setting (worker thresholds, formats, validation, …) is written as a property of the space object:

{
  "orox": {
    "spaces": {
      "collect": {
        "workerObsCountLimit": 10000,
        "allowNativeCsv": true
      }
    }
  }
}

See Settings for the resolution order and the full reference.

Point a consumer at a space

Consumers always address a space by its id in the path: /{space}/sdmx/.... The proxy (or the caller) supplies the member so the same deployment serves every tenant.

Verify the loaded tenants

The health endpoints report the tenant cache (last update time and count). For example GET /ready (or /healthcheck) returns a tenants section:

{ "tenants": { "lastUpdated": "...", "count": 4 } }

See also