CPU and Memory
Serverless apps differ from servers in managing resources like CPU and memory.
Long-running server processes often maintain in-memory caches and require large amounts of code. Therefore, they consume more significant amounts of CPU and memory than serverless apps.
Serverless apps are usually optimized to consume smaller amounts of CPU and memory. And once more, some of the biggest serverless app platforms (such as AWS and Google Cloud) charge for each slice of memory and CPU that you use.
Moreover, some serverless app platforms require you, the developer, to declare ahead of time how much CPU and memory you will use. Serverless app platforms that run on virtual machines (like AWS Lambda) need this information to optimize the backend. Others may limit memory or CPU ahead of time to maintain the predictability of provisioning.Browse Chapters