The SPQR Coordinator configuration can be specified in JSON, TOML, or YAML format. The configuration file passing as a parameter to run command:
Refer to the pkg/config/coordinator.go file for the most up-to-date configuration options.
Coordinator Settings
Coordinator Timing Settings
Iteration Timeout
The iteration_timeout setting controls how frequently the coordinator’s watchRouters loop runs to monitor and manage router instances. This is one of the most important performance tuning parameters.
What watchRouters Does
On each iteration, the coordinator:
- Queries QDB for the list of active routers
- Connects to each router via gRPC (using cached connections)
- Calls
GetRouterStatus() to check router health
- Syncs coordinator address and metadata if needed
- Opens/closes routers in QDB based on their status
- Cleans up connections for removed routers
- Sleeps for
iteration_timeout before the next cycle
When using high iteration_timeout values (e.g., 5m+), ensure router_keepalive_time is configured appropriately to prevent cached connections from being closed by network devices. See gRPC Keepalive Settings.
Impact on Operations
- Router Failover: Time to detect and mark failed routers as closed
- Topology Changes: Time to recognize new routers added to the cluster
- Metadata Sync: Frequency of coordinator address updates to routers
- Resource Usage: CPU and network bandwidth for health checks
Start with the default 1s for development. In production, increase to 10s or higher once your topology is stable to reduce overhead.
Lock Iteration Timeout
The lock_iteration_timeout setting controls the retry interval when multiple coordinator instances compete for leadership during startup.
How Coordinator Locking Works
SPQR supports running multiple coordinator instances for high availability, but only one can be active (hold the lock) at a time:
- On startup, each coordinator tries to acquire a distributed lock in QDB (etcd)
- If the lock is already held, the coordinator waits
lock_iteration_timeout
- After the timeout, it tries again
- This continues until it acquires the lock or the process is stopped
In high-availability setups with multiple coordinator instances, a longer lock_iteration_timeout reduces load on QDB/etcd during leadership elections.
gRPC Keepalive Settings
The coordinator maintains persistent gRPC connections to routers using connection caching. To prevent these connections from being closed by network intermediaries (load balancers, firewalls, NAT gateways) during idle periods, gRPC keepalive is configured.
Why Keepalive is Important
Network devices typically close idle TCP connections after 60 seconds to 5 minutes. When iteration_timeout is set to several minutes, cached connections may be closed by the network before they’re reused, causing connection failures and unnecessary reconnection overhead.
Keepalive sends periodic “ping” messages to keep connections alive and detect dead connections early.
If you experience frequent connection errors when iteration_timeout is high, reduce router_keepalive_time to match your network environment’s idle timeout characteristics.
Frontend Rules
Frontend rule is a specification of how clients connect to the admin console.
Refer to the FrontendRule struct in the pkg/config/rules.go file for the most up-to-date configuration options.