Prepare and test your skills

Prepare and test your skills

Free sample question with answers and detailed explanation below. The Professional Cloud Developer practice bank has an additional 608 practice questions.Try 10 free realistic questions: instant score, no credit card, and no account required.
An e-commerce application runs on Compute Engine managed instance groups (MIGs) behind a Global external Application Load Balancer. Currently, the application stores user session state in local VM memory and uses GENERATED_COOKIE session affinity. During traffic spikes and rolling updates, autoscaling adds or removes VMs and older instances are drained, causing users to lose their shopping carts.
You need to redesign the architecture to meet these requirements:
Which strategy should you implement?
HTTP_COOKIE session affinity maps a specified HTTP cookie to a backend index using consistent hashing. Basic Tier Memorystore for Redis provides a single-zone, standalone in-memory cache node without high-availability replication or automatic failover.
HTTP_COOKIE affinity requires the RATE balancing mode (along with RING_HASH or MAGLEV locality policies). Using the UTILIZATION balancing mode causes backend fullness to fluctuate unpredictably, which breaks session affinity.STRONG_COOKIE_AFFINITY, HTTP_COOKIE affinity requires the total number of configured and healthy backends to remain constant. Whenever autoscaling adds or removes any VM—or an instance transitions health states—the hash ring changes and breaks affinity for existing sessions.GENERATED_COOKIE and HTTP_COOKIE) redistributes traffic across backends whenever backend counts change.UTILIZATION mode frequently triggers spillover when instances near target CPU thresholds, breaking sticky routing.You only needed a non-critical ephemeral cache where data loss during Redis maintenance or node failures is acceptable, and you configured RATE balancing mode on a static-sized backend pool.
For resilient production session stores, Standard Tier Memorystore with HA replication should be paired with STRONG_COOKIE_AFFINITY so autoscaling events do not disrupt unrelated user sessions.
Stateful cookie-based session affinity (STRONG_COOKIE_AFFINITY) is a load balancing mechanism supported by Global and Regional external Application Load Balancers that encodes the identity of a specific backend instance directly inside an HTTP cookie. Standard Tier Memorystore for Redis is a fully managed, high-availability (HA) in-memory data store that provides cross-zone replication and automatic failover.
GENERATED_COOKIE or hash-based affinity—which break for all users whenever the total number of healthy backends changes—STRONG_COOKIE_AFFINITY remains intact when autoscaling adds instances or removes other instances. When a user's pinned VM is drained during a rolling update or fails health checks, the load balancer gracefully routes the next request to a healthy VM, which retrieves the user's shopping cart from Memorystore for Redis without data loss.STRONG_COOKIE_AFFINITY has no specific requirements for localityLbPolicy or balancing modes.Combining STRONG_COOKIE_AFFINITY with Standard Tier Memorystore achieves both best-effort sticky routing for L1 cache efficiency and durable, low-latency session continuity whenever instances scale, fail, or drain.
Stateful cookie-based affinity (STRONG_COOKIE_AFFINITY) pins a client to a specific backend VM by encoding the backend instance in a session cookie. Connection draining gives a backend VM a grace period to finish serving active, in-flight TCP/HTTP requests before the instance is terminated or removed from a backend service.
STRONG_COOKIE_AFFINITY prevents affinity from breaking when other VMs scale in or out, it explicitly breaks when the selected instance itself is removed, fails health checks, or is terminated during a rolling update.The application were completely stateless—or only stored disposable L1 cache data locally—and used an external store for authoritative session state.
Session affinity should be treated strictly as a performance optimization, never as a durability mechanism. Externalizing state to a shared data store like Memorystore is required for true resiliency.
NONE Session Affinity and Cloud Spanner AreSetting session affinity to NONE does not disable hashing; instead, the Application Load Balancer computes a 5-tuple hash (source IP, source port, protocol, destination IP, destination port) to select a backend. Cloud Spanner is a globally distributed, strongly consistent relational database supporting SQL transactions.
UTILIZATION mode: Like other hash-based methods, 5-tuple hashing breaks whenever the number of healthy or configured backends changes during autoscaling or rolling updates, and UTILIZATION balancing mode causes unpredictable capacity shifts that further disrupt routing stability.localityLbPolicy optimization for sessions: With NONE affinity, the default locality policy is ROUND_ROBIN, distributing requests across backends rather than preserving affinity.Your application required strict multi-region ACID transactions for persistent user records and had no requirement to route consecutive client requests to the same backend instance for L1 caching.
In high-performing architectures, Cloud Spanner is often used for durable transactional order data, while Memorystore handles low-latency session state alongside STRONG_COOKIE_AFFINITY.
Answer them yourself and get your score the moment you finish. No account needed.
Full access includes
Keep the momentum going with these hand-picked practice scenarios
Last updated Validated