sxs, lxs and wxs
sxs is a single server codebase. A deployment can run several instances of that server, each hosting one or more capacities.
A capacity is a class of work with its own traffic pattern and resource cost. It is not a separate application: the same image can serve normal queries, consume ingestion jobs or run extractions, depending on its configuration.
Capacities, execution modes and resource profiles
Four concepts must be kept separate:
- Delivery describes whether a data request is synchronous or an asynchronous export.
- Execution mode describes where synchronous data work runs:
main-looporworker. - Resource profile describes how ClickHouse executes the query:
normalorbulk. - Capacity describes what a server process is allowed to do.
Neither delivery nor resource profile selects an execution mode by itself. See Execution modes and resource profiles for the full model.
The MODES environment variable selects the capacities hosted by a process.
The name is historical: operationally these are capacities.
The capacities
The loader capacity handles dbmx.data.store, dbmx.structure.store,
dbmx.data.transfer and job cancellation. workers enables local worker
execution capacity; exports consumes the MongoDB export queue. Both can run
locally in development or in dedicated wxs processes.
At the time of writing, MODES gates sdmx, loader, rpc, workers and
exports.
workersenables local worker execution. Without it, eligible worker jobs are sent to the remote wxs queue.exportsstarts the export consumer. Without it, the process remains export-producer only.- Neither capacity changes the execution mode or resource profile of a request. Those are selected separately by the worker/bulk thresholds and the request shape.
Why isolate capacities
Fast queries are latency-sensitive. Ingestion and extractions are not: they can consume CPU for minutes, grow the heap and open their own ClickHouse, MongoDB and AMQP connections. When both run in the same process, a large load or a bulk download can slow down interactive requests and an out-of-memory error takes the query process with it.
Separating capacities gives each workload:
- its own event loop and heap;
- its own CPU and memory budget;
- its own ClickHouse and MongoDB connection pools;
- its own AMQP consumer and failure domain;
- independent scaling and rollout.
Isolation is not absolute: all processes still share MongoDB, ClickHouse, RabbitMQ, the network and the Kubernetes node pool.
Selecting capacities
A process selects its capacities with MODES:
SERVICE_NAME labels logs and identifies the MOM application. It does not
enable work by itself; MODES does. If MODES is unset, all known capacities
are enabled, so set it explicitly in a deployment.
Reference deployment: sxs + lxs
The production layout separates the query fleet from ingestion and RPC:
lxs exists to isolate ingestion and RPC traffic from the fast-query fleet:
- Ingestion requests are stored in a durable MongoDB queue (the
ingestionscollection) and claimed with a lease, so severallxsreplicas can process them concurrently without running the same ingestion twice. Each replica handles one ingestion at a time; N replicas give N concurrent ingestions. - Restarting
lxsis safe: at startup it reclaims only ingestions whose lease has expired (their owner is gone) and requeues them, up toINGESTION_MAX_ATTEMPTS. A live replica's in-flight ingestion is never cancelled by another replica. lxsalso hassdmxenabled so the same HTTP routes are available, but query traffic is routed to thesxsservice.lxsreadiness requires AMQP because ofloaderandrpc;sxsreadiness does not.- Deploy the same image to both. The loader and RPC code must match the query code that created the ingestions.
See Ingestion queue for the lifecycle, statuses and settings.
All-in-one deployment
For development or small installations, one process can host everything:
This is simpler to run, but there is no workload isolation: a long ingestion or a large extract shares the process with interactive queries.
wxs deployment
wxs hosts the extraction capacities (workers and exports), leaving sxs
dedicated to query serving and lxs to ingestion and RPC. The receiving sxs
process still serves the normal, bulk and export APIs; wxs executes worker jobs
and exports.
wxs is a worker execution deployment. It does not define a new resource profile: execution mode and resource profile are still selected on sxs.
