Each deployment to service creates a revision. Once a revision has been created, it cannot be modified. If we wished to change the container image, we would need to create a new revision.
The following figure shows active requests connecting to Service A via Revision A-3. We have two older revisions of Service A that we can roll back to if needed. In parallel, we have two revisions of Service B that can be used to test the new version of the application:
Figure 7.2 – Overview of the Cloud Run architecture
Now that we’ve learned about services and revisions, we can move on to Cloud Run jobs and how they can be used to host workloads.
Cloud Run jobs
A job is a collection of one or multiple independent tasks that are executed in parallel during the job execution. Each job is executed in a specific Google Cloud region and can run one or more containers until it is finished:
Figure 7.3 – Array of jobs in Cloud Run
The preceding figure shows us a comparison between a job that might have one task and can be executed longer and an array of jobs that can be parallelized and run faster than a job.
Using a single job to perform one task can take much longer than creating a job with many independent tasks. In Cloud Run, identical jobs may run independently, creating an array job.
An example of an array job in Cloud Run could be batch image processing stored in Cloud Storage.
Cloud Run jobs are best suited to be used when the code performs a job and then stops. Here are some examples:
- Scripts or other operational tasks
- Parallel jobs
- Saving the results of a query
Cloud Run for Anthos
We now know what use cases fit best when deploying on Cloud Run. Google Cloud has another offering for Cloud Run, called Cloud Run for Anthos. You might be wondering, what is Anthos? Anthos is a Google cloud-native platform that allows to deploy and manage applications consistently across on-premises environments, the edge, and multiple clouds. It is a unified platform that provides a consistent development and operations experience for all your applications, regardless of where they run. Anthos isn’t part of the Associate Cloud Engineer certification, but if you want to learn more about Anthos, go to https://cloud.google.com/anthos.
The Cloud Run for Anthos architecture can be seen in the following diagram:
Figure 7.4 – Overview of Cloud Run for Anthos
Cloud Run for Anthos abstracts away the complexity of Kubernetes, allowing easy build and application deployment across hybrid and multi-cloud environments. Cloud Run for Anthos is a Knative open source project that enables serverless workloads on Kubernetes.