All About Cloud Run, its Scalability and Management Features - Build What's Next
Blog

All About Cloud Run, its Scalability and Management Features

7406

Of your peers have already read this article.

3:00 Minutes

The most insightful time you'll spend today!

Google Cloud's Cloud Run is a fully-managed compute environment to implement and scale serverless containers. If you are a Cloud Run novice, we have listed some basics and other details to help you learn, set up and manage stateless microservices.

Mindful Containers is a fictitious company that is creating containerized microservice applications. They need a fully managed compute environment for deploying and scaling serverless containerized microservices. So, they are considering Cloud Run. 

They are excited about Cloud Run because it abstracts away the cluster configuration, monitoring, and management so they can focus on building the features for their apps. Cloud Run is a fully-managed compute environment for deploying and scaling serverless containerized microservices.

cloud run
Click to enlarge

What is Cloud Run?

Cloud Run is a fully-managed compute environment for deploying and scaling serverless HTTP containers without worrying about provisioning machines, configuring clusters, or autoscaling.

  • No vendor lock-in – Because Cloud Run takes standard OCI containers and implements the standard Knative Serving API, you can easily port over your applications to on-premises or any other cloud environment. 
  • Fast autoscaling – Microservices deployed in Cloud Run scale automatically based on the number of incoming requests, without you having to configure or manage a full-fledged Kubernetes cluster. Cloud Run scales to zero— that is, uses no resources—if there are no requests.
  • Split traffic – Cloud Run enables you to split traffic between multiple revisions, so you can perform gradual rollouts such as canary deployments or blue/green deployments.
  • Custom domains – You can set up custom domain mapping in Cloud Run and it will provision a TLS certificate for your domain. 
  • Automatic redundancy – Cloud Run offers automatic redundancy so you don’t have to worry about creating multiple instances for high availability

How to use Cloud Run

With Cloud Run, you write your code in your favorite language and/or use a binary library of your choice. Then push it to Cloud Build to create a container build. With a single command—“gcloud run deploy”—you go from a container image to a fully managed web application that runs on a domain with a TLS certificate and auto-scales with requests.

How does Cloud Run work?

Cloud Run service can be invoked in the following ways:

HTTPS: You can send HTTPS requests to trigger a Cloud Run-hosted service. Note that all Cloud Run services have a stable HTTPS URL. Some use cases include: 

  • Custom RESTful web API
  • Private microservice
  • HTTP middleware or reverse proxy for your web applications
  • Prepackaged web application

gRPC: You can use gRPC to connect Cloud Run services with other services—for example, to provide simple, high-performance communication between internal microservices. gRPC is a good option when you: 

  • Want to communicate between internal microservices
  • Support high data loads (gRPC uses protocol buffers, which are up to seven times faster than REST calls)
  • Need only a simple service definition you don’t want to write a full client library
  • Use streaming gRPCs in your gRPC server to build more responsive applications and APIs

WebSocketsWebSockets applications are supported on Cloud Run with no additional configuration required. Potential use cases include any application that requires a streaming service, such as a chat application.

Trigger from Pub/Sub: You can use Pub/Sub to push messages to the endpoint of your Cloud Run service, where the messages are subsequently delivered to containers as HTTP requests. Possible use cases include:

  • Transforming data after receiving an event upon a file upload to a Cloud Storage bucket
  • Processing your Google Cloud operations suite logs with Cloud Run by exporting them to Pub/Sub
  • Publishing and processing your own custom events from your Cloud Run services

Running services on a schedule: You can use Cloud Scheduler to securely trigger a Cloud Run service on a schedule. This is similar to using cron jobs. Possible use cases include:

  • Performing backups on a regular basis
  • Performing recurrent administration tasks, such as regenerating a sitemap or deleting old data, content, configurations, synchronizations, or revisions
  • Generating bills or other documents

Executing asynchronous tasks: You can use Cloud Tasks to securely enqueue a task to be asynchronously processed by a Cloud Run service. Typical use cases include:

  • Handling requests through unexpected production incidents
  • Smoothing traffic spikes by delaying work that is not user-facing
  • Reducing user response time by delegating slow background operations, such as database updates or batch processing, to be handled by another service, 
  • Limiting the call rate to backend services like databases and third-party APIs

