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

Higher latency

Serverless is event-driven and so your code is not running all the time. When a request is made, it triggers a service that finds your function, unzips the package, loads it into a container, and makes it available to be executed. The problem is that those steps take time: up to a few hundreds of milliseconds. This issue is called a cold start delay and is a trade-off that exists between the serverless cost-effective model and the lower latency of traditional hosting.

There are some solutions available to minimize this performance problem. For example, you can configure your function to reserve more RAM memory. It gives a faster start and overall performance. The programming language is also important. Java has a higher cold start time than JavaScript (Node.js).

Another solution is to benefit from the fact that the cloud provider may cache the loaded code, which means that the first execution will have a delay but further requests will benefit from a smaller latency. You can optimize a serverless function by aggregating a large number of functionalities into a single function. The benefit is that this package will be executed with a higher frequency and will frequently skip the cold start issue. The problem is that a big package will take more time to load and provoke a higher first start time.

As a last resort, you could schedule another service to ping your functions periodically, such as once every 5 minutes, to prevent putting them to sleep. It will add costs, but it removes the cold start problem.

There is also a concept of serverless databases that references services where the database is fully managed by the vendor, and it costs only the storage and the time to execute the database engine. Those solutions are wonderful, but they add a second layer of delay for your requests.

主站蜘蛛池模板: 湟中县| 分宜县| 嵊州市| 青川县| 句容市| 务川| 镇雄县| 娄底市| 盖州市| 华坪县| 巴林左旗| 屯门区| 常熟市| 长泰县| 西昌市| 勃利县| 桃源县| 任丘市| 梁山县| 定日县| 左权县| 江源县| 盘山县| 通江县| 巨鹿县| 长葛市| 威远县| 达孜县| 临泽县| 佳木斯市| 汝南县| 广安市| 茶陵县| 石首市| 牡丹江市| 库伦旗| 辽中县| 游戏| 金乡县| 河间市| 兴山县|