Skip to content
@Distributed-Microservice-Application

Distributed Microservice Application

This project demonstrates a microservices-based system that processes user requests, performs calculations, and communicates asynchronously using Kafka, while ensuring observability and reliability using patterns like the Outbox Pattern, and tools like Prometheus, and Grafana


🚀 Scenario / Flow Overview

👤 User Interaction

  • A user, or a simulated user via K6, initiates a request to Service A through gRPC.
  • The request contains two numbers, and the system's job is to add them together quickly and reliably.

🧠 Service A - The Smart Calculator

  • Listens for incoming gRPC requests.

  • Performs the simple yet essential task of adding the two numbers.

  • But here’s the twist: instead of immediately pushing the result to Kafka, it:

    • Safely stores the result in an "outbox" table in its database—this follows the Outbox Pattern, which ensures messages aren’t lost.
    • A dedicated background job then picks up the saved results and sends them to Kafka, ensuring resilience and consistency.

🔁 Kafka - The Reliable Messenger

  • Serves as the message backbone, connecting services seamlessly.
  • Queues the result messages so they can be processed asynchronously by Service B, enabling a decoupled and scalable system.

🧮 Service B - The Running Total Keeper

  • Listens to the Kafka topic like a loyal subscriber.
  • Retrieves each message, adds the result to its running total, and can optionally log or persist each value.
  • It keeps track of everything, ensuring nothing is missed.

📊 Observability: Know Everything

  • Prometheus acts as the metrics timekeeper, storing rich time-series data.
  • Grafana gives life to the metrics with beautiful dashboards, showing real-time insights and helping engineers make informed decisions.

🔥 Testing at Scale

  • K6 simulates realistic load scenarios, helping test how the system performs under stress.
  • This ensures the architecture is ready for anything—from a few users to thousands.

DMA


inspiration video

Popular repositories Loading

  1. Service-A Service-A Public

    A gRPC microservice that receives two numbers, calculates their sum, and stores the result using the Outbox Pattern. A background worker reliably publishes results to Kafka, ensuring resilient and …

    Go 1

  2. Service-B Service-B Public

    A lightweight Kafka consumer microservice that listens to addition results from Service A and maintains a running total. Designed for scalability and accuracy in event-driven systems.

    Java 1

  3. .github .github Public

  4. grafana grafana Public

  5. prometheus prometheus Public

  6. Docker-Compose Docker-Compose Public

    Makefile

Repositories

Showing 6 of 6 repositories