Reputation: 1
We're experiencing a steady increase in PGA memory in our Oracle database, and we're trying to identify the root cause. We suspect that the connection pool in our application is not releasing connections back to the database as expected. Here are the details of our configuration and the issue we're facing:
Connection Pool Configuration:
poolMin
: 5poolMax
: 10poolIncrement
: 1poolTimeout
: 10 secondsIssue Description: During periods of traffic, the number of connections increases from 5 (poolMin
) to 10 (poolMax
). However, when the traffic is low, the connections are not being released back to 5 (poolMin
), even after 10 seconds (poolTimeout
) of inactivity.
Reference: According to the node oracledb documentation:
If the application returns connections to the pool with connection.close(), and the connections are then unused for more than poolTimeout seconds, then any excess connections above poolMin will be closed. When using Oracle Client prior to version 21, this pool shrinkage is only initiated when the pool is accessed.
Let me know if you need me to add anything to provide better answers.
What I Tried:
pool.getStatistics()
method to monitor the number of open, in-use, and idle connections in the pool.What I Expected:
poolMin
) to 10 (poolMax
).poolMin
) after 10 seconds (poolTimeout
) of inactivity.What Actually Happened:
poolMin
value)Question: What could be the possible reasons for the connection pool not releasing idle connections back to poolMin when there is not much traffic?
Upvotes: 0
Views: 73
Reputation: 10556
As discussed on Slack you are using Thick mode with Instant Client 19c libraries.
Your scenario is covered in the node-oracledb doc:
When node-oracledb Thick mode is using using Oracle Client 19 or earlier, this pool shrinkage is only initiated when the pool is accessed, so a pool in a completely idle application will not shrink."
This was the original design of Oracle client libraries. It was only in 21c that some threading was introduced and background closure can occur.
Our performance team very strongly advise using a fixed size pool to avoid database load issues, so dynamic pools should not be an issue for most people. Also keep the pool size small.
If you have a very specific use case that want to force close a connection then you can drop it from the connection pool with:
await connection.close({drop: true});
The pool will regrow as needed.
Regarding the PGA, there are various resources around, including the Support note How To Find Where The Memory Is Growing For A Process (Doc ID 822527.1), the user documentation Tuning the Process Global Area, and blogs like Don’t run tight on PGA from one of Oracle's PMs (the take-home point from the latter is to make sure you are on the latest database Release Update).
Upvotes: 0