Scaling up with AWS Lambda

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 facilitates seamless growth. Startups leverage Lambda's serverless architecture for faster time-to-market, unburdened by infrastructure complexities. The microservices-friendly design and event-driven flexibility empower startups to innovate rapidly, focusing on core business objectives rather than cost, scaling and infrastructure.

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:

  • If a pre-initialized execution environment instance is available, Lambda uses it to process the request.
  • Otherwise, Lambda creates a new execution environment instance to process the request.

For example, when your function receives 10 requests:

Parallel Executions in AWS Lambda (Image: AWS)

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 the lambda creates. This can still work but adds to connection initialisation time every time a lambda is invoked. AWS came up with the solution - AWS RDS Proxy making Lambda's attractive for microservices or functions using structured databases like AWS RDS, MySQL, PostGres and others. The diagram below shows deployment in both models

AWS Lambda with and without RDS Proxy (Image: AWS)


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, availability and security (IAM).

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.


要查看或添加评论,请登录

Bhavik Shah的更多文章

  • Composable Architectures

    Composable Architectures

    What is CA? Composable architecture is a way of designing software that makes it easy to create reusable components…

  • Go Lang Framework to watch in 2022

    Go Lang Framework to watch in 2022

    Go Lang is becoming quite popular not only because it is easy to learn but also for its performance, concurrency and…

  • Python frameworks to watch in 2022

    Python frameworks to watch in 2022

    There have been many popular python frameworks. Flask and Django being the most popular of the lot.

  • Why Vue is preferable to Angular in 2022?

    Why Vue is preferable to Angular in 2022?

    UI frameworks have come of age. We had used Angular 1.

  • Baking Multi Tenancy in SaaS

    Baking Multi Tenancy in SaaS

    Multi-tenancy is a common requirement in any modern SaaS. The way a B2C SaaS will support it will vary greatly from a…

    1 条评论
  • How to migrate legacy applications to newer architectures

    How to migrate legacy applications to newer architectures

    This is a well known challenge, faced by many organizations atleast once during the software lifecycle. It is faced by…

  • Eazy Kubernetes on Google Cloud

    Eazy Kubernetes on Google Cloud

    Google Cloud makes is super easy to deploy kubernetes clusters. Step 1: Choose to create a cluster Step 2: Provide…

  • Website to App in Minutes!

    Website to App in Minutes!

    Convert website into mobile app! It has been said that an average user spends over 2 hours on mobile phone while 86% of…

    6 条评论
  • How to choose a NoSQL Database

    How to choose a NoSQL Database

    NoSQL has been beautifully explained by Martin Fowler in his book especially the four main types of NoSQL databases…

  • Serve Windows from Google Cloud

    Serve Windows from Google Cloud

    Google Cloud Platform has come a long way from AppEngine days when it was more of PaaS platform allowing you to run app…

社区洞察

其他会员也浏览了