Tim
Tim

Reputation: 2285

do I need to worry about mysql connection pooling for node.js using sequelize?

I'm new to node.js and have heard of connection pooling and it makes sense to me as the connection is an expensive operation.

I am looking at which node module to use for mysql and I like the look of Sequelize as it is an ORM.

I'm not sure if I need to worry about connection pooling with Sequelize. Do I just instantiate it and reuse it for all clients?

var sequelize = new Sequelize('database', 'username'[, 'password'])

Also, do I need to worry about the number of parallel queries being executed?

For example, if I am looping through a table and executing a query per row. What happens if there are 1000 or more rows?

Do those queries get executed all at once?

If so, is there a limit to the amount you can throw at it?

Upvotes: 3

Views: 3185

Answers (1)

sdepold
sdepold

Reputation: 6241

at the very moment Sequelize is not using pooling. This caused many problems in the past, so it was removed. I will add pooling again in later versions of Sequelize. At the moment, every request opens a new connection. There is also a known bug, which leads to unclosed connections. Due to heavy enhancements in the next version, this will hopefully be fixed. I will also change from the currently used node-mysql to another mysql connector, which is much faster. Once this is done, I try to add pooling again.

Upvotes: 5

Related Questions