-
Notifications
You must be signed in to change notification settings - Fork 84
3. Network Topology
The read and write values are priorities as well as switches. Lower positive numbers are tried before higher numbers. Servers at the same priority are selected in random order.
That makes it possible to prefer nearby connections while retaining more distant fallbacks. For example:
Local replica 1: 'write' => 0, 'read' => 1,
Local replica 2: 'write' => 0, 'read' => 1,
Local primary: 'write' => 1, 'read' => 2,
Remote replica 1: 'write' => 0, 'read' => 3,
Remote replica 2: 'write' => 0, 'read' => 3,LudicrousDB will try the local replicas first for reads, then the local primary, then the remote replicas. Writes go to the primary because it is the only server with writes enabled.
From the other location, the priorities can reflect the reversed topology:
Local replica 1: 'write' => 0, 'read' => 1,
Local replica 2: 'write' => 0, 'read' => 1,
Remote replica 1: 'write' => 0, 'read' => 2,
Remote replica 2: 'write' => 0, 'read' => 2,
Remote primary: 'write' => 1, 'read' => 3,You can deploy a different db-config.php in each location, or compute priorities from trusted deployment configuration. Avoid depending on user-controlled request data to determine database credentials or routing.
Priorities only choose among the servers you define. LudicrousDB does not discover topology, configure replication, or verify that servers contain equivalent data.
LudicrousDB documentation · Repository · Support