Events from Eventrac: You can trigger Cloud Run with events from more than 60 Google Cloud sources. For example:

  • Use a Cloud Storage event (via Cloud Audit Logs) to trigger a data processing pipeline 
  • Use a BigQuery event (via Cloud Audit Logs) to initiate downstream processing in Cloud Run each time a job is completed

How is Cloud Run different from Cloud Functions?

Cloud Run and Cloud Functions are both fully managed services that run on Google Cloud’s serverless infrastructure, auto-scale, and handle HTTP requests or events. They do, however, have some important differences:

  • Cloud Functions lets you deploy snippets of code (functions) written in a limited set of programming languages, while Cloud Run lets you deploy container images using the programming language of your choice. 
  • Cloud Run also supports the use of any tool or system library from your application; Cloud Functions does not let you use custom executables. 
  • Cloud Run offers a longer request timeout duration of up to 60 minutes, while with Cloud Functions the requests timeout can be set as high as 9 mins
  • Cloud Functions only sends one request at a time to each function instance, while by default Cloud Run is configured to send multiple concurrent requests on each container instance. This is helpful to improve latency and reduce costs if you’re expecting large volumes. 

Pricing

Cloud Run comes with a generous free tier and is pay per use, which means you only pay while a request is being handled on your container instance. If it is idle with no traffic, then you don’t pay anything.

Conclusion

After learning about the ease of set up, scalability, and management capabilities of Cloud Run the Mindful Containers team is using it to deploy stateless microservices. If you are interested in learning more, check out the documentation.https://www.youtube.com/embed/oR4btKLRdn4?enablejsapi=1&

For more #GCPSketchnote, follow the GitHub repo. For similar cloud content follow me on Twitter @pvergadia and keep an eye out on thecloudgirl.dev

Case Study

Swiggy: Delivering Local Food Within 40 Minutes

8819

Of your peers have already read this article.

1:30 Minutes

The most insightful time you'll spend today!

Swiggy needed a scalable mapping platform that covered a wide geographic area and offered tools to help the company to build an efficient mobile app

Founded in 2014, Swiggy started small, delivering food to a few neighborhoods in Bengaluru, India. As the company grew, the team wanted a mapping technology that could help expand the service throughout India.

Swiggy needed a scalable mapping platform that covered a wide geographic area and offered tools to help the company to build an efficient mobile app and website for customers and delivery staff.

Customers find restaurants and order from them using the Android app, iOS app, or the website. Swiggy worked with Google Maps Partner Media Agility and used a variety of Google Maps Platform APIs to develop web and mobile apps that incorporate relevant local restaurant details.

Google Maps Platform Results

  • Built a hyper-local delivery service that is growing throughout India at a rate of 25 percent per month
  • Deliveries are made quickly, resulting in higher customer satisfaction and retention—users have been so satisfied that nearly 80 percent of its orders are from repeat customers
  • Drivers seamlessly handle tens of thousands of orders per day

In order to guarantee fast food delivery, Swiggy returns only restaurants within four to five kilometers of the customer’s location. The Directions API is used by drivers to easily route to restaurants and customers. The customer can track the progress of the delivery and estimated arrival time using a mobile app or the website.

“Google Maps provides the most accurate and reliable data, which is crucial for us because maps and location are central to our business. We also knew Google’s intuitive interface would provide a great customer experience with little to no learning curve… Google Maps’ ability to provide customer location and the distances of nearby restaurants is the backbone of our success, because it ensures a reliable, consistent customer experience,” said Aman Jain, Senior Product Manager, Swiggy.

How-to

Ease Your Migration and Modernization Journey with Microsoft and Windows on Google Cloud Demo Center

8294

Of your peers have already read this article.

2:00 Minutes

The most insightful time you'll spend today!

If you are looking to migrate and modernize Microsoft and Windows, check Google Cloud Demo Center that includes several simulations to walk you through many scenarios without the need for deployment, configuration and commitment. Discover more.

