Google Professional Cloud Developer Question 310
Single answerGoogle Cloud PlatformYou are building an e-commerce application deployed on Google Cloud that uses A/B testing to evaluate two versions of a recommendation algorithm. The application is deployed on Google Kubernetes Engine (GKE), and you need to ensure that the traffic is evenly split between the two versions of the application. Which approach should you use to implement A/B testing in a scalable and reliable way while minimizing additional development effort?
- A
Use a Kubernetes Ingress with a traffic-splitting annotation to route traffic between version A and version B.
- B
Manually implement traffic splitting logic in the application code and deploy both versions in the same Kubernetes Deployment.
- C
Use Google Cloud Load Balancer to configure traffic splitting by IP address ranges.
- D
Leverage Cloud Run with a feature flag service to dynamically route users to version A or version B.
Show answer and explanation
Correct answer: A
Explanation
The best approach for A/B testing in a Kubernetes environment is to use Kubernetes Ingress with traffic-splitting annotations. This method allows you to configure traffic distribution at the infrastructure level, ensuring scalability, reliability, and minimal development effort. Other options either require significant additional work or do not align with the given architecture.
- A. Correct.
This is the correct answer. Kubernetes Ingress supports traffic splitting through annotations, allowing you to evenly distribute traffic between different versions without requiring changes to the application code.
- B. Incorrect.
This approach would involve significant development effort and is prone to errors. Managing traffic splitting in the application code is not recommended since it reduces scalability and maintainability.
- C. Incorrect.
Google Cloud Load Balancer does not natively support A/B traffic splitting. Additionally, splitting by IP address ranges is not ideal for A/B testing as it does not ensure even distribution of traffic.
- D. Incorrect.
While Cloud Run and a feature flag service can be used for A/B testing, this approach is not relevant to the given scenario, as the application is deployed on GKE. It would also require changes to the deployment strategy.