Skip to content

Commit de09daa

Browse files
committed
Move threadpool sizing doc to a generic section
1 parent f49a26f commit de09daa

File tree

1 file changed

+40
-39
lines changed

1 file changed

+40
-39
lines changed

doc/api.md

Lines changed: 40 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,12 @@ limitations under the License.
120120
- 8.1.1 [Easy Connect Syntax for Connection Strings](#easyconnect)
121121
- 8.1.2 [Net Service Names for Connection Strings](#tnsnames)
122122
- 8.1.3 [JDBC and Node-oracledb Connection Strings Compared](#notjdbc)
123-
- 8.2 [Connection Pooling](#connpooling)
124-
- 8.2.1 [Connection Pool Size and Number of Threads](#conpoolthreadpoolsize)
125-
- 8.2.2 [Connection Pool Queue](#connpoolqueue)
126-
- 8.2.3 [Connection Pool Monitoring and Throughput](#connpoolmonitor)
127-
- 8.3 [Database Resident Connection Pooling (DRCP)](#drcp)
128-
- 8.4 [External Authentication](#extauth)
123+
- 8.2 [Connections and Number of Threads](#numberofthreads)
124+
- 8.3 [Connection Pooling](#connpooling)
125+
- 8.3.1 [Connection Pool Queue](#connpoolqueue)
126+
- 8.3.2 [Connection Pool Monitoring and Throughput](#connpoolmonitor)
127+
- 8.4 [Database Resident Connection Pooling (DRCP)](#drcp)
128+
- 8.5 [External Authentication](#extauth)
129129
9. [SQL Execution](#sqlexecution)
130130
- 9.1 [SELECT Statements](#select)
131131
- 9.1.1 [Fetching Rows](#fetchingrows)
@@ -679,7 +679,7 @@ This property may be overridden when [creating a connection pool](#createpool).
679679

680680
If you increase this value, you may want to increase the number of
681681
threads available to node-oracledb. See
682-
[Connection Pool Size and Number of Threads](#conpoolthreadpoolsize).
682+
[Connections and Number of Threads](#numberofthreads).
683683

684684
##### Example
685685

@@ -2266,7 +2266,32 @@ oracledb.getConnection(
22662266
. . .
22672267
```
22682268
2269-
### <a name="connpooling"></a> 8.2 Connection Pooling
2269+
### <a name="numberofthreads"></a> 8.2 Connections and Number of Threads
2270+
2271+
If you use a large number of connections, such as via increasing
2272+
[`poolMax`](#proppoolpoolmax), you may want to also increase the
2273+
number of threads available to node-oracledb.
2274+
2275+
Node worker threads executing database statements on a connection will
2276+
commonly wait until round-trips between node-oracledb and the database
2277+
are complete. When an application handles a sustained number of user
2278+
requests, and database operations take some time to execute or the
2279+
network is slow, then the four default threads may all be held in
2280+
use. This prevents other connections from beginning work and stops
2281+
Node from handling more user load. Increasing the number of worker
2282+
threads may improve throughput. Do this by setting the environment
2283+
variable
2284+
[UV_THREADPOOL_SIZE](http://docs.libuv.org/en/v1.x/threadpool.html)
2285+
before starting Node.
2286+
2287+
For example, in a Linux terminal, the number of Node worker threads
2288+
can be increased to 10 by using the following command:
2289+
2290+
```
2291+
$ UV_THREADPOOL_SIZE=10 node myapp.js
2292+
```
2293+
2294+
### <a name="connpooling"></a> 8.3 Connection Pooling
22702295
22712296
When applications use a lot of connections for short periods, Oracle
22722297
recommends using a connection pool for efficiency. Each node-oracledb
@@ -2328,31 +2353,7 @@ The Pool attribute [`stmtCacheSize`](#propconnstmtcachesize) can be
23282353
used to set the statement cache size used by connections in the pool,
23292354
see [Statement Caching](#stmtcache).
23302355
2331-
#### <a name="conpoolthreadpoolsize"></a> 8.2.1 Connection Pool Size and Number of Threads
2332-
2333-
If you increase [`poolMax`](#proppoolpoolmax), you may want to
2334-
also increase the number of threads available to node-oracledb.
2335-
2336-
Node worker threads executing database statements on a connection will
2337-
commonly wait until round-trips between node-oracledb and the database
2338-
are complete. When an application handles a sustained number of user
2339-
requests, and database operations take some time to execute or the
2340-
network is slow, then the four default threads may all be held in
2341-
use. This prevents other connections from beginning work and stops
2342-
Node from handling more user load. Increasing the number of worker
2343-
threads may improve throughput. Do this by setting the environment
2344-
variable
2345-
[UV_THREADPOOL_SIZE](http://docs.libuv.org/en/v1.x/threadpool.html)
2346-
before starting Node.
2347-
2348-
For example, in a Linux terminal, the number of Node worker threads
2349-
can be increased to 10 by using the following command:
2350-
2351-
```
2352-
$ UV_THREADPOOL_SIZE=10 node myapp.js
2353-
```
2354-
2355-
#### <a name="connpoolqueue"></a> 8.2.2 Connection Pool Queue
2356+
#### <a name="connpoolqueue"></a> 8.3.1 Connection Pool Queue
23562357
23572358
By default when `poolMax` has been reached (meaning all connections in
23582359
a pool are in use), and more
@@ -2379,7 +2380,7 @@ connection is [released](#connectionclose), and the number of
23792380
connections in use drops below the value of
23802381
[`poolMax`](#proppoolpoolmax).
23812382
2382-
#### <a name="connpoolmonitor"></a> 8.2.3 Connection Pool Monitoring and Throughput
2383+
#### <a name="connpoolmonitor"></a> 8.3.2 Connection Pool Monitoring and Throughput
23832384
23842385
Connection pool usage should be monitored to choose the appropriate
23852386
connection pool settings for your workload.
@@ -2465,11 +2466,11 @@ Attribute |
24652466
24662467
One related environment variable is is shown by `_logStats()`:
24672468
2468-
Environment Variable | Description
2469-
-----------------------------------------------------------|-------------
2470-
[`process.env.UV_THREADPOOL_SIZE`](#conpoolthreadpoolsize) | The number of worker threads for this process.
2469+
Environment Variable | Description
2470+
-----------------------------------------------------|-------------
2471+
[`process.env.UV_THREADPOOL_SIZE`](#numberofthreads) | The number of worker threads for this process.
24712472
2472-
### <a name="drcp"></a> 8.3 Database Resident Connection Pooling (DRCP)
2473+
### <a name="drcp"></a> 8.4 Database Resident Connection Pooling (DRCP)
24732474
24742475
[Database Resident Connection Pooling](http://docs.oracle.com/database/121/ADFNS/adfns_perf_scale.htm#ADFNS228) (DRCP)
24752476
enables database resource sharing for applications that run in
@@ -2510,7 +2511,7 @@ Oracle white paper
25102511
[PHP Scalability and High Availability](http://www.oracle.com/technetwork/topics/php/php-scalability-ha-twp-128842.pdf).
25112512
This paper also gives more detail on configuring DRCP.
25122513
2513-
### <a name="extauth"></a> 8.4 External Authentication
2514+
### <a name="extauth"></a> 8.5 External Authentication
25142515
25152516
External Authentication allows applications to use an external
25162517
password store (such as

0 commit comments

Comments
 (0)