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

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.

主站蜘蛛池模板: 潼南县| 石台县| 荣成市| 汝城县| 介休市| 舞钢市| 岳阳县| 天水市| 九江县| 湘乡市| 师宗县| 大兴区| 抚顺市| 大田县| 福建省| 建瓯市| 西峡县| 保德县| 六盘水市| 泰兴市| 石阡县| 安图县| 日照市| 石林| 田林县| 荥经县| 防城港市| 木里| 宝山区| 互助| 海南省| 崇阳县| 招远市| 桦南县| 昌邑市| 大连市| 南漳县| 唐海县| 开封县| 关岭| 深州市|