Skip to main content
Convoy supports read replicas to improve the scalability and efficiency of database read operations. This feature allows you to specify additional database instances that will be used for read operations, while the primary database instance handles write operations.

Architecture

Convoy Read Replicas Architecture
With read replicas configured, Convoy distributes read queries across the replicas, improving scalability. Write operations remain dedicated to the primary database.
Note:
  • The read replica functionality is available only for licensed users.
  • This feature is currently in beta and disabled by default. To enable it, use the environment variable CONVOY_ENABLE_FEATURE_FLAG=read-replicas or the CLI flag --enable-feature-flag=read-replicas.
Ensure replicas are synchronized with the primary database and configured for read-only access.

Configuring Read Replicas

JSON Configuration

You can configure read replicas by adding the read_replicas object to your database configuration JSON. Each read replica should be an object with the following keys:
using read replicas via JSON configuration

CLI Configuration

Alternatively, you can use the read-replicas-dsn configuration option to provide a list of connection strings. Each connection string should follow the format: <dbms>://<username>:<password>@<host>:<port>/<database> Here’s what each field represents: For example:
using read replicas via CLI
This will configure Convoy to use the specified read replicas for database read operations.
Important: Make sure the connection strings are formatted correctly, including the database name, username, password, host, and port.