Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Is it possible to schedule read pools /read only nodes creation/deletion (scale) in AlloyDB?

Let's say I have 4 read pools, I see that usage is less during off hours, is it possible to stop/remove 2 read pools and add again during business hours. 

Also, does Primary and read pools have same IP? 

I mean how to direct traffic to read pools , is there load balancer internally for all read pools/read only nodes?

0 1 482
1 REPLY 1

Currently, AlloyDB does not have an autoscaling feature, and there isn't a direct option to schedule the creation or deletion of read pools (read-only nodes) based on usage. However, you might be able to use Cloud Scheduler and Cloud Functions to automate the process of adding or removing read pools during specific times. This would require using the AlloyDB API or gcloud CLI commands to manage the read pools programmatically.

Important Considerations:

  • Node Limit: AlloyDB has a limit of 20 total nodes (including primary and read replicas) per cluster. Be sure to account for this limit when scaling read pools to avoid reaching the maximum allowed nodes.
  • Connection Handling: Deleting a read pool will terminate any existing connections to it. Ensure your application is designed to gracefully handle such disconnections, perhaps by implementing retries or alternative read routes to other available read pools.

IP Address for Primary and Read Pools: Primary and read pools in AlloyDB do not share the same IP address. Each read pool (or read replica) has its own distinct IP address. This separation allows you to direct traffic specifically to the primary instance or to one of the read pools.

Directing Traffic to Read Pools: Traffic is directed to read pools by using the individual IP addresses of each read pool. AlloyDB does not provide a built-in load balancer specifically for read pools. If you want to distribute read traffic across multiple read pools, you would need to implement a load-balancing mechanism externally. Options include using a proxy like PgBouncer, or configuring your application to distribute read queries among the available read pools. This setup allows you to control how queries are routed, ensuring that reads are directed to the read pools and not the primary instance.