Prisma Data Proxy ignoring connection limit and pool timeout in serverless environment (AWS + Serverless Framework + Prisma ORM)

huangapple go评论69阅读模式
英文:

Prisma Data Proxy ignoring connection limit and pool timeout in serverless environment (AWS + Serverless Framework + Prisma ORM)

问题

我正在尝试使用特定值的connection_limitpool_timeout Prisma数据代理,但似乎它们被忽略了。

我在AWS RDS中使用PostgreSQL

我的当前连接测试是:

prisma://aws-eu-central-1.prisma-data.com/?connection_limit=5&pool_timeout=120&api_key=<API_KEY>

当发生超时时,我会得到这个错误:

错误是从连接池中获取新连接时超时。更多信息:http://pris.ly/d/connection-pool(当前连接池超时:10,连接限制:3)

正如你所看到的,限制被忽略了(10而不是120,3而不是5)。

我们确实进行了很多测试。有人能帮助我们找出原因吗?

英文:

I'm trying to use connection_limit and pool_timeout Prisma Data proxy with specific values, but it seems to ignore them.

I'm using PostgreSQL in AWS RDS.

My current connection test is:

prisma://aws-eu-central-1.prisma-data.com/?connection_limit=5&pool_timeout=120&api_key=<API_KEY>

When it occurs an timeout, I get this error:

The error is Timed out fetching a new connection from the connection pool. More info: http://pris.ly/d/connection-pool (Current connection pool timeout: 10, connection limit: 3)

As you can see, the limits are ignored (10 instead of 120 and 3 instead of 5).

We really did a lot of tests. Can anyone help us figuring why?

答案1

得分: 0

我们已经联系了Prisma团队,答案如下:

> 在环境创建期间,您需要在数据库连接字符串中设置pool_timeout和connection_limit。
例如:DATABASE_URL=postgresql://aaa:bbb@ccc.us-east-1.rds.amazonaws.com:5432/ddd?connection_limit=10&pool_timeout=100&sslmode=prefer
>
> 然后,Prisma将使用这些设置生成一个连接字符串,用于与Data Proxy一起使用。

我希望这可以解决任何遇到相同问题的人的问题。

英文:

We got in touch with Prisma team and the answer is:

> You would need to set the pool_timeout and the connection_limit in the database connection string during environment creation.
for example: DATABASE_URL=postgresql://aaa:bbb@ccc.us-east-1.rds.amazonaws.com:5432/ddd?connection_limit=10&pool_timeout=100&sslmode=prefer
>
> Prisma would then use that to generate a connection string to use with the Data Proxy.

I hope this could solve the issue to anyone encountering the same problem.

huangapple
  • 本文由 发表于 2023年5月21日 04:01:25
  • 转载请务必保留本文链接:https://go.coder-hub.com/76297120.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定