Feature request: Increase connection limit on Postgres instances to enable Cloud Functions "API server" backed by Postgres

Visto 473 veces
Saltar al primer mensaje no leído

Ismail Khan

no leída,
18 ene 2018, 23:39:2918/1/18
a Google Cloud SQL discuss
I'd like to deploy an API server through Cloud Functions that is backed by Cloud SQL (Postgres). However, for a 3.75 GB instance (the starting size for a prod instance), it looks like I can only get 100 concurrent connections (up to 500 for the max instance size), which means 100 Cloud Functions instances running concurrently.


Is it correct then to say that using Cloud Functions for this purpose is a bad idea? The connection limit won't bother me for a while, but it seems like it's easy to hit the 100 limit...


Is there a plan to raise the limit in the near future? Or a workaround that doesn't involve writing my own server?

Jordan (Cloud Platform Support)

no leída,
19 ene 2018, 15:22:0419/1/18
a Google Cloud SQL discuss
This connection limit is not a Google limitation, but a limit enforced and recommended by MySQL. Optimal query performance and time depends on how busy your server is and how powerful its hardware is. Since the amount of work connections to your server performs cannot be controlled, and there is no QPS limit on your connections, enforcing a limit to the amount of connections is the best way to ensure a level or reliability between connection performance. 

Instead of opening up more connections to your server (in turn making it more busy and slow), it is recommended to create a Connection Pool.  There are many third-party Connection Pool libraries out there that you can use. The general idea is that each of your clients (aka Cloud Functions) will check the connection pool for an available connection. The pool has a limited number of connections (e.g 100), and if they are all used up your client will perform exponential backoff retry (e.g for Cloud Storage) to wait for an available connection. Once a connection becomes free, your client will use the available connection. Once it is done, your client simply returns the connection back into the pool instead of closing it. 

- Note, Google Groups is for general product discussions and not for technical support. If you require further technical support for creating a connection pool it is recommended to post your detailed questions to Stack Overflow using the supported Cloud tags. 


Responder a todos
Responder al autor
Reenviar
0 mensajes nuevos