Prepare and test your skills
Prepare and test your skills
Architectural decoupling and event-driven design is the practice of building an application as independent microservices (opens in a new tab) instead of one tightly connected system. Each service handles its own requests, owns its own data choices, and evolves independently of the others. Traffic flows from one service to another through asynchronous messaging and network calls, so growth in one area and failure in another stay contained. This separation supports global scalability and system-wide fault tolerance.
Separation of stateless services from stateful services is the foundation for independent scaling and recovery. A stateless service handles each request independent of previous requests, so instances hosting the service can be created and destroyed without losing data needed for in-flight requests. This property is critical when an autoscaler adds or removes instances, nodes, or pods unexpectedly. When not every service can be stateless, teams must be explicit about which services require state, so stateless services scale in a straightforward way while stateful services receive a more considered approach to scaling and recovery.
Exam tip: A stateless service can be terminated by an autoscaler without losing in-flight work, while a stateful service cannot, so always separate the two explicitly.
Managing communication between services prevents the failure of one service from causing the failure of others. As the network of services grows, service interdependencies also grow, which creates the risk of a cascading failure where one overloaded service pulls down its callers. Resiliency patterns reduce traffic to an overloaded service and give that service a chance to recover or fail gracefully:
These patterns increase resiliency either by relieving pressure on the downstream service or by handling the error cleanly upstream.
A service mesh is software that links distributed services together and decouples business logic from networking. Application code sends its business request to the mesh, and the mesh manages how traffic flows from the source service to the destination service across the network. The mesh typically provides resiliency features like request retries, failovers, and circuit breakers, so developers do not embed that networking logic in every service. This separation lets teams evolve business logic independently while the mesh applies consistent traffic management and recovery behavior system-wide.
Independent services need independent data choices through heterogeneous storage, where different parts of the application use different types of storage. Conventional relational databases and non-relational NoSQL databases trade consistency and query power for availability and scalability:
| Storage type | Strengths | Tradeoffs |
|---|---|---|
| Relational databases | Transactions, strong consistency, referential integrity, and sophisticated querying across tables | Typically hard to scale and require careful management for high availability |
| NoSQL databases | Increased availability and easier scalability, often choosing availability over consistency under the CAP theorem | Sacrifice some relational features |
Choose NoSQL when the service data model can be designed to be eventually consistent, and consider Spanner (opens in a new tab) when a service needs a strongly consistent, highly available, and globally distributed database with SQL support. A cache further improves scalability by serving requests from memory instead of slower disk-based storage. Requests served from the cache have lower storage-layer latency, and caching reduces load on services downstream of the application, especially databases, which allows other components that share that downstream service to scale more or to scale at all.
A distributed service is a service deployed and executed in two or more deployment locations for scale and fault tolerance. Teams can deploy all service instances into all locations, or deploy some services in all locations and some in only one location based on hardware availability or expected limited load. Data consistency determines which pattern is safe: data in a transactionally synchronized database is consistent in all locations, so it is the best option for deploying service instances everywhere. When using an asynchronously replicated database, the same data item can be modified in two locations at once, so a conflict-resolution strategy must decide the final consistent state, sometimes with manual intervention. Service recovery follows a fixed order to preserve independence: first, restart the failed service in its original deployment location, a restart-in-place approach that platforms like Kubernetes perform automatically from configuration, and only after restart-in-place fails, fail the service over from its primary location to a secondary location.
Refactoring for cloud-native portability and agility means moving monolithic workloads toward cloud-native patterns that can be observed, scaled, and operated reliably on managed services. Effective observability provides continuous insight to detect potential failures before errors occur and to use resources efficiently during and after refactoring. In Google Cloud, this insight comes from metrics, logs, and traces flowing from workload components into Cloud Monitoring (opens in a new tab) and Cloud Logging for analysis, troubleshooting, and alerting.
Observability signals are the metrics, logs, and traces that show how a refactored workload behaves over time and where failures might develop. Comprehensive monitoring of these signals helps teams find where and why errors occurred and detect potential failures before errors affect users. Traces are especially important after decomposition into microservices because a single user or transaction journey flows from one service or component to the next.
| Signal | What it captures | Example use in Google Cloud |
|---|---|---|
| Metrics | Numerical measurements of activity at specific time intervals | Track technical service-level indicators such as request rate and error rate, plus business metrics such as orders placed and payments received |
| Logs | Time-stamped records of discrete events such as failures, errors, or state changes | Record component events and supply data that can also be used for service-level indicators |
| Traces | Journey of a single user or transaction through separate applications or components such as microservices | Track which components were used in each journey, where bottlenecks exist, and how long each journey took |
Logs may include metrics, so data flows from application components into both monitoring and logging pipelines for a complete view of dependencies and workload performance.
Gaining comprehensive insights means using Cloud Monitoring and Cloud Logging to track key metrics such as response times and error rates against workload needs. Default service metrics help teams make data-driven decisions by revealing component dependencies and their impact on overall workload performance. Teams can also create and publish custom metrics by using the Google Cloud SDK, so monitoring flows from standard platform signals to application-specific needs as the design matures.
Proactive troubleshooting is the practice of enabling robust error handling and logging across all components of workloads in Google Cloud. Logging data flows from sources such as Cloud Storage access logs and Virtual Private Cloud (VPC) Flow Logs into log sinks for storage and analysis. Because storing logs has associated costs, teams can configure exclusion filters on log sinks to exclude certain logs from being stored. This control keeps critical troubleshooting signals while limiting logging cost.
Optimizing resource utilization means monitoring consumption signals to detect under-provisioned and over-provisioned resources in services such as Google Kubernetes Engine (GKE), Compute Engine, and Managed Service for Apache Spark. The key consumption signals flow from service instances into Cloud Monitoring for capacity analysis:
Cloud Monitoring also supports trend analysis, experiment review, and retrospective analysis, while Active Assist provides insights and recommendations that help adjust resource allocation and improve performance. Load testing complements this monitoring by revealing potential breakpoints and showing how the refactored application can scale.
Prioritizing alerts means focusing operational response on the signals that best protect reliability and agility. This targeted approach lets teams proactively maintain workload reliability by concentrating on critical metrics that reflect user impact, appropriate thresholds that minimize alert fatigue, and timely responses that address significant issues before they spread. For more granular control over traffic distribution, advanced routing policies, and observability, teams can implement a Cloud Service Mesh (opens in a new tab) such as Istio. The service mesh operates at the application layer and provides sophisticated traffic management as requests flow from clients through mesh policies to backend services.
Exam tip: Even traffic distribution works best when incoming traffic is evenly distributed and Kubernetes Services have three or more endpoints per zone.
Prioritization of managed and serverless services is a cloud-first design approach that chooses Google Cloud managed and serverless offerings before self-managed virtual machines and clusters. The approach moves responsibility for capacity, redundancy, and scaling from the application team to the platform. Self-managed infrastructure leaves scaling logic, availability configuration, and failure recovery with the team, while managed services automate those tasks. The result is more scalable and resilient architecture with lower operating cost and less long-term maintenance.
Operational offloading to managed services means Google Cloud operates the underlying servers, replication, and traffic distribution while the team focuses on code and data. With self-managed Compute Engine (opens in a new tab) virtual machines, the team selects machine types, manages instance groups, and configures scaling policies. With the serverless platform, managed compute and database products provide built-in redundancy and load balancing without server management. This shift reduces repetitive toil, reduces failures that require human intervention, and increases the ability to automatically recover from failures.
Inherently elastic serverless services offload the most operations because they manage provisioning and scaling by request. Traffic flows from the user or event source to the managed service, and the service adds or removes capacity without team action. Common examples prioritized in a cloud-first design include:
These services depend on Google Cloud for availability logic, so the application team does not build custom failover or capacity management. Managed databases such as BigQuery, Spanner, and Bigtable maintain performance as data grows, while Cloud Monitoring supplies metrics across apps and infrastructure for data-driven decisions.
Automated scaling from zero to peak is the ability of each system component to grow and shrink independently based on workload requirements. Horizontal scaling adds instances to distribute load, while vertical scaling replaces components with larger ones that contain more capacity, memory, and storage. Horizontal scaling is the preferred technique for most cloud-first applications because failure of one instance does not affect application availability. For example, Compute Engine managed instance groups (MIGs) scale as a single entity under a policy that sets minimum and maximum virtual machines and adds machines when average CPU utilization reaches a threshold such as 75%.
Reactive scaling responds to real-time load changes and suits unpredictable spikes, while proactive scaling pre-provisions capacity for predictable patterns like daily business hours or seasonal sales. Predictive autoscaling for Compute Engine combines both by forecasting future load from historical trends such as CPU utilization and recomputing the forecast every few minutes. Managed features like Google Kubernetes Engine (GKE) Autopilot, Cloud Run (opens in a new tab), and MIGs learn workload patterns to manage proactive scaling automatically. By default, when a Cloud Run service receives no traffic, it scales to zero instances, so the team pays only for what is used. Appropriate scaling policies depend on application behavior rather than CPU utilization alone: metrics flow from Cloud Monitoring to the autoscaler, which adds capacity when queue depth, request latency, or custom application metrics cross defined thresholds. Clear policies prevent frequent unnecessary scaling, known as flapping, and horizontal scaling depends on stateless design where session state flows from compute instances to external storage such as Memorystore for Redis, so any instance can handle any user request.
Exam tip: Cloud Run scales to zero instances when idle, while a MIG maintains at least its configured minimum number of virtual machines.
Reducing long-term technical debt means avoiding design choices that make future scaling, patching, and recovery expensive. Self-managed designs accumulate debt through manual changes, configuration drift, and snowflake servers that cannot be reproduced reliably. Immutable infrastructure and automation reduce this debt by storing configuration in source control and redeploying resources instead of tweaking running systems. Managed and serverless services extend the same benefit by keeping platform-level replication and availability logic with Google Cloud. Technical debt often starts as constraints that limit scalability and resilience:
These constraints force custom workarounds that increase cost and slow future improvements. Choosing managed services removes many hard-to-scale and hard-to-operate dependencies from team ownership, while automation of provisioning, testing, and deployment increases consistency and speed while minimizing human error.
Matching workloads to the right resource model means aligning availability, performance, and cost requirements with managed, serverless, or ephemeral resources. A stateless application does not need the same availability investment as a stateful backend, and a production environment needs higher availability than short-lived development infrastructure. Cloud-first design uses this alignment to control spending, avoid overprovisioning, and ensure resources match dynamic workload needs.
| Workload type | Requirements | Resource options |
|---|---|---|
| Mission-critical | Continuous availability, robust security, and high performance | Premium managed services like Spanner for high availability and global consistency |
| Non-critical | Cost-efficient and autoscaling infrastructure | Basic and ephemeral resources like Spot VMs |
| Event-driven | Dynamic scaling based on current demand | Serverless services like Cloud Run and Cloud Run functions |
The table guides tradeoffs between control and offloading for future improvements. Choose Spanner when data requires continuous availability and global consistency despite higher cost. Choose Spot VMs when the workload tolerates interruption and benefits from low-cost ephemeral capacity. Choose Cloud Run and Cloud Run functions when demand varies and the service should scale dynamically and pay only for use.
Cloud-first design connects decoupling, observability, and managed services into one operating model: independent services limit the blast radius of failure, metrics, logs, and traces flowing into Cloud Monitoring and Cloud Logging reveal where pressure is building, and elastic managed services add or remove capacity without manual intervention. Stateless design makes both autoscaling and recovery safe, while heterogeneous storage and workload-matched resource models keep consistency, availability, and cost aligned with actual needs.
Separation of stateless services from stateful services is the foundation for independent scaling and recovery. A stateless service handles each request independent of previous requests, so instances hosting the service can be created and destroyed without losing data needed for in-flight requests, which is critical when an autoscaler adds or removes instances, nodes, or pods unexpectedly. Services that require state must be explicitly identified because they need a more considered approach to scaling and recovery.
These resiliency patterns reduce traffic to an overloaded service and give that service a chance to recover or fail gracefully so one overloaded service does not pull down its callers. A circuit breaker stops sending traffic from the caller service to the failing downstream service so it has time to recover, exponential backoff spaces out repeated requests by longer intervals so pressure decreases over time, and graceful degradation handles error states in the upstream service by reducing function rather than failing completely. These patterns increase resiliency either by relieving pressure on the downstream service or by handling the error cleanly upstream.
A service mesh is software that links distributed services together and decouples business logic from networking. Application code sends its business request to the mesh, and the mesh manages how traffic flows from the source service to the destination service across the network. The mesh typically provides resiliency features like request retries, failovers, and circuit breakers, so developers do not embed that networking logic in every service.
Cloud Run scales to zero instances when it receives no traffic, while a Compute Engine managed instance group maintains at least its configured minimum number of virtual machines. Cloud Run therefore incurs cost only for what is used when idle, whereas managed instance groups scale as a single entity under a policy that sets minimum and maximum virtual machines and adds machines when average CPU utilization reaches a threshold such as 75%.
An e-commerce company experiences frequent checkout failures during flash sale events. The current monolithic order service uses synchronous REST calls to communicate with an inventory reservation service, a payment processing gateway, and an email notification system.
During peak traffic, downstream processing delays cause cascading timeouts across the application, leading to dropped checkout transactions and a degraded user experience. The engineering team wants to modernize the architecture using cloud-native design principles to ensure high availability, fault tolerance, and independent service scalability.
Which architectural approach should you recommend to decouple the checkout workflow?
Last updated