Scaling up with AWS Lambda
AWS Lambda is a very effective deployment model for various web frameworks like NodeJS Express, Python FastAPI, GoLang Fiber s as described in last article.
In the dynamic startup world, AWS Lambda emerges as a very useful tool for delivering transformative benefits. Its pay-as-you-go pricing ensures cost efficiency, while automatic scaling
Scaling with concurrent lambda instances
Typical lambda deployments automatically scale by creating upto 1000 concurrent Lambda instances.
When your lambda receives a new call, or gets triggered by an event:
For example, when your function receives 10 requests:
领英推荐
So when the concurrent executions during a user spike or peak usage on monday or certain schedules can trigger concurrent database connections more than the underlying database can handle.
Also since the lambda remains hot for while the connections are not release upon completion immediately. This creates an temporary scarcity on number of database connections an AWS Lambda can maintain. To avoid this many app developers restrict the number of connections in connection pool
Benefits of AWS RDS Proxy
Amazon RDS Proxy can be enabled for most applications with no code changes. You don’t need to provision or manage any additional infrastructure to start using RDS Proxy. Pricing is simple and based on the capacity of underlying database instances. It improves application performance
In summary it may good practice to consider how your application loads would scale when using AWS Lambda with AWS RDS, and using AWS RDS Proxy if applicable given the scale+performance you want to achieve.