How to change maximum limit of simultaneous connections to db

Asked

Viewed 234 times

0

When I exceed 100 connections, I get error:

"FATAL:  remaining connection slots are reserved for non-replication superuser connections"

How to change the parameter of postgresql.conf max_connections in Google Cloud SQL?

  • How are you reaching that limit?

  • There are several applications consuming this database. At peak times reaches the limit of 100 connections.

1 answer

0


In the Cloud SQL FAQ, is written:

"There are no limitations of queries per second (QPS) for Google Cloud SQL instances. However, there are limits to the number of connections, size and for applications running on the Google App Engine." (English)

screenshot dos limites para conexões ao Google Cloud SQL So everything indicates that this is a limitation of the type of instance being used - that is, you cannot change it unless you use another type of instance.

It is worth noting that 100 simultaneous connections is not a low number - it is interesting to verify the real need and seek to optimize the use of these connections.

Further down on the page, there is the following text:

How should I manage connections?
"The best way to manage connections will depend on each case but, overall, we recommend using connection pool. Connection pool will protect the database from a huge amount of connections being created too fast, which could impact performance." (English)

So this is already a possible optimization for your application.

Questions that still need to be asked:

  • Why 100+ simultaneous connections are needed?
  • App is correctly closing connections after using them?
  • You are using a pool of connections?
    • There are several applications/systems consuming the bank, and at peak times this limit is exceeded. * I believe so, because who manages the connections is a ORM(Telerik for c#). * No use of connection pool(it is possible to implement pool in SQL Cloud?).
  • @luanfvieira this is already another question - but it is that what do you use? if it is, they talk about pooling Connection here.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.