You deploy a Google Cloud Function that processes HTTP requests. After a period of inactivity, the first request takes longer to respond than subsequent requests.
What causes this delay on the first request?
Think about what happens when a function has not been used for a while.
Cloud Functions create a container to run your code when a request arrives after inactivity. This setup time causes the cold start delay.
You want to deploy a Cloud Function that uses an API key stored as an environment variable named API_KEY. Which gcloud command correctly sets this environment variable during deployment?
Check the official flag for setting environment variables inline.
The --set-env-vars flag sets environment variables during deployment. Other flags are invalid or incorrect.
You need to deploy a Cloud Function that handles many simultaneous HTTP requests efficiently. Which configuration helps maximize concurrency and reduce cold starts?
Think about how instance limits and memory affect concurrency.
Increasing max instances and memory allows more function instances to run concurrently, reducing cold starts and improving throughput.
You deploy a Cloud Function with an HTTP trigger. You want to restrict access so only authenticated users from your organization can invoke it. Which is the best approach?
Consider built-in Google Cloud security features for access control.
Using IAM roles to restrict invocation is the recommended way to secure Cloud Functions. Public access with code checks or IP filtering is less secure and harder to maintain.
You want to automate Cloud Function deployments in a CI/CD pipeline. Which practice ensures reliable and repeatable deployments?
Think about automation and version control in deployments.
Using Infrastructure as Code tools allows you to define your Cloud Functions declaratively, enabling automated, consistent, and version-controlled deployments in CI/CD pipelines.