Skip to content

hamidrezaghavami/Voltex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Voltex: High-Throughput API Gateway & Cache Proxy

A containerized, production-grade backend infrastructure simulating an API gateway, reverse proxy, and distributed caching layer. This project demonstrates high-availability routing, traffic throttling, and multi-tier network isolation using a decoupled microservices architecture.

Architecture & Network Topology

The infrastructure enforces strict security isolation across two independent Docker networks. The database layer has zero visibility to the public internet, mitigating potential attack surfaces.

                  [ External Client Requests ]
                               │
                               ▼
            ┌──────────────────────────────────────┐
            │       Nginx Reverse Proxy            │
            │   (Attached to: frontend-network)    │
            └──────────────────┬───────────────────┘
                               │
            ┌──────────────────┴───────────────────┐
            │        Backend Application           │
            │  (Attached to: frontend & backend)   │
            └──────────────────┬───────────────────┘
                               │
            ┌──────────────────┴───────────────────┐
            │     Redis Cache & Rate Limiter       │
            │   (Attached to: backend-network)     │
            └──────────────────────────────────────┘

Network Design

  • frontend-network: Isolated bridge network for ingress traffic. Bridges the Nginx edge proxy and the application layer.
  • backend-network: Isolated bridge network for internal data transit. Bridges the application layer and the Redis instances. Nginx cannot access this network.

Technical Core & Learning Objectives

1. Advanced Docker Networking & Containerization

  • Multi-Tier Networks: Designing manual bridge networks within Docker to isolate stateful services from edge proxies.
  • Service Discovery: Leveraging Docker's embedded DNS server for configuration-less communication via service names.
  • Data Persistence: Configuring automated volume management with Append-Only File (AOF) logging for crash-resilient storage state in Redis.

2. Nginx Traffic Routing & Load Balancing

  • Reverse Proxying: Port masking and header forwarding (X-Real-IP, X-Forwarded-For) to preserve client state.
  • Upstream Round-Robin: Configuring Nginx upstream definitions to distribute loads uniformly across horizontally scaled application instances.
  • Infrastructure Hardening: Setting buffer thresholds, body size limits, and keep-alive timeouts directly in nginx.conf.

3. Redis High-Performance State Management

  • Cache-Aside Pattern: Mitigating database load by offloading expensive or frequent read queries to an in-memory key-value layer with defined Time-To-Live (TTL) windows.
  • Distributed Rate Limiting: Constructing middleware to log, increment, and expire client requests using atomic commands (INCR, EXPIRE) to prevent race conditions during concurrent high-throughput events.

Technical Stack

  • Reverse Proxy / Load Balancer: Nginx (Stable Alpine distribution)
  • Container Runtime: Docker & Docker Compose
  • In-Memory Store / Rate Limiter: Redis (OSS Edition)
  • Application Layer: Node.js / Go / Python (Any backend engine of choice executing the proxy rules)

Where This Project Is Useful

  • Microservice Foundations: Demonstrates how real-world service meshes orchestrate data securely between public ingress and private backends.
  • System Scale & Resilience: Serves as a sandbox to run load-testing tools (e.g., k6, wrk) to analyze how upstream proxy timeouts behave under synthetic traffic congestion.
  • Resume/Portfolio Validation: Provides explicit proof of structural system design capabilities, moving beyond simple application code into modern system architecture and infrastructure-as-code principles.

output:

  • Load and Testing: ✔ Container voltex_redis Running ✔ Container voltex_postgres Running voltex_backend | Server is running on port 3000 voltex_backend | 🚀 Redis Client Connected Successfully

  • Traffic simulation: Simulate traffic using k6 with the load-test.js script in the root directory: docker run --rm -i -v "$(pwd):/app" --add-host=host.docker.internal:host-gateway grafana/k6 run /app/load-test.js

  • k6 metrics output: █ TOTAL RESULTS

    checks_total.......: 400 39.497275/s checks_succeeded...: 50.00% 200 out of 400 checks_failed......: 50.00% 200 out of 400

    ✗ status is 200 (Passed Limiter) ↳ 9% — ✓ 19 / ✗ 181 ✗ status is 429 (Blocked by Redis) ↳ 90% — ✓ 181 / ✗ 19

    HTTP http_req_duration..............: avg=7.87ms min=1.06ms med=2.79ms max=60.17ms p(90)=19.22ms p(95)=45.74ms { expected_response:true }...: avg=17.82ms min=1.55ms med=5.97ms max=41.26ms p(90)=38.08ms p(95)=40.77ms http_req_failed................: 90.50% 181 out of 200 http_reqs......................: 200 19.748638/s

    EXECUTION iteration_duration.............: avg=1s min=1s med=1s max=1.06s p(90)=1.02s p(95)=1.05s
    iterations.....................: 200 19.748638/s vus............................: 20 min=20 max=20 vus_max........................: 20 min=20 max=20

    NETWORK data_received..................: 61 kB 6.0 kB/s data_sent......................: 16 kB 1.6 kB/s

running (10.1s), 00/20 VUs, 200 complete and 0 interrupted iterations default ✓ [ 100% ] 20 VUs 10s

About

Voltex is a containerized, high-performance backend infrastructure designed to simulate a production-grade API gateway and caching layer.

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors