You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On a multi-instance nodejs server application I am expecting high traffic peaks in which it would be beneficial to have a Connection Pool with many open and free connections waiting for the request bursts to come. By doing that, the requests would be served instantaneously without having the CPU overhead of opening them all of a sudden. In my scenario, the connectionLimit is rather high ( ~400 per node instance ) and opening that big number of connections at once can cause high CPU peaks on the database instance.
On the Pool module https://github.com/felixge/node-mysql/blob/master/lib/Pool.js#L22-L70 I can see the getConnection method which first checks if free/released connections are available and acquires them before creating new ones, but what I am actually interested in is to create a max of connectionLimit number of free connections to be acquired by threads running actual queries on the mentioned high traffic situations.
My approach:
On acorbi@f7e10e1 you can see my approach. In a nutshell, it consists on adding a new function to the Pool module which allows to create those connections (as long as the limit allows it) without checking first if there are free connections available.
After calling getNewConnection method I am releasing the connection by calling connection.release():
Does my approach actually make sense? Would you suggest other alternatives to achieve this warm-up without tweaking the actual node-mysql implementation? In case you "like" this feature, would you suggest any other "more elegant" way of implementing this. Would you be interested in a PR?
Greetings
The text was updated successfully, but these errors were encountered:
Here is my scenario:
On a multi-instance nodejs server application I am expecting high traffic peaks in which it would be beneficial to have a Connection Pool with many open and free connections waiting for the request bursts to come. By doing that, the requests would be served instantaneously without having the CPU overhead of opening them all of a sudden. In my scenario, the connectionLimit is rather high ( ~400 per node instance ) and opening that big number of connections at once can cause high CPU peaks on the database instance.
On the Pool module https://github.com/felixge/node-mysql/blob/master/lib/Pool.js#L22-L70 I can see the getConnection method which first checks if free/released connections are available and acquires them before creating new ones, but what I am actually interested in is to create a max of connectionLimit number of free connections to be acquired by threads running actual queries on the mentioned high traffic situations.
My approach:
On acorbi@f7e10e1 you can see my approach. In a nutshell, it consists on adding a new function to the Pool module which allows to create those connections (as long as the limit allows it) without checking first if there are free connections available.
After calling getNewConnection method I am releasing the connection by calling connection.release():
My questions:
Does my approach actually make sense? Would you suggest other alternatives to achieve this warm-up without tweaking the actual node-mysql implementation? In case you "like" this feature, would you suggest any other "more elegant" way of implementing this. Would you be interested in a PR?
Greetings
The text was updated successfully, but these errors were encountered: