Skip to main content

2 posts tagged with "aws lambda"

View All Tags

Challenge of Serverless: Database Connections

Noah Fischer

Noah Fischer

DevRel @upstash

Designing a database for serverless, the biggest challenge in our mind was to build an infrastructure which supports per request pricing in a profitable way. We believe Upstash has achieved this. After we launched the product, we saw that there was another major challenge: Database connections!

As you know, Serverless Functions scale from 0 to infinity. This means when your functions get a lot of traffic, the cloud provider creates new containers (lambda functions) in parallel and scales out your backend. If you create a new database connection within the function then you can rapidly reach the connection limit of your database.

If you try to cache the connection outside the lambda functions then another problem occurs. When AWS freezes your Lambda function, it does not close the connection. So you may end up with many idle/zombie connections which can still threaten.

GraphQL API for Serverless Redis

Noah Fischer

Noah Fischer

DevRel @upstash

We’re excited to announce Upstash now supports a GraphQL API for connecting to Serverless Redis. Now, you can connect to Upstash wherever you can send HTTP requests (including WebAssembly and mobile apps).

Until now, the only way to connect to your database was with the Redis protocol which requires TCP connection. GraphQL helps you with database connection limits especially in serverless environments. Further, using GraphQL enables Upstash to provide features and APIs that Redis doesn’t support natively.