Recall & Review
beginner
What is connection pooling in Node.js?
Connection pooling is a technique where a set of database connections are kept open and reused to handle multiple requests, instead of opening and closing a new connection each time.
Click to reveal answer
beginner
Why is connection pooling useful?
It improves performance by reducing the time and resources needed to open and close connections repeatedly. It also helps manage limited database connections efficiently.
Click to reveal answer
intermediate
How does connection pooling affect server response time?
By reusing existing connections, connection pooling reduces the delay caused by establishing new connections, leading to faster server responses.
Click to reveal answer
beginner
Name a common Node.js library that supports connection pooling for databases.
The 'mysql2' and 'pg' libraries support connection pooling for MySQL and PostgreSQL databases respectively.
Click to reveal answer
intermediate
What can happen if a connection pool is too small or too large?
If too small, requests may wait for free connections causing delays. If too large, it can waste resources and overload the database server.
Click to reveal answer
What does connection pooling primarily help with in Node.js applications?
✗ Incorrect
Connection pooling reuses open connections to reduce overhead and improve performance.
Which of these is a risk of having a connection pool that is too small?
✗ Incorrect
A small pool means fewer connections available, so requests wait longer.
Which Node.js library is known for supporting connection pooling with PostgreSQL?
✗ Incorrect
'pg' is a popular PostgreSQL client for Node.js that supports connection pooling.
What happens when a connection pool is too large?
✗ Incorrect
Too many open connections consume resources and can overload the database server.
How does connection pooling improve server response time?
✗ Incorrect
Reusing connections avoids the delay of opening new connections, speeding up responses.
Explain connection pooling and why it is important in Node.js applications.
Think about how opening a new connection each time can slow things down.
You got /4 concepts.
Describe the risks of having a connection pool size that is too small or too large.
Consider what happens if too few or too many connections are open.
You got /4 concepts.