Microservices Data Consistency u0026 Sharing Strategies Quiz Quiz

  1. Eventual Consistency Concept

    What does 'eventual consistency' mean in the context of microservices architecture?

    1. All services will become consistent over time, given no new updates.
    2. All data must be consistent immediately across all services.
    3. Consistency only applies to transactional databases.
    4. Services that are down will lose data.
    5. All data updates are sent in real time to every service instantly.
  2. Database Per Service Pattern

    Which statement best describes the 'Database per Service' design pattern in microservices?

    1. Each microservice manages its own database to encapsulate data and avoid direct cross-service database access.
    2. All microservices share a single, central monolithic database.
    3. Data is directly replicated between all microservices in real time.
    4. Only read operations are allowed across service databases.
    5. Microservices can freely join tables from each other's databases.
  3. Challenges with Shared Databases

    What is a primary disadvantage of using a shared database across multiple microservices?

    1. It increases service coupling and complicates data ownership.
    2. It improves scalability and independence of microservices.
    3. It enforces strong data consistency at service boundaries.
    4. It simplifies deployment pipelines and continuous delivery.
    5. It avoids the need for synchronization mechanisms.
  4. SAGA Pattern Scenario

    In a SAGA pattern, how are distributed transactions handled among microservices?

    1. By using a series of local transactions, each followed by a compensating action if a failure occurs.
    2. By utilizing a two-phase commit protocol for guaranteed consistency.
    3. By executing all actions sequentially without compensation steps.
    4. Through synchronous HTTP calls with global locks.
    5. By sharing a single monolithic transactional database.
  5. Synchronizing Data Changes

    Which technique is commonly used to synchronize data changes between microservices?

    1. Publishing domain events through a message broker for eventual update propagation.
    2. Directly updating both databases using cross-service SQL JOINs.
    3. Allowing services to poll each other's databases for updates.
    4. Enabling direct remote table access using ORM tools.
    5. Sharing the same database tables among all services.
  6. Choosing Strong Consistency

    When is strong consistency preferred over eventual consistency between microservices?

    1. When correctness of distributed operations is critical, such as money transfers.
    2. When minimizing network latency is the only requirement.
    3. When each service works with completely isolated data.
    4. When the system does not require ACID guarantees.
    5. When using NoSQL databases exclusively.
  7. CQRS Pattern Usage

    How does the Command Query Responsibility Segregation (CQRS) pattern help in microservice data management?

    1. It separates read and write models, making it easier to handle data synchronization and scalability.
    2. It enforces strict data consistency between all services.
    3. It replaces the need for service-to-service communication.
    4. It prevents any form of eventual consistency.
    5. It allows direct table writes from external APIs.
  8. Event Replay for Recovery

    Why would a microservice use event replay from a message log when recovering from a crash?

    1. To rebuild its state to match the most recent changes from other services.
    2. To synchronize all databases to the primary node.
    3. To perform a hard reset and ignore all previous transactions.
    4. To merge all data into a monolithic schema.
    5. To avoid using any compensating transactions.
  9. Handling Out-of-Order Events

    What issue can arise with event-driven data synchronization between microservices, and how is it commonly addressed?

    1. Events arriving out of order, usually handled with versioning or timestamps.
    2. Overloading the database, solved by horizontal scaling.
    3. Duplicate services, fixed by introducing global transactions.
    4. Loss of schema, addressed by using message brokers only.
    5. Instant global consistency, managed by removing asynchrony.
  10. Read Models for Data Sharing

    How do microservices typically expose data for queries by other services while maintaining database per service?

    1. By publishing read models or materialized views through APIs or events.
    2. By allowing direct database connections from all consumers.
    3. By using shared database tables for all queries.
    4. By embedding all data in service URLs.
    5. By using spreadsheets for synchronization.