Cloud Functions and Cloud Run Flashcards
What are cloud functions?
Cloud Functions are serverless. A big difference between App Engine and Cloud Functions is that App Engine supports the use of many services in a single application. Cloud Functions support individualized services. Each service is managed and operated independently from the other services.
What are events, triggers, functions?
Events occur when a particular action initiates within the Google Cloud Platform. Examples might include a message being written to the Pub/Sub message queue and documents being pushed to a storage repository. Actions are associated with a given event. GCP supports events in five categories: Cloud Storage, Cloud Pub/Sub, HTTP, Firebase, and Monitoring Logging. Table 6-1 illustrates the event categories and associated activities. Most events require some form of response. A trigger is the result of an event response, whereas a function is the response to the trigger. A function is when a data argument is passed to a given event.
What are the
Functions operate independently in their own environment. When a function is invoked, it runs in a separate instance from other function calls. Unlike in App Engine, where data is shared among application instances, once a function is invoked, it operates on its own
What is Cloud Run?
Cloud Run is a serverless compute platform that is fully managed by Google Cloud. The difference between Cloud Run, App Engine, and Cloud Functions is that the Cloud Run platform can scale stateless containers, with emphasis on Kubernetes Engine. Because Cloud Run is serverless and abstracts all infrastructure responsibilities, you do not need to worry about application backend support.
Scaling and Versioning
Scaling capabilities are different between Cloud Functions and Cloud Run. With Cloud Functions, the max_instances parameter defines the degree to which your function can scale in response to an incoming request. If your application must scale, you do so by creating new instances for each of your functions since an instance can only handle a single request at a time.
In Cloud Run, each revision is automatically scaled to the number of container instances needed to handle all incoming requests or events. When a revision does not receive any traffic, by default it is scaled in to zero container instances. However, if desired, you can change this default to specify an instance to be kept idle or “warm” using the minimum instances setting.
In addition to the rate of incoming requests or events, the number of instances scheduled is impacted by:
The CPU utilization of existing instances when they are processing requests or events, targeting to keep scheduled instances to a 60% CPU utilization.
The maximum concurrency setting
The maximum number of container instances setting
The minimum number of container instances setting
What type of containers do you run vis Cloud Run?
How are they triggerable?
Cloud Run is a managed compute platform that enables you to run stateless containers that are invocable via HTTP requests. Cloud Run is serverless: it abstracts away all infrastructure management, so you can focus on what matters most — building great applications.
How do you enable cloud run services api?
gcloud services enable run.googleapis.com