官术网_书友最值得收藏!

Understanding cold start 

What is cold start? 

Cold start = time it takes to boot a computer system

What is cold start in FaaS? 

When you execute a cold (inactive) function for the first time a cold start occurs. The cold start time is when the cloud provider provisions the required runtime containers, downloads your code for the functions, and then runs your functions. This increases the execution time of the function considerably, as it may take more time to provision certain runtimes before your function gets executed. The converse of this is when your function is hot (active), which means that the container with your code required to execute the function stays alive, ready and awaiting for execution. If your function is running, it is considered active and if there is certain period of inactivity, then the cloud provider will drop the runtime container with your code in it to keep the operating costs low and at that point your function is considered cold again.

The time it takes for cold start varies between different runtimes. If your function utilizes runtimes such as Node.js or Python, then the cold start time isn't significantly huge; it may add  < 100 ms overhead to your function execution.

If your function utilizes runtimes such as JVM, then you will see cold start times greater than a few seconds while the JVM runtime container is being spun up. The cold start latency has significant impact in the following scenarios:

  • Your functions are not invoked frequently and are invoked once every 15 minutes. This will add noticeable overhead to your function execution.
  • Your functions will see sudden spikes in your function execution. For example, your function may be typically executed once per second, but it suddenly ramps up to 50 executions per second. In this case, you will also see noticeable overhead to your function execution.

Understanding and knowing about this performance bottleneck is essential when you are architecting your FaaS application so that you can take this into account to understand how your functions operate.

Some analysis has been done to understand the container initialization times for AWS Lambda:

  • Containers are terminated after 15 minutes of inactivity
  • Lambda within a private VPC increases container initialization time

People overcome this by pinging their Lambda once every 5 or 10 minutes to keep the runtime container for a function alive and also preventing it from going into a cold state. 

Is cold start an issue of concern? Whether your function will have a problem like this, or not, is something that you need to test with production, such as with load, and understand the overhead that cold start adds to your FaaS application. 

主站蜘蛛池模板: 常德市| 梅州市| 凤阳县| 望江县| 上杭县| 招远市| 延寿县| 斗六市| 东兴市| 乌拉特中旗| 正定县| 华亭县| 银川市| 信丰县| 昂仁县| 章丘市| 陇西县| 额济纳旗| 芦山县| 维西| 平邑县| 那曲县| 郑州市| 曲靖市| 古浪县| 稷山县| 牡丹江市| 当阳市| 万州区| 洛隆县| 手游| 军事| 剑河县| 巧家县| 福泉市| 普宁市| 通州市| 小金县| 万源市| 贵港市| 绥化市|