@@ -1682,6 +1682,13 @@ request exceeds the number of currently open connections.
1682
1682
1683
1683
The default value is 1.
1684
1684
1685
+ With fixed-sized [homogeneous](#createpoolpoolattrshomogeneous) pools (where
1686
+ `poolMin` equals `poolMax`), and using Oracle Client 18c (or later), you may
1687
+ wish to evaluate setting `poolIncrement` greater than 0. This can expedite
1688
+ regrowth when the number of [connections established](#proppoolconnectionsopen)
1689
+ has become lower than `poolMin`, for example if network issues have caused
1690
+ connections to become unusable and they have been dropped from the pool.
1691
+
1685
1692
This property may be overridden when [creating a connection pool](#createpool).
1686
1693
1687
1694
##### Example
@@ -5665,16 +5672,21 @@ readonly Number connectionsInUse
5665
5672
5666
5673
The number of currently active connections in the connection pool
5667
5674
i.e. the number of connections currently "checked out" using
5668
- `getConnection()`.
5675
+ `pool. getConnection()`.
5669
5676
5670
5677
#### <a name="proppoolconnectionsopen"></a> 8.1.2 `pool.connectionsOpen`
5671
5678
5672
5679
```
5673
5680
readonly Number connectionsOpen
5674
5681
```
5675
5682
5676
- The number of currently open connections in the underlying connection
5677
- pool.
5683
+ The current number of connections in the pool that are connected through to the
5684
+ database. This number is the sum of connections in use by the application, and
5685
+ connections idle in the pool.
5686
+
5687
+ It may be less than `poolMin` if connections have been dropped, for example
5688
+ with `await connection.close({drop: true})`, or if network problems have caused
5689
+ connections to become unusable.
5678
5690
5679
5691
#### <a name="proppoolenablestatistics"></a> 8.1.3 `pool.enableStatistics`
5680
5692
@@ -8998,14 +9010,20 @@ See [webapp.js][189] for a runnable example.
8998
9010
8999
9011
#### <a name="conpoolsizing"></a> 15.3.1 Connection Pool Sizing
9000
9012
9001
- The characteristics of a connection pool are determined by its attributes
9013
+ The main characteristics of a connection pool are determined by its attributes
9002
9014
[`poolMin`](#proppoolpoolmin), [`poolMax`](#proppoolpoolmax),
9003
9015
[`poolIncrement`](#proppoolpoolincrement), and
9004
9016
[`poolTimeout`](#proppoolpooltimeout).
9005
9017
9006
- Importantly, if you increase the size of the pool, you must increase the number
9007
- of threads used by Node.js before Node.js starts its threadpool. See
9008
- [Connections, Threads, and Parallelism](#numberofthreads).
9018
+ **Importantly, if you increase the size of the pool, you must increase the number
9019
+ of threads used by Node.js before Node.js starts its thread pool. See
9020
+ [Connections, Threads, and Parallelism](#numberofthreads)**.
9021
+
9022
+ Setting `poolMin` causes the specified number of connections to be established
9023
+ to the database during pool creation. This allows subsequent
9024
+ `pool.getConnection()` calls to return quickly for an initial set of users. An
9025
+ appropriate `poolMax` value avoids overloading the database by limiting the
9026
+ maximum number of connections ever opened.
9009
9027
9010
9028
Pool expansion happens when the following are all true: (i)
9011
9029
[`pool.getConnection()`](#getconnectionpool) is called and (ii) all the
@@ -9015,9 +9033,9 @@ number of those connections is less than the pool's `poolMax` setting.
9015
9033
9016
9034
Pool shrinkage happens when the application returns connections to the pool,
9017
9035
and they are then unused for more than [`poolTimeout`](#propdbpooltimeout)
9018
- seconds. Any excess connections above `poolMin` will then be closed. Prior to
9036
+ seconds. Any excess connections above `poolMin` will be closed. Prior to
9019
9037
using Oracle Client 21, this pool shrinkage was only initiated when the pool
9020
- was accessed.
9038
+ was later accessed.
9021
9039
9022
9040
For pools created with [External Authentication](#extauth), with
9023
9041
[`homogeneous`](#createpoolpoolattrshomogeneous) set to *false*, or when using
@@ -9029,17 +9047,16 @@ number of open connections exceeds `poolMin` then the number of open
9029
9047
connections does not fall below `poolMin`.
9030
9048
9031
9049
The Oracle Real-World Performance Group's recommendation is to use fixed size
9032
- connection pools. The values of `poolMin` and `poolMax` should be the same (and
9033
- `poolIncrement` equal to zero). This avoids connection storms which can
9034
- decrease throughput. See [Guideline for Preventing Connection Storms: Use
9035
- Static Pools][23], which contains more details about sizing of pools. Having a
9036
- fixed size will guarantee that the database can handle the upper pool size. For
9037
- example, if a pool needs to grow but the database resources are limited, then
9038
- `pool.getConnection()` may return errors such as *ORA-28547*. With a fixed pool
9039
- size, this class of error will occur when the pool is created, allowing you to
9040
- change the size before users access the application. With a dynamically growing
9041
- pool, the error may occur much later after the pool has been in use for some
9042
- time.
9050
+ connection pools. The values of `poolMin` and `poolMax` should be the same.
9051
+ This avoids connection storms which can decrease throughput. See [Guideline
9052
+ for Preventing Connection Storms: Use Static Pools][23], which contains more
9053
+ details about sizing of pools. Having a fixed size will guarantee that the
9054
+ database can handle the upper pool size. For example, if a pool needs to grow
9055
+ but the database resources are limited, then `pool.getConnection()` may return
9056
+ errors such as *ORA-28547*. With a fixed pool size, this class of error will
9057
+ occur when the pool is created, allowing you to change the size before users
9058
+ access the application. With a dynamically growing pool, the error may occur
9059
+ much later after the pool has been in use for some time.
9043
9060
9044
9061
The Real-World Performance Group also recommends keeping pool sizes small, as
9045
9062
this may perform better than larger pools. Use
@@ -9048,6 +9065,20 @@ this may perform better than larger pools. Use
9048
9065
attributes should be adjusted to handle the desired workload within the bounds
9049
9066
of resources available to Node.js and the database.
9050
9067
9068
+ When the values of `poolMin` and `poolMax` are the same, and you are using
9069
+ Oracle Client 18c (or later), then `poolIncrement` can be set greater than
9070
+ zero. This changes how a [homogeneous pool](#createpoolpoolattrshomogeneous)
9071
+ grows when the number of [connections established](#proppoolconnectionsopen)
9072
+ has become lower than `poolMin`, for example if network issues have caused
9073
+ connections to become unusable and they have been dropped from the pool.
9074
+ Setting `poolIncrement` greater than 1 in this scenario means the next
9075
+ `pool.getConnection()` call that needs to grow the pool will initiate the
9076
+ creation of multiple connections. That `pool.getConnection()` call will not
9077
+ return until the extra connections have been created, so there is an initial
9078
+ time cost. However it can allow subsequent connection requests to be
9079
+ immediately satisfied. In this growth scenario, a `poolIncrement` of 0 is
9080
+ treated as 1.
9081
+
9051
9082
Make sure any firewall, [resource manager][101] or user profile
9052
9083
[`IDLE_TIME`][100] does not expire idle connections, since this will require
9053
9084
connections to be recreated which will impact performance and scalability. See
0 commit comments