If you’re looking to migrate and modernize your Microsoft and Windows workloads, Google Cloud is your premiere destination. No matter what migration strategy you’ve selected or what value you’re looking to achieve, with Google Cloud you’re able to:

  • simplify your migration and modernization journey
  • reduce your on-prem footprint and increase agility
  • optimize license usage to reduce costs
  • modernize to reduce single-vendor dependencies
  • rely on enterprise-class support backed by Microsoft

Whether you’re looking to migrate applications running on Windows virtual machines, adopt Windows containers in Google Kubernetes Engine (GKE), convert SQL databases to Cloud SQL, or something else, Google Cloud offers you the first-class experience you need. 

But we don’t want you to take our word for it. Try it out yourself with our new online Microsoft and Windows on Google Cloud Demo Center without any commitment or friction.

simulated demos.jpg
Click to enlarge

The demo center uses hands-on guided simulations to walk you through several scenarios for solving business critical challenges with Google Cloud’s Microsoft and Windows solutions. Because these are all simulated, you’ll see how it works without any deployment, configuration, or commitment. It’s a seamless way for you to see exactly how Google Cloud can help you.

Run dedicated hardware and optimize with sole tenant

Sometimes you might want to run your workloads on dedicated hardware (with oversubscription options) for compliance, licensing, and management. Google Cloud provides sole-tenant nodes that allow you to easily deploy your virtual machines onto dedicated machines to avoid “noisy neighbor” issues, address regulatory or licensing constraints, and optimize inter-VM communications.

Plus, the CPU Overcommit option allows oversubscribing sole-tenant node resources by up to 2x, therefore helping save on per-physical core licensing for many licensed workloads like SQL Server.

Learn how to set up a sole tenant group and node.

Optimize license costs with premium images & custom VMs

One of the easiest ways to optimize your cloud experience with virtual machines (VM) is to pick the right VM image. Google Cloud provides premium license-included VM images that are thoroughly tested and optimized, including SQL Server options with pay-as-you-go licensing. These are great for workloads that don’t need to run all the time or when you do not have spare licenses for bring your own license (BYOL). 

Explore some Windows & SQL images and learn how CPU/Memory options can help optimize deployment and save on licensing.

Modernize your databases with Managed SQL Server

Sometimes you need to manage your SQL Server instance to achieve certain business or operational goals. But more often, managing SQL Server deployments can be undifferentiated: backups, high-availability, updates, and patching are just some of the many things you have to take care of when going the do-it-yourself route. One way to modernize your database tier is to migrate to a managed service like Cloud SQL, which is a fully managed Relational Database service for SQL. 

Explore the process of creating an instance in just a few clicks!

Extract apps from VMs and move to containers in GKE with Migrate for Anthos

Many Windows workloads running on virtual machines such as Internet Information Services (IIS) are ideal candidates for migrating to containers without major changes like rewriting or rearchitecting. However, doing this migration manually can be tedious, which is why Migrate for Anthos can help easily re-platform a .NET app running on IIS into a container-based app. 

Simulate intelligently extracting, migrating, and modernizing applications to run natively on containers in GKE and Anthos clusters.

Move .NET applications to GKE on Windows without code changes

When you’re looking to go fully cloud native, you can leverage Windows containers in GKE without rewriting your .NET applications. Simply create clusters with Windows nodes and deploy containerized Windows workloads in a few clicks, even alongside Linux containers. These deployments reduce operational overhead with features such as auto-upgrade, auto-repair, and release channels. 

Learn  how easy it is to build a GKE cluster with a Windows node and deploy an app. 

Now that you’ve gotten a feel for what’s available, go check out the Demo Center. You can also visit us at Windows and Microsoft on Google Cloud to learn more.

Blog

Smart Home Appliances Start-up Chooses Google Cloud to Wow European Customers

3453

Of your peers have already read this article.

2:00 Minutes

The most insightful time you'll spend today!

TecPal, a new and upcoming name in the smart home appliances industry selects Google Cloud and its IoT Core fully-managed services to win over clients in Europe and launch multiple IoT products with preloaded content and better user control!

