Skip to content

Persistent connection VS connection pool for web applications #2178

@PeppeL-G

Description

@PeppeL-G

I don't know how database connections works internally, but I have a question I haven't been able to find the answer to, so here we go.

It says in the README:

Rather than creating and managing connections one-by-one, this module also provides built-in connection pooling using mysql.createPool(config).

I wonder how/if a web application in Node.js would benefit from using a connection pool instead of a single persistent connection created when the web application starts. Is a connection kind of "blocking" so it can only send one query to the database at a time, so it can't send the next one before it has received back the result for the previous one? Otherwise, what would the benefits be of using a connection pool?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions