Skip to content

High-performance traffic simulator comparing Node.js and Go backends with Docker & Redis.

Notifications You must be signed in to change notification settings

meanme13/traffic-simulator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Traffic Simulator: Node.js vs Go.

This project implements a client-server architecture with strict concurrency management and rate limiting. It serves as a benchmark tool to compare the real-time performance and resource consumption of Node.js and Go backends under load.

Tech Stack

Frontend: React 19, TypeScript, Vite, TailwindCSS, Recharts.
Backend (Node.js): NestJS, IoRedis.
Backend (Go): Go 1.25, Gin, Go-Redis.
Storage: Redis (Alpine) for atomic rate limiting.
Infrastructure: Docker, Docker Compose.
Testing: Jest, Vitest, Go testing package.

Features

  1. Traffic Scheduler: A custom client-side scheduler ensuring precise adherence to Concurrency and RPS limits without blocking the main thread.
  2. Dual Backend Implementation:
    • Node.js: Event-loop based architecture using NestJS.
    • Go: Goroutine-based architecture using Gin.
  3. Observability: Real-time visualization of server-side memory (RSS, Heap) and CPU usage via API telemetry.
  4. Reliability: Implements graceful shutdowns, Docker healthchecks, and Redis connection retry strategies.

How to Run

Prerequisites: Docker and Make.

make up to start app
make down to stop app
make test or make test-e2e to run Node.js Unit & E2E tests
make test-go to run Go Unit tests

Usage

  1. Navigate to http://localhost:5173.
  2. Input the desired Concurrency and RPS limits (e.g., 50).
  3. Click Start to begin the simulation.
  4. Observe the real-time logs and memory consumption graph.
  5. Use the "Server" dropdown to switch between Node.js and Go to compare resource efficiency.

About

High-performance traffic simulator comparing Node.js and Go backends with Docker & Redis.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published