Google Professional Cloud Developer Question 316
Select 3Google Cloud PlatformYou are developing a microservices-based application on Google Cloud and want to roll out a new feature to your users gradually while being able to disable it quickly if an issue arises. You decide to use feature flags. Which of the following practices should you implement to properly manage feature flags in this scenario?
- A
Use a centralized configuration service to manage feature flags for all microservices.
- B
Hardcode feature flag values directly into the application code for simplicity.
- C
Log feature flag evaluations to monitor their usage and impact.
- D
Use feature flags for both long-term configuration and temporary experiments.
- E
Ensure feature flag checks are lightweight to minimize application latency.
Show answer and explanation
Correct answers: A, C, E
Explanation
Feature flags allow developers to enable or disable features dynamically without redeployment. Using a centralized service ensures consistency across microservices, and logging their usage provides visibility into their impact. Lightweight checks ensure minimal performance overhead, making feature flags reliable for production environments. Avoid practices like hardcoding values or overusing feature flags for both temporary and long-term purposes, as they can lead to maintainability and performance issues.
- A. Correct.
Using a centralized configuration service ensures that feature flags are managed consistently across all microservices and can be modified without deploying new code.
- B. Incorrect.
Hardcoding feature flag values into the code defeats the purpose of feature flags, as it requires redeploying the application to change the flag state.
- C. Correct.
Logging feature flag evaluations helps monitor their usage and identify any potential issues caused by enabling or disabling a flag.
- D. Incorrect.
Using feature flags for both long-term and temporary purposes can lead to unnecessary complexity and make it harder to manage them effectively over time.
- E. Correct.
Ensuring feature flag checks are lightweight minimizes the performance overhead and prevents them from negatively impacting application latency.