The internet of things is everywhere now. Almost everyone has at least one connected device at home, likely a virtual assistant and perhaps a smart programmable thermostat. Nearly all new televisions come preinstalled with streaming apps. Even electric vehicles send drivers communications when tire pressure is low or other problems come up.

Smart home appliances aren’t quite as common just yet, but the market is growing rapidly worldwide. And at TecPal, we are helping lead the way.

I’ve had the privilege to work around the world, in Hamburg, Bangkok, and Beijing, and I’ve been in the amazing city of Hong Kong for the past five years. It’s an ideal location for a startup like ours.

I collaborated with a friend from a previous job in mainland China to come up with the idea to start our new venture. He owns a factory that manufactures all kinds of small kitchen appliances and sells them mostly to European retailers. When more and more of his customers started asking about smart appliances, he called me because he knew about my background in IT.

That’s where our idea was born for a more specialized developer of software for smart appliances. Given my friend’s manufacturing expertise and my software experience, we were really more than halfway there before even getting started. That was just four years ago, and today we employ more than 50 people.

We started by adding smart technology to the products his factory produces but realized that what we’re doing could be so much bigger. Why produce smart technology for just a handful of clients when the global market is growing? So now we’re transitioning from creating a customized solution for his products to a software-as-a-service model that can be used in all kinds of smart appliances.

Rapid delivery of custom apps

At TecPal, we started with kitchen appliances, but our software also works in washing machines, ovens, vacuum cleaners, and more. We put everything together in an end-to-end service: hardware integration, cloud services and consumer-facing apps. And the IoT management platform can roll out updates, manage the devices, and ensure their security. Manufacturers and retailers don’t need to know about software development, embedded systems development, cloud development, or mobile development. We can handle that for them so they can stay focused on their core areas of expertise.

Today we have appliances that come preloaded with recipes that are optimized for the appliance so you don’t have to worry about the time, the temperature, and other details. Everything is preset.

We launched multiple IoT products with a major European retailer in 2021 that includes not only preloaded recipes but also user-generated content geared to specific appliances. The Monsieur Cuisine Smart is an advanced multi-cooker utilizing TecPal’s IoT solution. The mobile companion app allows users to control the appliances remotely. They can check the remaining cooking time or stop one of the many cooking programs like kneading, steaming, frying from the living room or from their office across town. The ability to embed content in an appliance is valuable, and so is the ability to control the appliance remotely, but we double down on value by offering both.

Winning with best-in-class IoT technology

Companies in Northeast Asia generally shop around for technology partners based mostly on price, but that’s not us. We chose Google Cloud for the quality of its technology, especially its IoT Core fully managed services. We’re using almost everything in Google Cloud IoT Core, but we’re particularly reliant on the environment for its highly secure two-way device connection and management. We set up some clusters in Google Kubernetes Engine (GKE) and are using that as the underlying virtualization architecture because it allows us to quickly and cost-effectively scale up and down to meet changing customer demands.

We also use Google Cloud Pub/Sub as our message broker to update app statuses automatically and reliably in our back end, for our ETL processes, and for our data pipeline. At the same time, Google Cloud Dataflow is key because it’s a fast, efficient way to funnel all data from different devices and events into BigQuery for data collection, storage, and analytics. BigQuery is a great choice for us because most developers are already familiar with it as a relational database that supports advanced data analytics. We can expand our use of BigQuery without worrying about dimensions, and our new developers can come up to speed quickly on it.

We only end up checking in with a Google Cloud support team once a month, if that. If we don’t find what we’re looking for in documentation, we can just drop them an email. Their response time is excellent.

Beyond the immediate technology advantages we’ve realized by standardizing on Google Cloud, we’re also finding that it helps us win business with big clients in Europe. Google Cloud is an environment that other big businesses know and trust.

We’re still just getting started

We’re already seeing double-digit growth in our market, up to about 25 percent annually. More importantly, there’s a lot of runway in front of us before our growth is expected to plateau.

The market for smart consumer appliances is increasing every day, and there’s a lot of room to reach new regions with new products. Most countertop food processors and slow cookers are still old-fashioned, for instance, but they probably won’t stay that way—especially now that two out of three homeowners say their next appliance purchase will be a smart one.

