---
id: "matching-engine"
type: "kind"
category: "compute"
url: "https://localhost:3000/catalogue/kinds/matching-engine"
---

# Matching engine

Deterministic single-threaded order-book matcher.

| | |
|---|---|
| Category | Compute |
| Properties | 6 |
| Components | 3 |
| Rules | 2 |

## Properties

| property | type | values | required | default |
|---|---|---|---|---|
| `algorithm` | enum | `price-time`, `pro-rata` | no | "price-time" |
| `deterministic` | boolean | — | no | true |
| `failover` | enum | `none`, `manual`, `automatic` | no | "none" |
| `managed` | boolean | — | no | false |
| `role` | enum | `primary`, `standby` | no | "primary" |
| `singleThreaded` | boolean | — | no | true |

## Rules for this kind · 2

### Stateful engine pinned to a single zone `stateful-engine-pinned-to-single-zone` (error)

- Page: https://localhost:3000/catalogue/rules/stateful-engine-pinned-to-single-zone.md
- Why: A matching engine, coordination service or event store living in exactly one availability zone, with no failover and no replication, is lost with that zone. Everything that depends on it stops with it.
- Applies to: every node of kind matching-engine, coordination-service or event-store
- Message: '{{node.id}}' is pinned to a single availability zone with no failover or replication.

It fires when:

- all of these hold:
  - the node sits inside exactly 1 availability-zone group
  - any of these hold:
    - the node's `failover` is "none"
    - the node's `replicated` is false
    - the node's `replication` is "none"

### Stateful node without zone redundancy `stateful-node-without-zone-redundancy` (error)

- Page: https://localhost:3000/catalogue/rules/stateful-node-without-zone-redundancy.md
- Why: A stateful compute node pinned to exactly one availability zone disappears with that zone, and its state goes with it. Nodes inside a cell are exempt, because there the cell is deliberately single-zone and redundancy comes from the other cells.
- Applies to: every node in category compute
- Message: Stateful node '{{node.id}}' lives in exactly one availability zone. A zone outage takes its state with it.

It fires when:

- all of these hold:
  - the node's `stateless` is false
  - the node sits inside exactly 1 availability-zone group
  - this does not hold:
    - the node sits inside at least one cell group

## Components · 3

### vendor-neutral

- [Generic matching engine](https://localhost:3000/catalogue/components/matching-engine.md) `matching-engine` — the kind itself

### aws

- [Amazon GameLift FlexMatch](https://localhost:3000/catalogue/components/aws-gamelift-flexmatch.md) `aws-gamelift-flexmatch` — 3 defaults

### default

- [Order-book matcher](https://localhost:3000/catalogue/components/order-book-matcher.md) `order-book-matcher` — 5 defaults

## Source (`kind` YAML, verbatim)

```yaml
# yaml-language-server: $schema=../schema/kind.schema.json
# Abstract kind: Deterministic, single-threaded order-book matcher fed by a sequenced event stream (exchanges, marketplaces).
schemaVersion: "1"
type: "kind"
id: "matching-engine"
category: "compute"
properties:
  singleThreaded:
    type: "boolean"
    default: true
  deterministic:
    type: "boolean"
    default: true
  algorithm:
    type: "enum"
    values: ["price-time", "pro-rata"]
    default: "price-time"
  role:
    type: "enum"
    values: ["primary", "standby"]
    default: "primary"
  failover:
    type: "enum"
    values: ["none", "manual", "automatic"]
    default: "none"
  managed:
    type: "boolean"
    default: false
```

Human page: https://localhost:3000/catalogue/kinds/matching-engine
