AWS - All about lambda

 


AWS Lambda is an event-driven, serverless computing platform provided by Amazon as a part of Amazon Web Services. It is a computing service that runs code in response to events and automatically manages the computing resources required by that code. 

For example, let’s say you have an application that allows users to upload a photo for a profile image. The application stores these images in Amazon S3. Now, say you want to resize the image to a max resolution. You could handle this task using the traditional model. Still, since this code runs based on an event (the file upload), Amazon S3 can fire an event and trigger the execution of code to handle the image resize.

Creating a lambda function:







We are done with developing a function. Let's test it by creating an event.





Let's look at the output:



Init Duration: Refers to the amount of time taken to initialize the lambda.

COLD START 

Cold start refers to the initialization of the lambda (Setting up the environment) required to execute the actual code.

How to improve the performance (in terms of reducing latency for time-sensitive applications)

Lambda has a feature called "Provision Concurrency" - Which creates concurrent lambda functions in READY_TO_STATE(PRE-INITIALIZED) state. So, they are ready to execute the code. So, the amount of time spent on "Init" is reduced/standard INIT duration.
Lambda has a soft limit of 1000 concurrent executions per region. This means, at any given moment, the sum of lambda executions running belonging to all of your lambdas functions in a single region must be less than 1000.

A — SQS poller function which has X number of executions running at this very moment.
B — Function to update Dynamodb with Kenisis stream which has Y number of executions running at this very moment.
C — Function to process some files in s3 which has Z number of executions running at this very moment.

So, X + Y + Z will be equal to or less than 1000.

Even if the demand is high, no more new executions will spawn until one execution is completed.


Comments

Popular posts from this blog

SRE/DevOps Syllabus

AWS Code Commit - CI/CD Series Part 1

Docker - Preventing IP overlapping