This project is a distributed system built using multiple services including a .NET Server, RabbitMQ, MS SQL Server, Prometheus, and Grafana. The system performs reliable asynchronous processing using RabbitMQ and exposes a REST API and gRPC services. The project is designed to process a series of requests related to "addition" and maintain the sum, integrating monitoring and observability tools like Prometheus and Grafana.
- RabbitMQ: Messaging broker that handles asynchronous communication between services.
- MSSQLSERVER (db): Database for storing application data.
- .NET gRPC: Implements gRPC service for adding values and communicates with RabbitMQ.
- .NET REST API: REST API service that gets the sum via HTTP requests.
- Prometheus: Collects and stores metrics from the services for monitoring.
- Grafana: Provides a dashboard for visualizing the metrics stored in Prometheus.
- gRPC-based Addition Service: Built a gRPC service in .NET for addition operations, where messages are processed asynchronously with RabbitMQ.
- RabbitMQ Integration: RabbitMQ is used for decoupling communication between services and ensuring reliable message processing.
- MSSQLSERVER: Database used for storing the state, with gRPC background server that read the data and publish them to rabbitMQ
- Outbox Pattern: Implemented the Outbox Pattern to ensure reliable message delivery by storing the message in a separate table (outboxMessages) within the database, which is later picked up by the message consumer (RabbitMQ).
- Prometheus + Grafana: Integrated Prometheus for monitoring request durations, and system health, and Grafana for visualizing metrics in real-time.
- Docker Compose: Used Docker Compose to run all services locally and manage dependencies between them.
- .NET for implementing the gRPC service and the REST API service.
- RabbitMQ for messaging.
- MSSQLSERVER as the primary database.
- Outbox Pattern for reliable message delivery.
- Prometheus for metrics collection and monitoring.
- Grafana for visualization of Prometheus metrics.
- Docker Compose for local development and orchestration of services.
Docker Compose was used to define services such as RabbitMQ, MSSQLSERVER, .NET server, Prometheus, and Grafana.
- Integrated Prometheus for tracking service metrics like request durations, CPU usage, and queue times.
- Set up Grafana to visualize metrics collected by Prometheus.
- Custom Prometheus metrics were created, such as
queue_waiting_time_secondsto measure queue waiting time, andwhole_request_time_socondsto whole request time
-
Install Docker (if not already installed):
- Follow the instructions for your operating system to install Docker from the official Docker website.
-
Start the Services:
- Navigate to the project directory.
- Run the following command to start all services:
docker-compose up -d
-
Verify the Services:
- RabbitMQ will be available at http://localhost:15672.
- grpc server will be available at http://localhost:50051.
- REST server will be accessible at http://localhost:3001.
- Prometheus will be available at http://localhost:9090.
- Grafana will be available at http://localhost:3000 (default login:
admin/admin).
- gRPC Server Load Testing: Used K6 to simulate load for gRPC calls to the Add endpoint, ramping up users to 15000
docker-compose run --rm k6 run grpc-test.js
- Queue Waiting Time: Measured the time between receiving a message in the RabbitMQ queue and processing it.
- Whole Request Duration: Monitored the duration of gRPC and HTTP requests.
- CPU Usage: Used Prometheus to track CPU usage and system performance.
- Processed Message: Findout the number of processed messages