Oracle Magazine, July/August 2018
Database Developer OPEN SOURCE echo export HR_ USER hr bashrc echo export HR_ PASSWORD oracle bashrc echo export HR_ CONNECTSTRING 0000 orcl bashrc source bashrc You may have noticed that the poolMin and poolMax values were the same and that poolIncrement was set to 0 This will create a pool with a fixed size that requires fewer resources to manage a good idea for pools that get consistent usage Although Node js is often described as single threaded it does have a thread pool available for certain operations that would otherwise block the main thread running the JavaScript code This thread pool is used by node oracledb to run all of its asynchronous operations such as getting connections and executing SQL and PL SQL code However the default size of the thread pool is four threads If you want all 10 connections in the pool to be able to work at the same time you must increase the number of threads accordingly The environment variable UV_ THREADPOOL_ SIZE adjusts the size of the thread pool The value of UV_ THREADPOOL_ SIZE can be set before the Node js app runs or from within the app but it must be set before the app makes the first call that uses the thread pool This is because the thread pool is created when its first used and once created its size is fixed Open the index js file in the root of the application and add the following lines after the first line which brings in the web server module line that requires services web server js is here const dbConfig require config database js const defaultThreadPoolSize 4 ORACLE MAGAZINE JULY AUGUST 2018 86
You must have JavaScript enabled to view digital editions.