Skip to content

dolamasa1/Node.js-vs-Spring-Boot-Messenger-Benchmark

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

32 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

๐Ÿš€ Spring Boot vs Node.js Messenger Benchmark

A performance testing platform that compares Spring Boot vs Node.js backends with real-time analytics andmetrics visualization.

Version License Spring Boot Node.js Go MySQL

๐Ÿ“‹ Overview

This project is a performance testing dashboard featuring for enterprise dual backend implementations repos with identical API contracts, enabling precise technology comparison real-time performance analytics through real-world messenger application testing.

๐Ÿ“‹ why this project

I found a gap in the backend when comparing real data with the many articles discussing non-real data. I needed answers about how far one technology is ahead of another in certain tests, and whether this difference is worth the disadvantages that come with that technology. Thatโ€™s why I decided to start this project.

๐Ÿ–ผ๏ธ Dashboard Preview

Dashboard Screenshot

๐Ÿ—๏ธ Architecture

The Architecture  Diagram

Spring Boot vs Node.js Messenger Benchmark/
โ”œโ”€โ”€ ๐ŸŽจ frontend/                 # Performance Testing Dashboard (Port 3000)
โ”œโ”€โ”€ โš™๏ธ middleware/go/           # Go Performance Engine (Port 8090)
โ”œโ”€โ”€ โ˜• backend/springboot/       # Spring Boot Backend (Port 8080 + 5001)
โ”œโ”€โ”€ โฌข backend/nodejs/           # Node.js Backend (Port 5000)
โ””โ”€โ”€ ๐Ÿ”จ build/                   # Build scripts

๐Ÿš€ Quick Start

Prerequisites

  • Java 17+ (Spring Boot)
  • Node.js 18+ (Node.js backend & frontend)
  • Go 1.21+ (Middleware)
  • MySQL 8.0+ (Database)

older versions not tested 100%

1. Clone & Setup

git clone https://github.com/dolamasa1/Spring-Boot-vs-Node.js-messenger.git
cd Spring-Boot-vs-Node.js-messenger

# Initialize submodules
git submodule update --init --recursive

2. Quick Database Setup

CREATE DATABASE messenger_db;
CREATE USER 'messenger_user'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON messenger_db.* TO 'messenger_user'@'localhost';

3. Start Backends

Spring Boot (Port 8080):

cd backend/springboot
mvn clean install
mvn spring-boot:run

Node.js (Port 5000):

cd backend/nodejs
npm install
npm start

4. Start Go Middleware (Port 8090)

cd middleware/go
go run *.go
 
## or

go run .

5. Frontend hosted via(Port 3000)

cd frontend
python -m http.server 3000
# or: npx http-server -p 3000
# or: php -S localhost:3000

the port matters because of the cors security configuration in the backends

6. Dashboard Access

based on http://localhost:3000 in your browser.

โšก Technology Stack

Component Technology Purpose
Frontend (Native HTML) Vanilla JS + CSS3 Performance dashboard with real-time animations
Middleware Go 1.21+ High-performance testing engine and holder
Backend A Spring Boot 3.2 + Java 17 Enterprise Java implementation
Backend B Node.js 18 + Express 4.x JavaScript runtime implementation
Database MySQL 8.0 Data persistence for both backends
NOTE: we didn't fully tryed older versions

๐ŸŽฏ Key Features

๐Ÿ”ฌ Important Features and Comparison of Performance

  • Dual Backend Testing: Distinct technologies but identical API contracts
  • Real-time Metrics: Real-time performance monitoring accompanied by animated graphics
  • Advanced Timing: Distinguish language processing overhead from HTTP time
  • Statistical Analysis: throughput, success rates, and P95/P99 percentiles ๐ŸŽจ Improved Dashboard

๐ŸŽจ Enhanced Dashboard

  • Animated Metrics: fluid counter animations with real-time updates
  • Progress Tracking: Real-time progress indicators with completion data
  • Console Output: Timestamps and color-coded logging

๐Ÿงช Testing Scenarios

  • POST Tests: Message creation and user registration
  • GET Tests: User lists and message history
  • Mixed Loads: Real-world request patterns
  • Stress Testing: High-concurrency performance limits

needed to be increased more and more

๐Ÿ’ฌ Messenger Features

  • Real-time Chat: WebSocket messaging with user presence
  • Group Management: Multi-user chat rooms
  • File Sharing: Images, voice messages, documents
  • JWT Authentication: Secure user management

๐Ÿ”Œ API Endpoints (Both Backends)