Together with Google Cloud, we are committed to meeting that demand and exceeding expectations as people embrace new at-home technologies that will make their everyday lives easier.

If you want to learn more about how Google Cloud can help your startup, visit our page here to get more information about our program, and sign up for our communications to get a look at our community activities, digital events, special offers, and more.

Blog

Minimum Instances for Cloud Functions to Keep Performances Going for Serverless Apps

3374

Of your peers have already read this article.

2:00 Minutes

The most insightful time you'll spend today!

Minimium instance features in the lightweight compute platform, Cloud Functions keeps serverless apps online during low demands. Read blog to learn how you can leverage the min instance feature to run latency-sensitive apps.

Cloud Functions, Google Cloud’s Function as a Service (FaaS) offering, is a lightweight compute platform for creating single-purpose, standalone functions that respond to events, without needing an administrator to manage a server or runtime environment. 

Over the past year we have shipped many new important capabilities on Cloud Functions: new runtimes (Java, .NET, Ruby, PHP), new regions (now up to 22), an enhanced user and developer experience, fine-grained security, and cost and scaling controls. But as we continue to expand the capabilities of Cloud Functions, the number-one friction point of FaaS is the “startup tax,” a.k.a. cold starts: if your function has been scaled down to zero, it can take a few seconds for it to initialize and start serving requests. 

Today, we’re excited to announce minimum (“min”) instances for Cloud Functions. By specifying a minimum number of instances of your application to keep online during periods of low demand, this new feature can dramatically improve performance for your serverless applications and workflows, minimizing your cold starts.

Min instances in action

Let’s take a deeper look at min instances with a popular, real-world use case: recording, transforming and serving a podcast. When you record a podcast, you need to get the audio in the right format (mp3, wav), and then make the podcast accessible so that users can easily access, download and listen to it. It’s also important to make your podcast accessible to the widest audience possible including those with trouble hearing and those who would prefer to read the transcript of the podcast. 

In this post, we show a demo application that takes a recorded podcast, transcribes the audio, stores the text in Cloud Storage, and then emails an end user with a link to the transcribed file, both with and without min instances. 

Approach 1: Building the application with Cloud Functions and Cloud Workflows

In this approach, we use Cloud Functions and Google Cloud Workflows to chain together three individual cloud functions. The first function (transcribe) transcribes the podcast, the second function (store-transcription) consumes the result of the first function in the workflow and stores it in Cloud Storage, and the third function (send-email) is triggered by Cloud Storage when the transcribed result is stored and sends an email to the user to inform them that the workflow is complete.

Transcribe Podcast Serverless Workflow.jpg
Fig 1. Transcribe Podcast Serverless Workflow

Cloud Workflows executes the functions in the right order and can be extended to add additional steps in the workflow in the future. While the architecture in this approach is simple, extensible and easy to understand, the cold start problem remains, impacting end-to-end latency. 

Approach 2: Building the application with Cloud Functions, Cloud Workflows and min instances

In this approach, we follow all the same steps as in Approach 1, with a slightly modified configuration that enables a set of min instances for each of the functions in the given workflow.

Transcribe Podcast Serverless Workflow (Min Instances).jpg
Fig 2. Transcribe Podcast Serverless Workflow (Min Instances)

This approach presents the best of both worlds. It has the simplicity and elegance of wiring up the application architecture using Cloud Workflows and Cloud Functions. Further, each of the functions in this architecture leverages a set of min instances to mitigate the cold-start problem and time to transcribe the podcast.

Comparison of cold start performance

Now consider executing the Podcast transcription workflow using Approach 1, where no min instances are set on the functions that make up the app. Here is an instance of this run with a snapshot of the log entries. The start and end timestamps are highlighted to show the execution of the run. You can see here that the total runtime in Approach 1 took 17 s. 

Approach 1: Execution Time (without Min Instances)

Approach 1.jpg

Now consider executing the podcast transformation workflow using Approach 2, where min instances are set on the functions. Here is an instance of this run with a snapshot of the log entries. The start and end timestamps are highlighted to show the execution of the run, for a total of 6 s. 

Approach 2: Execution Time (with Min Instances)

