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
- Traffic Scheduler: A custom client-side scheduler ensuring precise adherence to Concurrency and RPS limits without blocking the main thread.
- Dual Backend Implementation:
- Node.js: Event-loop based architecture using NestJS.
- Go: Goroutine-based architecture using Gin.
- Observability: Real-time visualization of server-side memory (RSS, Heap) and CPU usage via API telemetry.
- 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
- Navigate to http://localhost:5173.
- Input the desired Concurrency and RPS limits (e.g., 50).
- Click Start to begin the simulation.
- Observe the real-time logs and memory consumption graph.
- Use the "Server" dropdown to switch between Node.js and Go to compare resource efficiency.