You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/docs/connection-pooling.md
+18-5Lines changed: 18 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,20 @@ description: Scale your serverless functions
14
14
15
15
Production Cedar apps should enable connection pooling in order to properly scale with your Serverless functions.
16
16
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
18
31
19
32
[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:
20
33
@@ -27,7 +40,7 @@ Prisma Postgres supports schema migrations and queries via Prisma ORM, and autom
27
40
28
41
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).
29
42
30
-
### Local Prisma Postgres
43
+
####Local Prisma Postgres
31
44
32
45
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.
Keep the server running while performing migrations and using the database for local development.
64
77
65
-
### Temporary Prisma Postgres database
78
+
####Temporary Prisma Postgres database
66
79
67
80
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:
68
81
@@ -72,7 +85,7 @@ npx create-db@latest
72
85
73
86
This provides both Prisma ORM-optimized and standard PostgreSQL connection strings. You can also claim the database to make it permanent if needed.
74
87
75
-
## Prisma ORM & Prisma Accelerate
88
+
###Prisma ORM & Prisma Accelerate
76
89
77
90
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).
78
91
@@ -86,7 +99,7 @@ Prisma Accelerate is a fully managed global connection pool and caching layer th
86
99
87
100
To enable Prisma Accelerate with your existing database, visit the [Prisma Accelerate documentation](https://www.prisma.io/docs/accelerate).
88
101
89
-
## Prisma & PgBouncer
102
+
###Prisma & PgBouncer
90
103
91
104
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.
Copy file name to clipboardExpand all lines: docs/versioned_docs/version-0.11/connection-pooling.md
+18-16Lines changed: 18 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,20 @@ description: Scale your serverless functions
14
14
15
15
Production Cedar apps should enable connection pooling in order to properly scale with your Serverless functions.
16
16
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
18
31
19
32
[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:
20
33
@@ -27,7 +40,7 @@ Prisma Postgres supports schema migrations and queries via Prisma ORM, and autom
27
40
28
41
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).
29
42
30
-
### Local Prisma Postgres
43
+
####Local Prisma Postgres
31
44
32
45
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.
Keep the server running while performing migrations and using the database for local development.
64
77
65
-
### Temporary Prisma Postgres database
78
+
####Temporary Prisma Postgres database
66
79
67
80
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:
68
81
@@ -72,7 +85,7 @@ npx create-db@latest
72
85
73
86
This provides both Prisma ORM-optimized and standard PostgreSQL connection strings. You can also claim the database to make it permanent if needed.
74
87
75
-
## Prisma ORM & Prisma Accelerate
88
+
###Prisma ORM & Prisma Accelerate
76
89
77
90
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).
78
91
@@ -86,7 +99,7 @@ Prisma Accelerate is a fully managed global connection pool and caching layer th
86
99
87
100
To enable Prisma Accelerate with your existing database, visit the [Prisma Accelerate documentation](https://www.prisma.io/docs/accelerate).
88
101
89
-
## Prisma & PgBouncer
102
+
###Prisma & PgBouncer
90
103
91
104
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.
92
105
@@ -159,14 +172,3 @@ From the [AWS Docs](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/rds-p
159
172
> Your RDS Proxy must be in the same VPC as the database. The proxy can't be publicly accessible.
160
173
161
174
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