Approach 2.jpg

That’s an 11 second difference between the two approaches. The example set of functions are hardcoded with a 2 to 3 second sleep during function initialization, and when combined with average platform cold-start times, you can clearly see the cost of not using min instances.

You can reproduce the above experiment in your own environment using the tutorial here

Check out min instances on Cloud Functions

We are super excited to ship min instances on Cloud Functions, which will allow you to run more latency-sensitive applications such as podcast transcription workflows in the serverless model. You can also learn more about Cloud Functions and Cloud Workflows in the following Quickstarts: Cloud FunctionsCloud Workflows.

Blog

Deploying Ray on GKE: Distributed Computing Made Easy

964

Of your peers have already read this article.

3:30 Minutes

The most insightful time you'll spend today!

Effortlessly scale and optimize your distributed Python applications with Ray on Google Kubernetes Engine (GKE). Explore the seamless integration of Ray's power and GKE's reliability for simplified management and enhanced performance.

The rapidly evolving landscape of distributed computing demands efficient and scalable frameworks. Ray.io is an open-source framework to easily scale up Python applications across multiple nodes in a cluster. Ray provides a simple API for building distributed, parallelized applications, especially for deep learning applications.

Google Kubernetes Engine (GKE) is a managed container orchestration service that makes it easy to deploy and manage containerized applications. GKE provides a scalable and flexible platform that abstracts away the underlying infrastructure.

KubeRay enables Ray to be deployed on Kubernetes. You get the wonderful Pythonic unified experience delivered by Ray, and the enterprise reliability and scale of GKE managed Kubernetes. Together, they offer scalability, fault tolerance, and ease of use for building, deploying, and managing distributed applications.

In this blog post, we share a solution template to get you started easily with Ray on GKE. We discuss the components of the solution and showcase an inference example using Ray Serve for Stable Diffusion.

Overview of the Solution

In this solution template we use KubeRay, an OSS solution for managing Ray clusters on Kubernetes, as the operator for provisioning our workloads. Follow the step-by-step instructions in the README file to get started. The solution contains two groups of resources: platform-level and user-level.

Platform-level resources are expected to be deployed once for each development environment by the system administrator. These include the common infrastructure and GCP service integrations that are shared by all users.

  • GKE cluster and node pool. Configurations can be changed in the main.tf file. This module deploys a GKE cluster with a GPU node pool, including required Nvidia drivers for GPUs. You can replace these with other machine types.
  • Kubernetes system namespace and service accounts, along with the necessary IAM policy bindings. This allows the platform administrator to provide fine-grained user access control and quota policies for Ray cluster resources.
  • KubeRay operator. The operator is responsible for watching for changes in KubeRay resources and reconciling the state of the KubeRay clusters.  
  • Logging. The `logging_config` section enables logs from system components and workloads to write logs to Cloud logging.
  • Monitoring. The `monitoring_config` section enables Managed Prometheus integration. This allows the deployment to automatically scrape system-level metrics and writes them to the managed metrics service.
  • Workload identity. This enables your workloads to authenticate with other GCP services using Google IAM service accounts.

User-level resources are expected to be deployed once by each user in the development environment.

  • KubeRay cluster. This is the actual Ray cluster that we will be used for your workloads. It is configured to use a Workload Identity pool and a IAM-binded service account that provides fine-grained access to GCP services. You can customize the Ray cluster settings by editing the kuberay-values.yaml file.
  • Logging. The solution adds a side car container deployed alongside each KubeRay worker node. This uses fluentbit to forward Ray logs from the head node to Cloud logging. You can edit the fluentbit-config file to change how the logging container filters and flushes logs.
  • Monitoring. This module provides a PodMonitoring resource that scrapes metrics from the user’s Ray cluster and uploads data points to Google Managed Prometheus. An optional installation for Grafana dashboard is included and can be accessed through a web browser.
  • JupyterHub server. This module installs a JupyterHub notebook server in the user namespace, enabling users to interact directly with their Ray clusters.

Run a Workload on Your Ray Cluster

