Skip to content

DeeBi9/CDN-using-Go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CDN Project

Overview

This project is a Content Delivery Network (CDN) built using Docker and a microservices architecture. It consists of the following components:

  • Backend Service: Serves content to clients.

  • Load Balancer: Distributes traffic across multiple backend instances.

  • Edge Service: Acts as a caching layer for efficient content delivery.

  • Monitoring Stack: Uses Prometheus and Grafana for tracking performance and metrics.

This is a dummy CDN.

Setup & Installation

1. Prerequisites

2. Clone the Repository

git clone git@github.com:{your_username}/CDN-using-Go
cd CDN-using-Go

3. Start the Services

docker compose -f docker/docker-compose.yaml up --build -d

4. Verify running Containers

docker ps

Expected Output :
docker-backend-1    Running
docker-loadbalancer-1  Running
docker-edge-1    Running

Usage

Accessing the Services

Backend Service :

curl http://localhost:8081

Load Balancer :

curl http://localhost:8080

Edge Service :

curl http://localhost:8082

Load Balancer Test

To verify traffic distribution, run :

for i in {1..5}; do curl http://localhost:8080; echo ""; done

This should return responses from different backend instances.

Check Logs :

docker logs docker-loadbalancer-1

Monitoring with Grafana and Prometheus

Access Prometheus

Prometheus scrapes metrics from services. Open Prometheus UI at :

http://localhost:9090

Access Grafana

Grafana provides visual dashboards. Open Grafana at :

http://localhost:3000

(Default login: admin/admin)

Import the Dashboard (Grafana)

1.Open Grafana → Dashboards → Import

2.Upload the provided grafana-dashboard.json

3.Select Prometheus as the data source

4.Click Import

View Metrics in Prometheus

Run queries such as :

rate(http_requests_total[5m])

etcetra.....

API Endpoints

Service Endpoint Description
Backend / Returns Content
Load Balancer / Distributes requests
Edge / Cached Content

Stopping & Restarting

Stop all services :

docker compose -f docker/docker-compose.yaml down

Restart with fresh build :

docker compose -f docker/docker-compose.yaml up --build

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published