Bird
Raised Fist0
Microservicessystem_design~20 mins

Dynamic configuration updates in Microservices - Practice Problems & Coding Challenges

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Challenge - 5 Problems
🎖️
Dynamic Config Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Architecture
intermediate
2:00remaining
Designing a dynamic configuration update system for microservices

You need to design a system that allows microservices to update their configuration dynamically without restarting. Which architectural component is essential to achieve this?

AA centralized configuration service that microservices poll periodically for updates.
BEmbedding configuration files inside each microservice's container image.
CHardcoding configuration values in the microservice source code.
DUsing environment variables set only at microservice startup.
Attempts:
2 left
💡 Hint

Think about a component that can serve updated settings to many services without restarting them.

scaling
intermediate
2:00remaining
Scaling configuration updates in a large microservices environment

You have 1000 microservice instances needing configuration updates simultaneously. What is the best approach to efficiently propagate updates?

AEach instance polls the configuration service every second independently.
BUse a publish-subscribe system where the configuration service pushes updates to instances.
CRestart all microservices to reload configuration from local files.
DManually update configuration on each instance via SSH.
Attempts:
2 left
💡 Hint

Consider a method that avoids thousands of independent requests at once.

tradeoff
advanced
2:00remaining
Tradeoffs between push and pull models for configuration updates

Which statement best describes a tradeoff between push and pull models for dynamic configuration updates in microservices?

APull models guarantee immediate consistency; push models do not.
BPull models reduce latency but require persistent connections; push models increase latency but simplify client design.
CPush models reduce latency but require persistent connections; pull models increase latency but simplify client design.
DPush models always use less network bandwidth than pull models regardless of scale.
Attempts:
2 left
💡 Hint

Think about how updates reach clients and the connection types involved.

component
advanced
2:00remaining
Key component for ensuring consistency of dynamic configuration across microservices

Which component is critical to ensure all microservices see a consistent configuration version during dynamic updates?

AA versioning system that tags configuration snapshots and enforces atomic updates.
BA load balancer that routes requests to updated microservices only.
CA logging system that records configuration changes asynchronously.
DA caching layer that stores old configuration indefinitely.
Attempts:
2 left
💡 Hint

Think about how to prevent microservices from using mixed or partial configurations.

estimation
expert
2:00remaining
Estimating capacity for configuration update propagation

You have 10,000 microservice instances. Each configuration update is 50 KB. Updates occur once every 10 minutes. Estimate the minimum network bandwidth needed to propagate updates to all instances within 1 minute.

AApproximately 50 Mbps
BApproximately 67 Mbps
CApproximately 100 Mbps
DApproximately 83 Mbps
Attempts:
2 left
💡 Hint

Calculate total data size and divide by propagation time, then convert to Mbps.

Practice

(1/5)
1. What is the main benefit of using dynamic configuration updates in microservices?
easy
A. Encrypt all service communication by default
B. Change service settings without restarting or downtime
C. Reduce the size of service containers
D. Increase the number of microservices automatically

Solution

  1. Step 1: Understand dynamic configuration updates

    Dynamic configuration updates allow changing settings while the service is running.
  2. Step 2: Identify the main benefit

    This avoids restarting services, preventing downtime and improving flexibility.
  3. Final Answer:

    Change service settings without restarting or downtime -> Option B
  4. Quick Check:

    Dynamic config = no downtime updates [OK]
Hint: Dynamic config means no restart needed for changes [OK]
Common Mistakes:
  • Confusing dynamic config with scaling services
  • Thinking it reduces container size
  • Assuming it encrypts communication automatically
2. Which of the following is a common method for microservices to receive dynamic configuration updates?
easy
A. Polling a central configuration server periodically
B. Hardcoding config values in source code
C. Restarting the service every hour
D. Using static environment variables only

Solution

  1. Step 1: Review methods for dynamic config updates

    Common methods include polling or push from a central config server.
  2. Step 2: Identify the correct method

    Polling a config server lets services fetch updates regularly without restart.
  3. Final Answer:

    Polling a central configuration server periodically -> Option A
  4. Quick Check:

    Polling config server = dynamic updates [OK]
Hint: Dynamic config needs active update fetching, not static values [OK]
Common Mistakes:
  • Thinking hardcoded values can update dynamically
  • Assuming restart is needed for updates
  • Believing static env vars update automatically
3. Consider this pseudocode for a microservice fetching config updates:
config = load_config()
while True:
    if config_server.has_update():
        config = config_server.get_update()
    sleep(10)
    print(config['feature_flag'])
What will this code do when the feature_flag changes on the config server?
medium
A. Print the old feature_flag value forever
B. Crash because config_server.has_update() is undefined
C. Print nothing because of missing initial config
D. Update and print the new feature_flag value every 10 seconds

Solution

  1. Step 1: Analyze the update check loop

    The code checks if the config server has an update, then fetches it.
  2. Step 2: Understand the print behavior

    Every 10 seconds it prints the current feature_flag from the updated config.
  3. Final Answer:

    Update and print the new feature_flag value every 10 seconds -> Option D
  4. Quick Check:

    Polling loop updates config = prints new value [OK]
Hint: Polling loop updates config then prints latest value [OK]
Common Mistakes:
  • Assuming config never updates after initial load
  • Thinking code crashes due to undefined methods (assumed defined)
  • Ignoring the sleep and print inside the loop
4. A microservice uses a push-based config update system but sometimes misses updates. What is a likely cause?
medium
A. The service does not acknowledge receipt of updates
B. The service polls the config server too frequently
C. The service restarts after every update
D. The config server uses static environment variables

Solution

  1. Step 1: Understand push-based config update mechanism

    Push systems send updates and expect acknowledgments to confirm delivery.
  2. Step 2: Identify why updates are missed

    If the service does not acknowledge, the server may not resend or confirm updates.
  3. Final Answer:

    The service does not acknowledge receipt of updates -> Option A
  4. Quick Check:

    Missing ack = missed updates in push system [OK]
Hint: Push updates need acknowledgments to avoid missing data [OK]
Common Mistakes:
  • Confusing push with polling frequency issues
  • Assuming restarts cause missed updates
  • Thinking static env vars relate to push update failures
5. You design a microservices system with dynamic config updates using a central config server. To ensure minimal latency and high availability, which approach is best?
hard
A. Embed config in each service and restart services on config change
B. Use a single config server with clients polling every second
C. Deploy multiple config server replicas with push notifications and local caching
D. Use static config files updated manually on each service host

Solution

  1. Step 1: Consider latency and availability needs

    Multiple replicas reduce single points of failure and improve response times.
  2. Step 2: Evaluate update delivery methods

    Push notifications with local caching reduce latency and avoid constant polling.
  3. Final Answer:

    Deploy multiple config server replicas with push notifications and local caching -> Option C
  4. Quick Check:

    Replicas + push + cache = low latency & high availability [OK]
Hint: Replicas + push + cache = best for latency and availability [OK]
Common Mistakes:
  • Relying on single server causes downtime
  • Polling every second wastes resources
  • Restarting services causes downtime
  • Manual static updates are error-prone and slow