Let’s try running the provided example with Ray Serve to deploy Stable Diffusion. This example was originally taken from the Ray Serve documentations here. To open the example in Jupyter notebook, go to the external IP for proxy-public in your browser (instructions to get the IP). And then click on File -> Open from URL, and input the raw URL of the notebook to open it.

Since the notebook runs in the same Kubernetes cluster as the Ray cluster, it is able to talk directly to the latter using its cluster-internal service endpoint – thus there is no need to expose the Ray cluster to public internet traffic. For production workloads, you should secure your endpoints with GCP account credentials. Google Cloud Identity Aware Proxy (IAP) can be used to enable fine-grained access control to user resources, such as our Ray cluster, to protect your GCP resources from unnecessary exposure. A full tutorial on how to enable IAP on your GKE cluster can be found here.

The notebook contains code for deploying a pre-trained model to a live endpoint. The last cell makes a call to the created service endpoint:prompt = “a cute cat is dancing on the grass.”input = “%20″.join(prompt.split(” “))resp = requests.get(f”http://example-cluster-kuberay-head-svc:8000/imagine?prompt={input}”)with open(“output.png”, ‘wb’) as f:   f.write(resp.content)

Executing the notebook will generate a file with a unique picture of a cute cat. Here is an example we got:

https://storage.googleapis.com/gweb-cloudblog-publish/images/1._output.max-600x600.png

Congratulations! You have now deployed a large model for image generation on GKE.

Logging and Monitoring

As mentioned earlier, this solution enables logging and monitoring automatically. Let’s find those logs.

In your Cloud Console, open up Logging -> Log Explorer. In the query text box, enter the following:resource.type=”k8s_container”resource.labels.cluster_name=%CLUSTER_NAME%resource.labels.pod_name=%RAY_HEAD_POD_NAME%resource.labels.container_name=”fluentbit”

You should see the Ray logs from your cluster forwarded here.

https://storage.googleapis.com/gweb-cloudblog-publish/images/2.logs.max-900x900.png

To see your monitoring metrics, go to Metrics Explorer in the Cloud Console. Under the menu for “Target”, select “Prometheus Target” and then “Ray”. Select the metric that you want to see, for instance `prometheus/ray_component_cpu_percentage/gauge`:

https://storage.googleapis.com/gweb-cloudblog-publish/images/3._metrics.max-900x900.png

The deployment also comes with a Grafana deployment. Follow this guide to open it up and view your Ray cluster’s metrics.

Conclusion

The combination of Ray and GKE offers a simple and powerful solution for building, deploying, and managing distributed applications. Ray’s simplicity makes it an attractive choice for data and model developers while GKE’s scalability and reliability is the defacto choice for enterprise platforms. The solution template presented in this blog post offers a convenient way to get started quickly with KubeRay, the recommended approach to deploy Ray on GKE.

If you have any questions for building Ray on Kubernetes and GKE, you can contact us directly at ray-on-gke@google.com or comment in GitHub. Learn more about building AI Platforms with GKE by visiting our User Guide.

More Relevant Stories for Your Company

Blog

Trimoz Technologies and Google Cloud-built Vaccination Appointment Scheduler Managed 365,000 Appointments Daily!

When public health officials in Quebec set out to provide COVID-19 vaccination services for their 8 million residents in February 2021, they needed an easy-to-use, scalable solution to schedule appointments online. To make it simple for Quebecers to register for vaccines, the goal was to use Clic Santé, a familiar

Blog

Take a Look at 30 Eventrac Locations!

New locations in Eventarc Back in August, we announced more Eventarc locations (17 new regions, as well as 6 new dual-region and multi-region locations to be precise). This takes the total number of locations in Eventarc to more than 30. You can see the full list in the Eventarc locations page or by running gcloud

Case Study

Video: How Pitney Bowes Leveraged Apigee to Create New Revenue Streams

Headquartered in Stamford, Connecticut, Pitney Bowes helps businesses navigate the complex world of commerce. They enable organizations to send parcels and packages across the globe. Pitney Bowes serves 90 percent of Fortune 500 companies, has 90 plus years of innovation, supports 1.5 million small businesses and has 15,000 employees globally.

SHOW MORE STORIES