3

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?

1 Answer 1

5

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.

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks sdepold, what about the parallel queries, does it hammer the db?
Sequelize v3 does have connection pool: github.com/sequelize/sequelize/blob/v3/docs/docs/…
can you please explain how to use pool ? is it necessary ? i cant understand the ussage in docs

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.