Skip to content

Commit 2dde239

Browse files
committed
docs(connection-pooling): Restructure. Put general info up top
1 parent f113504 commit 2dde239

File tree

2 files changed

+36
-21
lines changed

2 files changed

+36
-21
lines changed

docs/docs/connection-pooling.md

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,20 @@ description: Scale your serverless functions
1414
1515
Production Cedar apps should enable connection pooling in order to properly scale with your Serverless functions.
1616

17-
## Prisma Postgres
17+
## Why Connection Pooling?
18+
19+
Relational databases have a maximum number of concurrent client connections.
20+
21+
- Postgres allows 100 by default
22+
- MySQL allows 151 by default
23+
24+
In a traditional server environment, you would need a large amount of traffic (and therefore web servers) to exhaust these connections, since each web server instance typically leverages a single connection.
25+
26+
In a Serverless environment, each function connects directly to the database, which can exhaust limits quickly. To prevent connection errors, you should add a connection pooling service in front of your database. Think of it as a load balancer.
27+
28+
## Prisma
29+
30+
### Prisma Postgres
1831

1932
[Prisma Postgres](https://www.prisma.io/docs/postgres/introduction/overview?utm_source=cedarjs_docs&utm_medium=docs) is a managed PostgreSQL database service that includes:
2033

@@ -27,7 +40,7 @@ Prisma Postgres supports schema migrations and queries via Prisma ORM, and autom
2740

2841
To get started with Prisma Postgres, visit the [Prisma Postgres documentation](https://www.prisma.io/docs/postgres/introduction/overview?utm_source=cedarjs_docs&utm_medium=docs).
2942

30-
### Local Prisma Postgres
43+
#### Local Prisma Postgres
3144

3245
For local development, you can use [local Prisma Postgres](https://www.prisma.io/docs/postgres/database/local-development?utm_source=cedarjs_docs&utm_medium=docs) which runs a PostgreSQL-compatible database locally. This eliminates the need to install and manage PostgreSQL locally while maintaining full compatibility with production PostgreSQL databases.
3346

@@ -62,7 +75,7 @@ DATABASE_URL="postgresql://localhost:54322/main"
6275

6376
Keep the server running while performing migrations and using the database for local development.
6477

65-
### Temporary Prisma Postgres database
78+
#### Temporary Prisma Postgres database
6679

6780
For quick testing or prototyping, [Prisma Postgres](https://www.prisma.io/postgres) offers temporary production-ready databases that also requires no setup or accounts. Use [`npx create-db`](https://www.prisma.io/docs/postgres/introduction/npx-create-db?utm_source=cedarjs_docs&utm_medium=docs) to create a database that's automatically deleted after 24 hours:
6881

@@ -72,7 +85,7 @@ npx create-db@latest
7285

7386
This provides both Prisma ORM-optimized and standard PostgreSQL connection strings. You can also claim the database to make it permanent if needed.
7487

75-
## Prisma ORM & Prisma Accelerate
88+
### Prisma ORM & Prisma Accelerate
7689

7790
If you're already using another database provider (like Supabase, Heroku, Digital Ocean, or AWS RDS), you can add connection pooling and caching to your existing setup using [Prisma Accelerate](https://www.prisma.io/docs/accelerate).
7891

@@ -86,7 +99,7 @@ Prisma Accelerate is a fully managed global connection pool and caching layer th
8699

87100
To enable Prisma Accelerate with your existing database, visit the [Prisma Accelerate documentation](https://www.prisma.io/docs/accelerate).
88101

89-
## Prisma & PgBouncer
102+
### Prisma & PgBouncer
90103

91104
PgBouncer holds a connection pool to the database and proxies incoming client connections by sitting between Prisma Client and the database. This reduces the number of processes a database has to handle at any given time. PgBouncer passes on a limited number of connections to the database and queues additional connections for delivery when space becomes available.
92105

docs/versioned_docs/version-0.11/connection-pooling.md

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,20 @@ description: Scale your serverless functions
1414
1515
Production Cedar apps should enable connection pooling in order to properly scale with your Serverless functions.
1616

17-
## Prisma Postgres
17+
## Why Connection Pooling?
18+
19+
Relational databases have a maximum number of concurrent client connections.
20+
21+
- Postgres allows 100 by default
22+
- MySQL allows 151 by default
23+
24+
In a traditional server environment, you would need a large amount of traffic (and therefore web servers) to exhaust these connections, since each web server instance typically leverages a single connection.
25+
26+
In a Serverless environment, each function connects directly to the database, which can exhaust limits quickly. To prevent connection errors, you should add a connection pooling service in front of your database. Think of it as a load balancer.
27+
28+
## Prisma
29+
30+
### Prisma Postgres
1831

1932
[Prisma Postgres](https://www.prisma.io/docs/postgres/introduction/overview?utm_source=cedarjs_docs&utm_medium=docs) is a managed PostgreSQL database service that includes:
2033

@@ -27,7 +40,7 @@ Prisma Postgres supports schema migrations and queries via Prisma ORM, and autom
2740

2841
To get started with Prisma Postgres, visit the [Prisma Postgres documentation](https://www.prisma.io/docs/postgres/introduction/overview?utm_source=cedarjs_docs&utm_medium=docs).
2942

30-
### Local Prisma Postgres
43+
#### Local Prisma Postgres
3144

3245
For local development, you can use [local Prisma Postgres](https://www.prisma.io/docs/postgres/database/local-development?utm_source=cedarjs_docs&utm_medium=docs) which runs a PostgreSQL-compatible database locally. This eliminates the need to install and manage PostgreSQL locally while maintaining full compatibility with production PostgreSQL databases.
3346

@@ -62,7 +75,7 @@ DATABASE_URL="postgresql://localhost:54322/main"
6275

6376
Keep the server running while performing migrations and using the database for local development.
6477

65-
### Temporary Prisma Postgres database
78+
#### Temporary Prisma Postgres database
6679

6780
For quick testing or prototyping, [Prisma Postgres](https://www.prisma.io/postgres) offers temporary production-ready databases that also requires no setup or accounts. Use [`npx create-db`](https://www.prisma.io/docs/postgres/introduction/npx-create-db?utm_source=cedarjs_docs&utm_medium=docs) to create a database that's automatically deleted after 24 hours:
6881

@@ -72,7 +85,7 @@ npx create-db@latest
7285

7386
This provides both Prisma ORM-optimized and standard PostgreSQL connection strings. You can also claim the database to make it permanent if needed.
7487

75-
## Prisma ORM & Prisma Accelerate
88+
### Prisma ORM & Prisma Accelerate
7689

7790
If you're already using another database provider (like Supabase, Heroku, Digital Ocean, or AWS RDS), you can add connection pooling and caching to your existing setup using [Prisma Accelerate](https://www.prisma.io/docs/accelerate).
7891

@@ -86,7 +99,7 @@ Prisma Accelerate is a fully managed global connection pool and caching layer th
8699

87100
To enable Prisma Accelerate with your existing database, visit the [Prisma Accelerate documentation](https://www.prisma.io/docs/accelerate).
88101

89-
## Prisma & PgBouncer
102+
### Prisma & PgBouncer
90103

91104
PgBouncer holds a connection pool to the database and proxies incoming client connections by sitting between Prisma Client and the database. This reduces the number of processes a database has to handle at any given time. PgBouncer passes on a limited number of connections to the database and queues additional connections for delivery when space becomes available.
92105

@@ -159,14 +172,3 @@ From the [AWS Docs](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/rds-p
159172
> Your RDS Proxy must be in the same VPC as the database. The proxy can't be publicly accessible.
160173
161174
Because of this limitation, with out-of-the-box configuration, you can only use RDS Proxy if you're deploying your Lambda Functions to the same AWS account. Alternatively, you can use RDS directly, but you might require larger instances to handle your production traffic and the number of concurrent connections.
162-
163-
## Why Connection Pooling?
164-
165-
Relational databases have a maximum number of concurrent client connections.
166-
167-
- Postgres allows 100 by default
168-
- MySQL allows 151 by default
169-
170-
In a traditional server environment, you would need a large amount of traffic (and therefore web servers) to exhaust these connections, since each web server instance typically leverages a single connection.
171-
172-
In a Serverless environment, each function connects directly to the database, which can exhaust limits quickly. To prevent connection errors, you should add a connection pooling service in front of your database. Think of it as a load balancer.

0 commit comments

Comments
 (0)