Google Professional Cloud Network Engineer Question 407
Select 2Google Cloud PlatformYour team has deployed a custom Google Cloud HTTP(S) Load Balancer to serve web traffic for your application. The application needs to maintain sticky sessions to ensure that users are consistently routed to the same backend instance for the duration of their session. Additionally, the backend instances must automatically scale based on traffic to ensure high availability. How should you configure the Load Balancer to meet these requirements?
- A
Enable client IP affinity in the backend service configuration.
- B
Enable generated cookie-based session affinity in the backend service configuration.
- C
Set a custom maximum serving capacity for each backend instance.
- D
Configure a managed instance group with autoscaling for the backend.
Show answer and explanation
Correct answers: B, D
Explanation
To implement sticky sessions, the best approach is to use generated cookie-based session affinity, as it reliably ensures session stickiness even in cases where client IPs might change. Additionally, setting up autoscaling for the backend instances ensures that the application can handle variable traffic loads while maintaining high availability. Both configurations work together to meet the application's requirements.
- A. Incorrect.
Client IP affinity uses the client's IP address to maintain session affinity, but it is not reliable when users connect through proxies or load balancers, which might change the IP address. Hence, this is not the preferred option for sticky sessions.
- B. Correct.
Generated cookie-based session affinity is a better choice for sticky sessions, as the Load Balancer generates a unique cookie to ensure that requests from the same session are routed to the same backend instance.
- C. Incorrect.
Setting a custom maximum serving capacity can limit the number of connections per instance but does not directly address sticky sessions or scaling requirements.
- D. Correct.
Configuring a managed instance group with autoscaling ensures that the backend can scale its capacity automatically to handle increased traffic, meeting the availability requirement.