A function is executed in a container. The container is not immediately released after a function returns a response. A container is released only when it receives no requests for a period of time. This period depends on the scheduling algorithm of the system and may range from several minutes to dozens of minutes. Therefore, a container can be considered persistent provided that requests are continuously sent. Therefore, you can use global variables or other methods to cache resources and optimize performance. However, your program cannot depend on data in the cache. For example, cached data is erased if the container or its host goes down.
How helpful was this page?
What might be the problems?