@@ -760,9 +760,12 @@ The default value is 4.
760
760
761
761
This property may be overridden when [ creating a connection pool] ( #createpool ) .
762
762
763
- If you increase this value, you should increase the number of threads
763
+ See [ Connections and Number of Threads] ( #numberofthreads ) for why you
764
+ should not increase this value beyond 128. Importantly, if you
765
+ increase ` poolMax ` you should also increase the number of threads
764
766
available to node-oracledb.
765
- See [ Connections and Number of Threads] ( #numberofthreads ) .
767
+
768
+ See [ Connection Pooling] ( #connpooling ) for other pool sizing guidelines.
766
769
767
770
##### Example
768
771
@@ -2682,17 +2685,22 @@ oracledb.getConnection(
2682
2685
2683
2686
If you open more than four connections, such as via
2684
2687
increasing [` poolMax` ](#proppoolpoolmax), you should increase the
2685
- number of threads available to node-oracledb.
2688
+ number of worker threads available to node-oracledb.
2689
+
2690
+ The thread pool size should be at least equal to the maxiumum number
2691
+ of connections. If the application does database and non-database
2692
+ work concurrently, extra threads could also be required for optimal
2693
+ throughput.
2686
2694
2687
- Node.js worker threads executing database statements on a connection will
2688
- commonly wait until round-trips between node-oracledb and the database
2689
- are complete. When an application handles a sustained number of user
2690
- requests, and database operations take some time to execute or the
2691
- network is slow, then the four default threads may all be held in
2695
+ Node.js worker threads executing database statements on a connection
2696
+ will commonly wait until round-trips between node-oracledb and the
2697
+ database are complete. When an application handles a sustained number
2698
+ of user requests, and database operations take some time to execute or
2699
+ the network is slow, then the four default threads may all be held in
2692
2700
use. This prevents other connections from beginning work and stops
2693
2701
Node.js from handling more user load. Increasing the number of worker
2694
- threads may improve throughput. Do this by setting the environment
2695
- variable
2702
+ threads may improve throughput and prevent [deadlocks](https://github.com/oracle/node-oracledb/issues/603#issuecomment-277017313). Do this by
2703
+ setting the environment variable
2696
2704
[UV_THREADPOOL_SIZE](http://docs.libuv.org/en/v1.x/threadpool.html)
2697
2705
before starting Node.
2698
2706
@@ -2703,13 +2711,15 @@ can be increased to 10 by using the following command:
2703
2711
$ UV_THREADPOOL_SIZE = 10 node myapp .js
2704
2712
` ` `
2705
2713
2706
- The thread pool size should be at least equal to the maxiumum number
2707
- of connections. If the application does database and non-database
2708
- work concurrently, extra threads could also be required for optimal
2709
- throughput .
2714
+ If the value is set inside the application with
2715
+ ` process . env . UV_THREADPOOL_SIZE ` ensure it is set prior to any
2716
+ asynchronous call that uses the thread pool otherwise the default size
2717
+ of 4 will be used .
2710
2718
2711
2719
Note the '[libuv](https://github.com/libuv/libuv)' library used by
2712
- Node.js limits the number of threads to 128.
2720
+ Node.js limits the number of threads to 128. This implies the
2721
+ maxiumum number of connections opened, i.e. ` poolMax` , should be less
2722
+ than 128.
2713
2723
2714
2724
### <a name="connpooling"></a> 8.3 Connection Pooling
2715
2725
@@ -3035,7 +3045,7 @@ One related environment variable is is shown by `_logStats()`:
3035
3045
3036
3046
Environment Variable | Description
3037
3047
-----------------------------------------------------|-------------
3038
- [` process .env .UV_THREADPOOL_SIZE ` ](#numberofthreads) | The number of worker threads for this process.
3048
+ [` process .env .UV_THREADPOOL_SIZE ` ](#numberofthreads) | The number of worker threads for this process. Note, if this variable is set after the thread pool starts it will be ignored and the thread pool will still be restricted to the default size of 4.
3039
3049
3040
3050
#### <a name="connpoolpinging"></a> 8.3.4 Connection Pool Pinging
3041
3051
0 commit comments