To exploit code and develop an application, DevOps can use GCP Cloud Run. So what's it all about? What features does it offer? And what are the benefits? Find out in this article.
What is GCP Cloud Run?
GCP Cloud Run is a platform that allows you to run your code directly on Google’s infrastructure. Through GCP Cloud Run, your various services can be hosted in containers, all in a serverless approach. It is, therefore, a container-based tool that ensures a separation between your tasks and the platform.
While its operation is slightly more complex than source code-based tools, GCP Cloud Run helps ensure compliance between what is executed and what is tested.
How does Cloud Run work on GCP?
There are two ways to exploit the code on Cloud Run.
Cloud Run services
With this option, you can leverage code that responds to a web request or an event.
Here are some concrete examples of using this option:
- Websites and web applications: You can build an app using all your usual tools, access a SQL database, and create dynamic HTML pages.
- APIs and Microservices: With Cloud Run Services, you can design a RESTful, gRPC, or GraphQL API. These can be made public or private.
- Streaming data processing: You can receive messages from Cloud Pub/Sub, requests from Cloud Tasks, and events.
This service handles all the requests and events received through container instances. On your part, you just need to ensure that the code meets the requirements of the TCP port and performs the required tasks.
💡Good to know: Each Cloud Run Service comes with an HTTPS endpoint and a unique subdomain. If necessary, you can also create your custom domains.
What is Cloud Run Jobs?
With this feature, the code performs a task and stops once the task is completed. For example, deploying a database migration, generating invoices, etc.
The significant advantage of Cloud Run Job is the ability to perform multiple tasks simultaneously (referred to as Array jobs). The idea is to divide a job into different independent tasks. As multiple container instances run in parallel, you save valuable time in executing the code.
These two features operate in the same Cloud Run environment, so they can use the same integrations. If you need a specific database, storage option, or management tool, you can use Google Cloud Platform tools (Pub/Sub, Cloud SQL, Secret Manager, etc.).
What are GCP Cloud Run's features?
To simplify the work of DevOps, Cloud Run GCP offers a number of particularly useful features.
GCP Cloud Run automatically improves its capabilities when it deems it necessary, depending on the workload demand. This ensures that GCP Cloud Run can handle all incoming requests, regardless of their volume.
This adaptation is made possible by a load balancing system, which all Cloud Run services have.
Thanks to auto scaling, requests are distributed to available containers. If all containers are busy, Cloud Run adds more. Conversely, as demand decreases, Cloud Run stops sending traffic to the containers and shuts them down.
💡Good to know: The default limit for the number of containers available on Cloud Run is 1000 instances. However, if you need more containers, you can always request a change in quotas.
The Traffic management feature is directly integrated into GCP Cloud Run. Thus, every new deployment automatically creates an immutable revision.
You can then route traffic to previous revisions, roll back, or split traffic to different versions of the code simultaneously for progressive deployment.
This last option is particularly useful if you want to mitigate the risk of deploying a new version. For example, if you send only 1% of traffic to the new version and notice a higher error rate, you can immediately stop the deployment to make corrections.
You also have access to other features on GCP Cloud Run, such as:
– Choice of programming language, library, and binary.
– Use of containers.
– Integrated monitoring and logging.
– And more.
To master all of the GCP Cloud Run services, consider taking a training course.
What are the advantages of Cloud Run?
GCP Cloud Run is a fully managed service, so there’s no need to pre-provision infrastructure or manage clusters.
This allows you to be more productive and move faster in the design of software and applications.
With GCP Cloud Run, it’s possible to deploy code written in any programming language (Go, Node.js, Python, Java, .NET, Ruby, etc.). Even though Cloud Run is a container-based solution, you can still use the source-based option. This allows you to create containers for yourself from the various languages you use.
Furthermore, Cloud Run allows you to integrate with all the tools of GCP. These integrations enable you to develop high-performance and complex applications.
GCP Cloud Run primarily operates on the Free Tier principle. This means you pay based on what you use in terms of CPU and memory. So, you don’t spend any budget on Google Cloud Platform services if the capacity is inactive.
Things to remember
GCP Cloud Run is a container-based tool that allows you to run your code directly on Google’s infrastructure.
You can achieve this using either Cloud Run Services or Cloud Run Jobs, depending on your requirements.
With its numerous features and ease of use, Cloud Run enables developers to increase productivity and efficiency, all at a lower cost.
If you still have unanswered questions, don’t hesitate to schedule an appointment with a representative at DataScientest who will guide you toward a training program.