0
0
Microservicessystem_design~12 mins

Feature flags in Microservices - Architecture Diagram

Choose your learning style9 modes available
System Overview - Feature flags

This system manages feature flags to enable or disable features dynamically in a microservices environment. It allows safe rollout, testing, and rollback of features without redeploying services.

Key requirements include low latency flag checks, centralized control, and consistency across services.

Architecture Diagram
User
  |
  v
Load Balancer
  |
  v
API Gateway
  |
  +-------------------+
  |                   |
  v                   v
Feature Flag Service  Microservices
  |                   |
  v                   |
Cache (Redis)          |
  |                   |
  v                   v
Database (Feature Flags Store)
Components
User
client
End user making requests to the system
Load Balancer
load_balancer
Distributes incoming requests evenly to API Gateway instances
API Gateway
api_gateway
Routes requests to microservices and feature flag service
Feature Flag Service
service
Manages feature flag states and evaluates flags for microservices
Microservices
service
Application services that check feature flags to enable/disable features
Cache (Redis)
cache
Stores feature flag states for fast access to reduce database load
Database (Feature Flags Store)
database
Persistent storage of feature flag configurations and rules
Request Flow - 10 Hops
UserLoad Balancer
Load BalancerAPI Gateway
API GatewayMicroservices
MicroservicesFeature Flag Service
Feature Flag ServiceCache (Redis)
Cache (Redis)Feature Flag Service
Feature Flag ServiceMicroservices
MicroservicesAPI Gateway
API GatewayLoad Balancer
Load BalancerUser
Failure Scenario
Component Fails:Cache (Redis)
Impact:Feature Flag Service cannot retrieve cached flag states, causing increased latency and load on the database.
Mitigation:Feature Flag Service falls back to querying the database directly. Cache is rebuilt asynchronously. Database replication ensures availability.
Architecture Quiz - 3 Questions
Test your understanding
Which component is responsible for deciding if a feature is enabled for a user?
AFeature Flag Service
BLoad Balancer
CAPI Gateway
DCache (Redis)
Design Principle
This architecture uses a centralized Feature Flag Service with caching to provide fast, consistent feature flag evaluations across microservices. The cache reduces database load and latency, while the load balancer and API Gateway ensure scalable and secure request routing.