Cloud and Container Basics

With serverless functions (FaaS), only the first call to a function that has not been called for a while sometimes responds hundreds of milliseconds to several seconds slower. Which of the following correctly explains this phenomenon?

  1. AThe result of the first call is cached, and from the second call on the function code is not executed and only the stored result is returned
  2. BIt takes time to prepare a new environment to run the function, start the language runtime and run initialization (a cold start)
  3. COn the first call the function code is sent to the user's device, compiled there and then executed
Show answer and explanation

Answer: B. It takes time to prepare a new environment to run the function, start the language runtime and run initialization (a cold start)

For serverless functions, the provider prepares execution environments (such as containers or lightweight virtual machines) as needed and cleans them up when they are not used for a while. The first call after an environment has been cleaned up requires preparing the environment, starting the language runtime and running the function's initialization, and the response is slower by that amount. Subsequent calls reuse the prepared environment and are faster (a warm start). Countermeasures include keeping initialization and the libraries loaded light and using settings that keep a certain number of environments ready in advance.

  • A. Function results are not cached automatically; the code runs on every call.
  • B. Correct. The time to prepare and initialize the environment is added to the first call.
  • C. Functions run in execution environments on the cloud side. They are not sent to the user's device to run.
Practice this topic Back to topic

Books on Cloud and Container Basics Ad

As an Amazon Associate I earn from qualifying purchases.

More Cloud and Container Basics questions

  1. Cloud storage is used for three purposes: (1) attaching it to a virtual machine as a disk, creating a file system and storing database data files; (2) mounting it from several servers at the same time and using it as a shared directory; (3) reading and writing a large number of images by key (name) through an HTTP API and growing the capacity without deciding it in advance. Which of the following is the appropriate combination of storage types for (1) to (3)?
  2. Virtual machines that are charged only for the time used, at ¥40 per hour (a made-up price), are used. Normally 2 machines run throughout the month (30 days), and on 20 weekdays 4 more are added for 6 hours a day to match the load. Which of the following is the charge for the month?
  3. A virtual machine costs ¥50 per hour on demand, paying only for the hours used, or ¥262,800 per year with a reservation that commits to a year of use in advance, regardless of the hours used (both made-up prices). With a year taken as 8,760 hours, the reservation becomes cheaper once the hours used in a year exceed a certain number. Which of the following is that number of hours?
  4. Which of the following generally applies to how many public clouds charge for data transfer?
  5. An environment was created by applying, with a declarative IaC (Infrastructure as Code) tool, a file that defines a network and two virtual machines. Immediately afterwards, the same file is applied again without any changes. Which of the following is what happens?