Balancing load with Odyssey¶
since 1.4.1
Load balancing enables Odyssey to efficiently distribute incoming client queries across multiple PostgreSQL servers. This improves resource utilization, enhances throughput, and ensures high availability in large-scale deployments. With load balancing, Odyssey manages the assignment of connections or requests, helping to prevent any single server from becoming a bottleneck.
Odyssey transparently routes queries to available PostgreSQL backends based on the selected balancing mode, helping to maximize performance and reliability without requiring application-level logic changes.
Configuration¶
You will simply need to specify several hosts in your storage section:
See storage configuration guide for more about storage section.
Host selection¶
Host is selected randomly, but with next priorities:
- Localhost. Localhost endpoints will be tried first.
- Availability zone. If
availability_zoneis set in global section, the endpoints with equals az will be tried second. - Target session attributes. Works if TSA is specified in some way. Endpoints with equals target session attributes will be tried third.
Pool settings¶
The pools in unique per each endpoint in host, so if you set pool_size to 10, you will get 10 pools per each host, and if there is 3 hosts, you will get 30 total connections.