Reputation: 345
I am writing a small Web app with node.js + MySQL and wondering which is a better choice for connection pooling. So far I discovered two options: connection pooling from node-mysql (https://github.com/felixge/node-mysql#pooling-connections) as well as node-mysql+generic-pool (https://github.com/coopernurse/node-pool). Both seem to serve the same purpose and I am just wondering if you happen to have experience with both, which one did you choose and why?
Upvotes: 3
Views: 4107
Reputation: 6483
Well, it depends on how much control You need. Few months ago I've been using generic-pool+node-mysql, because I've struggled with some issues when using mysql-pool, but now it seems to work fine. Anyway if You need control over one of these:
One advantage (it could be disadvantage also) with node-mysql pool is that you can get error callback when limit of maximum number of connections is reached. This should be useful when You deal with server overload and it's better to tell the client that the system is down(than let him wait – please correct me if generic-pool supports acquire timeout, couldn't find it anywhere). And also there's less of coding :).
Upvotes: 3