Skip to content

Feature Idea : Support Read Replicas #3593

@Shaik-Sirajuddin

Description

@Shaik-Sirajuddin

node-postgres handles connection pooling seemlessly with a single cluster
Although it doesn't have support for multi cluster connection management
This will be useful in production deployments having multiple read replicas with a single master cluster used with write operations

Idea :
Allow a list of read clusters to be specified with pg-pool
with pg-pool handling connection management with multi-clusters automatically

Implementation Approach :
pg-pool has a constructor accepting a list of endpoints for read replicas , primary cluster ( used with write )

Internally A MultiClient Pool Manager will maintain the list of clients with public methods for picking a client for read or write
Client Pick Strategy For Read :
MultiClientPool will pick a cluster which has an idle connection if available , else it will resolve to creating a new connection by picking the one with min active connections

pg-pool has connect , query methods used by end clients , clients can have an option to specify an operation as read or write
Ex : through a parameter isWrite ,
pg-pool passes the parameter to MultiClientPool to pick a cluster

Alternative Approach to read-write detection

  1. Implement a parser to auto identify a query as read or write

For Projects
It simplifies scaling read heavy workloads through usage of multi clusters

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions