You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+12-12Lines changed: 12 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ PostgreSQL pooler (like PgBouncer) with sharding, load balancing and failover su
15
15
| Session pooling |:white_check_mark:| Identical to PgBouncer. |
16
16
|`COPY` support |:white_check_mark:| Both `COPY TO` and `COPY FROM` are supported. |
17
17
| Query cancellation |:white_check_mark:| Supported both in transaction and session pooling modes. |
18
-
| Load balancing of read queries |:white_check_mark:| Using round-robin between replicas. Primary is included when `primary_reads_enabled` is enabled (default). |
18
+
| Load balancing of read queries |:white_check_mark:| Using random between replicas. Primary is included when `primary_reads_enabled` is enabled (default). |
19
19
| Sharding |:white_check_mark:| Transactions are sharded using `SET SHARD TO` and `SET SHARDING KEY TO` syntax extensions; see examples below. |
20
20
| Failover |:white_check_mark:| Replicas are tested with a health check. If a health check fails, remaining replicas are attempted; see below for algorithm description and examples. |
21
21
| Statistics |:white_check_mark:| Statistics available in the admin database (`pgcat` and `pgbouncer`) with `SHOW STATS`, `SHOW POOLS` and others. |
|`database`| The name of the database to connect to. This is the same on all servers that are part of one shard. ||
64
64
||||
65
65
|**`query_router`**|||
66
-
|`default_role`| Traffic is routed to this role by default (round-robin), unless the client specifies otherwise. Default is `any`, for any role available. |`any`, `primary`, `replica`|
66
+
|`default_role`| Traffic is routed to this role by default (random), unless the client specifies otherwise. Default is `any`, for any role available. |`any`, `primary`, `replica`|
67
67
|`query_parser_enabled`| Enable the query parser which will inspect incoming queries and route them to a primary or replicas. |`false`|
68
68
|`primary_reads_enabled`| Enable this to allow read queries on the primary; otherwise read queries are routed to the replicas. |`true`|
69
69
@@ -112,7 +112,7 @@ In transaction mode, a client talks to one server for the duration of a single t
112
112
This mode is enabled by default.
113
113
114
114
### Load balancing of read queries
115
-
All queries are load balanced against the configured servers using the round-robin algorithm. The most straight forward configuration example would be to put this pooler in front of several replicas and let it load balance all queries.
115
+
All queries are load balanced against the configured servers using the random algorithm. The most straight forward configuration example would be to put this pooler in front of several replicas and let it load balance all queries.
116
116
117
117
If the configuration includes a primary and replicas, the queries can be separated with the built-in query parser. The query parser will interpret the query and route all `SELECT` queries to a replica, while all other queries including explicit transactions will be routed to the primary.
118
118
@@ -151,18 +151,18 @@ Failover behavior can get pretty interesting (read complex) when multiple config
151
151
152
152
|**Query**|**`SET SERVER ROLE TO`**|**`query_parser_enabled`**|**`primary_reads_enabled`**|**Target state**|**Outcome**|
| Read query, i.e. `SELECT`| unset (any) | false | false | up | Query is routed to the first instance in the round-robin loop. |
155
-
| Read query | unset (any) | true | false | up | Query is routed to the first replica instance in the round-robin loop. |
156
-
| Read query | unset (any) | true | true | up | Query is routed to the first instance in the round-robin loop. |
157
-
| Read query | replica | false | false | up | Query is routed to the first replica instance in the round-robin loop. |
154
+
| Read query, i.e. `SELECT`| unset (any) | false | false | up | Query is routed to the first instance in the random loop. |
155
+
| Read query | unset (any) | true | false | up | Query is routed to the first replica instance in the random loop. |
156
+
| Read query | unset (any) | true | true | up | Query is routed to the first instance in the random loop. |
157
+
| Read query | replica | false | false | up | Query is routed to the first replica instance in the random loop. |
158
158
| Read query | primary | false | false | up | Query is routed to the primary. |
159
-
| Read query | unset (any) | false | false | down | First instance is banned for reads. Next target in the round-robin loop is attempted. |
160
-
| Read query | unset (any) | true | false | down | First replica instance is banned. Next replica instance is attempted in the round-robin loop. |
161
-
| Read query | unset (any) | true | true | down | First instance (even if primary) is banned for reads. Next instance is attempted in the round-robin loop. |
162
-
| Read query | replica | false | false | down | First replica instance is banned. Next replica instance is attempted in the round-robin loop. |
159
+
| Read query | unset (any) | false | false | down | First instance is banned for reads. Next target in the random loop is attempted. |
160
+
| Read query | unset (any) | true | false | down | First replica instance is banned. Next replica instance is attempted in the random loop. |
161
+
| Read query | unset (any) | true | true | down | First instance (even if primary) is banned for reads. Next instance is attempted in the random loop. |
162
+
| Read query | replica | false | false | down | First replica instance is banned. Next replica instance is attempted in the random loop. |
163
163
| Read query | primary | false | false | down | The query is attempted against the primary and fails. The client receives an error. |
164
164
|||||||
165
-
| Write query e.g. `INSERT`| unset (any) | false | false | up | The query is attempted against the first available instance in the round-robin loop. If the instance is a replica, the query fails and the client receives an error. |
165
+
| Write query e.g. `INSERT`| unset (any) | false | false | up | The query is attempted against the first available instance in the random loop. If the instance is a replica, the query fails and the client receives an error. |
166
166
| Write query | unset (any) | true | false | up | The query is routed to the primary. |
167
167
| Write query | unset (any) | true | true | up | The query is routed to the primary. |
168
168
| Write query | primary | false | false | up | The query is routed to the primary. |
0 commit comments