Does AWS Lambda suffers from cold start problem?

Often you might have heard or have seen on cloud blogs about cold start problem with Lambda. So is it true, does AWS Lambda suffers from cold start problem? Yes, its true AWS Lambda function suffers from cold start problem. Lets try and understand what exactly this problem is and how you can cope up with it.

What is cold start?
Cold start is the latency that is observed when triggering a lambda function. AWS Lambda functions when triggered gets launched on a container. So if there isn’t any idle container waiting to serve lambda, a new container gets launched this would call for some latency as it takes some time for new container to get launched. The process remains completely invisible to users and user has no control over it.

Solution for cold start problem-
As such it is not in your control so you cannot do much about it. Only AWS team can do something for this is future. But there are certain things that are in your control using them you can avoid cold start problem to some extent-

  • Warm up your lambdas through dummy calls every 30 mins, your call should be able to differentiate between dummy and actual calls.
  • Use higher memory, though it will take lesser time for initialization, but it can cost more money and often it is seen that higher sized memory lambda containers tends to close sooner. It is observed that 128mb lambdas containers can sustain upto 45 mins, while 512 or higher sized tends to have lower uptimes.
  • Code your lambdas in either of these languages Node.js, Python, or Go. Other languages tend to have higher cold start.
  • Keep your functions package size and dependencies smaller, so they can be launched quickly.
  • Keep away from VPC’s, they add latency for adding ENI’s.

Add a Comment

Your email address will not be published. Required fields are marked *