Introduction to Chapter 4
Application Resilience & Robustness
Connection pooling is all about reusing database connections. Because creating a database connection is time-consuming, it will be better to create several connections ahead.
In MongoDB, 100 connctions will be created by default.
- Connection pools allow for reuse of connections
- Subsequent requests appear faster to the client
- Default size of 100(seems large)
New operations can be serviced with pre-existing connections, so a new connection doesn’t have to be created each time. A large influx of operations can be handled more quickly with a pool of existing connections.
Robust Client Configuration
- Always using connection pooling.
- Always specify a
wtimeoutwith majority writes.
- Always configure for and handle
When should you set a wtimeout?
When our application is using a Write Concern more durable than w: 1.