This PR aims to prevent the unavailability of Postgres clients in the client pool for system queries when there is a high load of md_store queries.
The Problem
In postgres_client.js, we access the DB through a single client pool. By default, this pool's max size is 10, and the endpoints' max size is 80.
In systems with a high load and many objects, the number of md_store queries and the time it takes to perform them cause the pool to reach its maximum. As a result, non-md queries are also stuck in the waiting queue, and the entire system may become unresponsive.
The Solution
Maintain two separate pools in postgres_client.js, a default pool and a dedicated md_store pool
If the md_store pool is overused, the default pool is left to handle all other, typically short queries, so the default pool should remain relatively available.
Explain the changes
This PR aims to prevent the unavailability of Postgres clients in the client pool for system queries when there is a high load of md_store queries.
The Problem
postgres_client.js,
we access the DB through a single client pool. By default, this pool's max size is 10, and the endpoints' max size is 80.The Solution
postgres_client.js
, a default pool and a dedicated md_store pool