Core Endpoints

  • POST /api/auth/login - JWT authentication
  • POST /api/auth/register - User registration
  • GET /api/user/ - User search and lists
  • POST /api/message/send - Send messages
  • POST /api/group/create - Group management
  • GET /api/health - System monitoring

Real-time Features

  • Spring Boot: Dual WebSocket (Spring + Socket.IO on port 5001)
  • Node.js: Socket.IO real-time messaging
  • User Presence: Online/offline status tracking

โšก Performance Characteristics

Spring Boot (Java)

  • โœ… Strengths: Better CPU performance, strong typing, enterprise features
  • โŒ Weaknesses: Higher memory usage, slower startup
  • ๐ŸŽฏ Best For: CPU-intensive operations, large teams

Node.js Express

  • โœ… Strengths: Faster startup, better I/O, rapid development
  • โŒ Weaknesses: Single-threaded limitations, callback complexity
  • ๐ŸŽฏ Best For: I/O-intensive apps, real-time features

Go Middleware

  • Exclusive Engine: Replaced JavaScript middleware for superior performance
  • High Concurrency: Goroutine-based request handling
  • Accurate Metrics: Millisecond-precision timing with real values

๐Ÿ› ๏ธ Configuration

Spring Boot (application.properties)

spring.datasource.url=jdbc:mysql://localhost:3306/messenger_db
app.jwt.secret=your-jwt-secret
app.websocket.type=both

Node.js (.env)

DB_HOST=localhost
DB_NAME=messenger_db
JWT_SECRET_KEY=your-jwt-secret
PORT=5000

Go Middleware

  • Port: 8090 (fixed)
  • CORS: Enabled for frontend integration
  • Concurrency: Configurable worker pools

๐Ÿงช Testing Workflow

  1. Configure Settings: Set backend endpoints and authentication
  2. Authenticate: Connect to both backends using JWT tokens
  3. Select Scenario: Choose test type and parameters
  4. Execute Tests: Run via Go middleware with real-time monitoring
  5. Analyze Results: Compare metrics with animated visualizations

Anticipated Outcomes

Typical Performance Patterns: Spring Boot: Better type safety and consistent performance under CPU load; Node.js: Better I/O management and quicker response times for multiple requests at once- Go Middleware: 3-5 times more throughput than the outdated JavaScript version

Metric Comparisons: Response Times: Actual millisecond measurements, not zeros; Throughput: Requests per second based on the actual test duration; Success Rates: Accuracy based on HTTP status codes; Resource Usage: Analysis of memory and CPU efficiency

๐Ÿ› Repairing

Fast Verification ```bash # Verify every service curl http://localhost:8080/api/health # http://localhost:5000/api/health # Spring Boot curl Node.js curl http://localhost:8090/api/health # Go Middleware

Verify ports using netstat -tulpn | grep -E ':(8080|5000|8090|3000)' ```

Common Issues

  • CORS Errors: Serve frontend via HTTP server, not file protocol
  • Database Connection: Verify MySQL is running and credentials match
  • Authentication: Check JWT tokens and backend connectivity
  • Port Conflicts: Ensure ports 8080, 5000, 8090, 3000 are available

๐Ÿ“š Component Records

[Frontend Dashboard] with a Real-time testing interface (./frontend/README.md)- [Backend Comparison] (./backend/README.md): Nodejs vs Spring Boot

  • [Go Middleware] (./middleware/go/README.md) High-performance testing performance and HTTP holder - [Configuration] (./config/README.md): One shared recourse endpoints and settings

๐Ÿ”ฎ Roadmap

Upcoming Version and Vesion (v1.1)

  • RealTime Communication testing with a send recieve live stream - [ ] only a map for future microservices architecture - [ ] Examples of deployments

Research Extensions - [ ] Other backend technologies (.NET and Python)

  • sophisticated caching techniques (Redis)

Participating

My vision is an open source Documentaion about the actual data backend benchmarks so I welcome everyone to contribute and show better and better backend performance for a pure testing to the nural for each backend tech stack For more information, please refer to our Contributing Guide.

๐Ÿ“„ Permit

MIT License - For complete information, see the LICENSE file.

๐Ÿ‘จโ€๐Ÿ’ป Writer

Ahmed Adel Moghraby ๐Ÿ“ง [[email protected]] (email: [email protected])
๐ŸŒ [GitHub: dolamasa1] (https://github.com/dolamasa1)


Designed for accurate performance analysis * Comparable features, distinct technologies, and when and what to use..*