Source: Announcing HTTP targets for Cloud Tasks, with oAuth/OpenID connect authentication from Google Cloud
Microservices enable you to break up large monolithic applications into smaller chunks that are easy to build, maintain and upgrade. With a microservices architecture, individual services can now offload work to the background and be consumed later by another service. This gives users quicker response times as well as smoother interactions across a mesh of services.
At Google Cloud Next 2019, we announced Cloud Tasks, a fully managed, asynchronous task execution service that lets you offload long-running asynchronous operations, facilitating point-to-point collaboration and interaction across these microservices. It is already generally available for App Engine targets (tasks that originate from App Engine) and today, we are announcing new HTTP targets in beta that securely reach Google Kubernetes Engine (GKE), Compute Engine, Cloud Run or on-prem systems using industry-standard OAuth/OpenID Connect authentication.
With Cloud Tasks, you can offload long-running and background activities, decouple services from one another, and make your applications much more resilient to failures. At the same time, Cloud Tasks provides all the benefits of a distributed task queue: flexible routing, task offloading, loose coupling between services, rate limiting and enhanced system reliability:
Finally, Cloud Tasks does all this in a fully managed serverless fashion, with no manual intervention needed from the developer or IT administrator. You also pay only for the operations you run; GCP takes care of all the provisioning of resources, replication and scaling required to operate Cloud Tasks. As a developer, simply add tasks to the queue and Cloud Tasks handles the rest.
A1 Comms is one of the UK’s leading business-to-business communications providers and uses Cloud Tasks to simplify its application architecture:
“Cloud Tasks allows us to focus on the core requirements of the application we’re developing, instead of other utility requirements. We’ve been using Cloud Tasks extensively, from handling high volumes of notifications between applications that reside on different platforms, to data ingestion/migration tasks and the delegation, trigger, or control of workloads. After using Cloud Tasks, our development velocity has been given a significant boost and our overall architecture simplified.” – Jonathan Liversidge, IT Director, A1 Comms
Cloud Tasks operates in a push queue fashion, dispatching tasks to worker services via HTTP requests according to a routing configuration. The worker then attempts to process them. If a task fails, an HTTP error is sent back to Cloud Tasks which then pauses and retries to execute the task until a maximum number of attempts is reached. Once the task executes successfully, the worker sends a 2xx success status code to Cloud Tasks.
Cloud Tasks handles all of the process management for the task, ensuring tasks are processed in a reliable manner and deleting tasks as they finish executing. Additionally, you can track the status of the tasks in the system through an intuitive UI, CLI or client libraries.
You can use Cloud Tasks to architect interesting solutions, for example wiring together a deferred task processing system across microservices using products such as Cloud Run, Cloud Functions, GKE, App Engine, BigQuery and Stackdriver. Here’s an example from Braden Bassingthwaite from Vendasta at Cloud Next 2019.