Skip to content
Portal

High availability

The API runs on two identical gateways. Traefik serves them on one address and balances the calls; a gateway that stops answering /health (probed every 3 seconds) is taken out, then taken back on its return.

What must be unique How
A scheduled job Each due run executes once: the run takes a lease in the database, renewed while it runs; a stopped gateway lets its lease expire, the other takes over
A network station (TCP connection to the network) Held by one gateway under a lease; taken over by the other if it stops
What is created at startup (HSM keys, vault) Done by one gateway at a time, under a PostgreSQL lock
The HSM keys and quotas in memory Identical on both gateways: a change is signalled by the database and read again at once
The rate quotas Counted in Redis, shared
The banks’ consumption Published by each gateway to Redis and added up

A PostgreSQL replica follows the primary by streaming replication. The consultation screens (lists of operations, cards, cardholders), the reporting and the audit trail read it as long as it is less than 5 seconds behind; otherwise they read the primary.

  • Each gateway measures the delay every second (age of the oldest primary position not replayed). Under load it stays around a millisecond.
  • A read the replica fails (stopped, unreachable, replay conflict) is done again on the primary at once: replica stopped under continuous calls, no failed call.
  • The replica applies the same bank isolation as the primary.

The large journals (events, webhook deliveries, decisions, rule runs, network messages) are partitioned by month: they grow without slowing down, and an old month is dropped at once. Partitions are created three months ahead by a scheduled job.

Component down Effect
Redis Quotas counted per gateway, card activity read from PostgreSQL: slower, never wrong
Kafka Events wait in the journal and leave on its return, in order; the webhooks are not delayed
Replica Everything is read from the primary
A gateway The other serves everything