Connection pools have nothing to do with async vs sync - it just works like this:
- You can specify the number of open connections to support your database (say, 10).
- Every time your Node JS code makes a request, if possible, it will use one of the 10 open connections for this request so you can avoid the overhead of opening a new database connection for each request.
Maintaining a connection pool essentially supports an array of db connection objects and a selection of unused for each request. It actually does not execute threads or processes at all =)
rdegges
source share