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

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.

主站蜘蛛池模板: 呼玛县| 农安县| 育儿| 东安县| 四会市| 恩施市| 武清区| 留坝县| 南漳县| 闵行区| 酒泉市| 宁国市| 盈江县| 宁阳县| 乌鲁木齐县| 隆昌县| 南康市| 合江县| 甘泉县| 横山县| 常熟市| 平湖市| 荆门市| 茌平县| 赣榆县| 高唐县| 永平县| 启东市| 鲜城| 哈巴河县| 嘉定区| 临西县| 阿城市| 宁夏| 齐河县| 象州县| 乐至县| 五指山市| 栖霞市| 普兰店市| 富裕县|