oracle / node-oracledb

Oracle Database driver for Node.js maintained by Oracle Corp.
http://oracle.github.io/node-oracledb/
Other
2.24k stars 1.07k forks source link

Do I need to set the pool size and `UV_THREADPOOL_SIZE` in Thin mode? #1562

Closed cjbj closed 1 year ago

cjbj commented 1 year ago

I have another question about Thin mode. Previously, I was providing both DB_ORACLE_POOL_SIZE and UV_THREADPOOL_SIZE in order to maximize the connections. My understanding is Instant Client would hold a thread until a request finished.

Does it mean, I no longer need to set both DB_ORACLE_POOL_SIZE and UV_THREADPOOL_SIZE in Thin mode, and there are just normal (TCP?) requests that will be handled by libuv directly?

Originally posted by @jameschenjav in https://github.com/oracle/node-oracledb/issues/1554#issuecomment-1567854336

cjbj commented 1 year ago

You do not need to set UV_THREADPOOL_SIZE for Thin mode functionality. The Node.js internal worker threads are only used in Thick mode.

By DB_ORACLE_POOL_SIZE I assume you mean poolMax. You need to size the connection pool for your workload in both modes.

Thin mode apps might need to use smaller pools and instead 'scale out' sooner with a process manager, since the main Node.js thread will do a lot of work in Thin mode that is handled in worker threads in Thick mode. Let us know what you find.

jameschenjav commented 1 year ago

Thanks. That will simplify my CLI app a lot, at least I don't need to worry about setting env vars.

I use DB_ORACLE_POOL_SIZE as poolMax for my CLI tool, and for some reason I thought that's something like ORA_SDTZ in my .env file. btw, I assume ORA_SDTZ is not being used in Thin mode as well?

I haven't tried running node http server in cluster mode. Not sure how is Oracle connection pool working with fork in Thick mode? I think the Thin mode is pretty straightforward on the other hand.

sharadraju commented 1 year ago

ORA_SDTZ is an optional environment variable used to set the session time zone for the environment where your app is run. It is supported in both the Thin and Thick modes.