Micro-containers in the Background Facilitating Your Code Execution
A common misconception about serverless services is that they operate without servers. This is where the term ‘serverless’ might be misleading. The execution of Lambda still occurs on a server. However, as the developer, you are not required to manage them.
Upon receiving a request to your Lambda function, one of two processes will ensue: either it will provision a new micro-container to host the code (๐ฐ๐ผ๐น๐ฑ ๐๐๐ฎ๐ฟ๐) or it will utilize an already existing micro-container (๐๐ฎ๐ฟ๐บ ๐๐๐ฎ๐ฟ๐). Naturally, the latter process is more time-efficient.
Time Required for Resource Allocation – Cold Starts:
Examining the first scenario more closely, it is known as a cold start. This term, frequent in serverless solution discussions, refers to the significant consideration when opting for serverless services. The initialization and deployment of your code within Lambda micro-containers necessitate time, termed as a cold start.

Lambda must retrieve your functionโs code and initiate a new micro-container environment to execute it. Subsequently, the global portion of your function runs, followed by the execution of the main code within your handler function.
Comparatively, this differs from traditional stateful methods like #EC2 or #ECS, where an ECS task only requires a single start. Lambda, in contrast, necessitates multiple starts.
Nevertheless, cold starts often pose minimal challenge. In languages such as TypeScript or Python, cold starts are notably brief. For applications in production, such as APIs, warm containers are typically available to cater to users.
Architectural designs frequently reveal that less than 1% of users encounter a cold start. It is crucial to grasp this concept because it applies to nearly all serverless services.
Single Request Handling by One Container
It is also significant to note that a single Lambda container is capable of processing only one request at a time.
Hence, even with an active Lambda container, if it is occupied with a request, another container must be initiated.
Understanding these two fundamental concepts is beneficial in advancing your knowledge in the serverless and cloud domains.
What are your thoughts on serverless architecture? Share your insights or questions in the comments!

Leave a comment