I'm using the node-mssql package to create an API endpoint in Node.
I am wondering how the package handles connection pooling, as there isn't much explained about it on the package website.
I have the following in my configuration, to allow the pool to go up to 10.
var config = {
server: '',
user: '',
password: '',
database: '',
pool: {
max: 10,
min: 0,
idleTimeoutMillis: 30000
}
}
I've added these lines to each request, so I can see what's going on in the Node console...
// Dump info about connection pool
console.log('SQL Pool - waitingClientsCount: ' + connection.pool.waitingClientsCount())
console.log('SQL Pool - getPoolSize: ' + connection.pool.getPoolSize())
console.log('SQL Pool - availableObjectsCount: ' + connection.pool.availableObjectsCount())
I've navigated to the endpoint in my browser and held refresh for a good few minutes. In the Node console, every output from the above, is like this...
SQL Pool - waitingClientsCount: 0
SQL Pool - getPoolSize: 1
SQL Pool - availableObjectsCount: 0
I was expecting the pool size to increase with all these requests.
Does the pool automatically configure itself based on load, or am I misunderstanding something?
EDIT: The package is using the Tedious driver by the looks of it.