Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 1 addition & 20 deletions node.js/databases.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,26 +51,7 @@ This method is called automatically by the framework on the first query, so **yo

### Pool

Instead of opening and closing a database connection for every request, we use a pool to reuse connections.
By default, the following [pool configuration](https://www.npmjs.com/package/generic-pool) is used:

```json
{
"acquireTimeoutMillis": <if (NODE_ENV='production') 1000 else 10000>,
"evictionRunIntervalMillis": <2 * (idleTimeoutMillis || softIdleTimeoutMillis || 30000)>,
"min": 0,
"max": 100,
"numTestsPerEvictionRun": <(max - min) / 3>,
"softIdleTimeoutMillis": 30000,
"idleTimeoutMillis": 30000,
"testOnBorrow": true,
"fifo": false
}
```

::: warning
This default pool configuration does not apply to `@cap-js` database implementations.
:::
Instead of opening and closing a database connection for every request, we use a [`generic-pool`](https://www.npmjs.com/package/generic-pool)-based pool to reuse connections.

The _generic-pool_ has a built-in pool evictor, which inspects idle database connections in the pool and destroys them if they are too old.

Expand Down
Loading