Google Professional Cloud Developer Question 311
Single answerGoogle Cloud PlatformYou are developing a web application hosted on Google Cloud that needs to implement A/B testing for a new user interface. The A/B testing should allow you to send 50% of traffic to the new interface (variant B) and 50% to the current interface (variant A). Which of the following approaches would best enable you to implement and manage this A/B testing on Google Cloud?
- A
Use Cloud Load Balancer's traffic splitting feature to route 50% of traffic to two different backend services.
- B
Use Google Cloud Pub/Sub to randomly assign users to variant A or B.
- C
Deploy two versions of the application to Cloud Run and use a traffic splitting configuration to divide traffic between the two versions.
- D
Use Google Kubernetes Engine (GKE) and manually manage traffic routing using an Ingress controller.
Show answer and explanation
Correct answer: C
Explanation
A/B testing requires a solution that can split traffic reliably between two variants of the same application. Cloud Run provides a native traffic splitting feature, allowing you to route a percentage of traffic to different revisions of a service with minimal configuration. This makes it the most efficient and manageable option compared to Cloud Load Balancer, Pub/Sub, or manually configuring GKE.
- A. Incorrect.
Cloud Load Balancer does not have built-in support for A/B testing. While it can help in distributing traffic, it is not designed for variant-specific traffic splitting required in A/B testing.
- B. Incorrect.
Pub/Sub is a messaging service and not designed for traffic routing or A/B testing scenarios. It cannot manage HTTP traffic routing between variants.
- C. Correct.
Cloud Run allows traffic splitting between different revisions of a service, making it an ideal solution for implementing A/B testing. You can configure traffic distribution percentages directly within Cloud Run.
- D. Incorrect.
While GKE can be used for implementing A/B testing, it requires significant manual configuration (e.g., managing traffic routing via an Ingress controller). This approach is more complex compared to the built-in traffic splitting feature offered by Cloud Run.