onOn nodejs with node-mysql, should iI create 1one connection for the service like this:
or 1or for each user like this:
what i'mWhat I'm asking is:
- is the first one faster because the connection is always open and on the second one it needs to create every time a user connects?
- is the first one slower because if many users are asking for queries he only does one at the time, and on the second one each one have his own client and can make multiple connections at the same time?
- is the second one heavier for the node server and for the mysql because it needs to have 1 client for each user?
- is the first one heavier because it never closes the mysql connection, and after some queries may have some memory leaks?
- or should iI create and close a mysql connection for every query?
psPS: the application connected to the node server will have a big number of users,connected connected during a long period of time, but will have a very low number of queries, but the users probably will ask for queries at about the same time.