Skip to content

Commit ecb6514

Browse files
committed
test benchmark 3 añadido
1 parent 720a59a commit ecb6514

File tree

4 files changed

+77
-21
lines changed

4 files changed

+77
-21
lines changed

README.md

Lines changed: 36 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@ cd iot-bench
128128

129129
# 6. Ultra-Fast NestJS + SQLite (máximo rendimiento)
130130
./run_ultra_fast.sh
131+
132+
# 7. Ultra-Fast Spring Boot (comparación justa)
133+
./run_spring_ultra_fast.sh
131134
```
132135

133136
## 📁 Estructura del Proyecto
@@ -161,6 +164,8 @@ iot-bench/
161164
├── run_ultra_fast.sh # Benchmark Ultra-Fast NestJS
162165
├── ultra-fast-server.ts # NestJS optimizado al máximo
163166
├── ultra-fast.controller.ts # Controlador ultra-optimizado
167+
├── run_spring_ultra_fast.sh # Benchmark Ultra-Fast Spring Boot
168+
├── UltraFastController.java # Controlador Spring Boot optimizado
164169
└── clustered-server.js # Servidor multi-core clustering
165170
```
166171

@@ -186,6 +191,14 @@ iot-bench/
186191
- **Memory allocation** minimizada
187192
- **Sin background processing** ni overhead innecesario
188193

194+
### Spring Boot Ultra-Fast
195+
- **Spring Boot 3.2.0** completamente optimizado
196+
- **H2 Database** (in-memory, equivalente a SQLite)
197+
- **JdbcTemplate** con prepared statements
198+
- **Virtual Threads ON/OFF** para comparación
199+
- **Sin AsyncWorker** ni background processing
200+
- **Logging minimizado** para máximo rendimiento
201+
189202
### Node.js/Bun Puro
190203
- **Fastify 4.24.3** (framework web rápido)
191204
- **SQLite3** (in-memory, equivalente a H2)
@@ -260,12 +273,12 @@ iot-bench/
260273
4. **☕ Java tradicional MEJOR** que Virtual Threads para CPU: 4,413 req/sec
261274
5. **🎯 El workload determina todo**: I/O vs CPU cambia completamente el ranking
262275

263-
#### **Del Benchmark Ultra-Fast (¡CONFIRMACIÓN!):**
264-
1. **🚀 Bun + NestJS DOMINA**: 21,154 req/sec (**+89.6%** vs Node.js)
265-
2. **📊 Confirma benchmarks oficiales**: Bun SQLite es superior
266-
3. **🎯 Framework completo**: NestJS + decoradores + DI + Fastify
267-
4. **⚡ Optimización importa**: Eliminar overhead innecesario es clave
268-
5. **🏆 Bun puede ganar** cuando se optimiza correctamente
276+
#### **Del Benchmark Ultra-Fast (¡EMPATE TÉCNICO!):**
277+
1. **🏆 Spring Boot GANA**: 22,289 req/sec (VT OFF) - **Ganador absoluto**
278+
2. **🤝 Empate técnico**: Solo 5.4% diferencia entre Spring Boot y NestJS+Bun
279+
3. **🔥 NestJS + Bun**: Mejor latencia (92ms vs 135ms)
280+
4. **💡 Virtual Threads**: OFF mejor que ON para workloads simples (-1.3%)
281+
5. **🎯 Framework parity**: Ambos frameworks alcanzan ~21-22K req/sec optimizados
269282

270283
#### 💡 **Lecciones Universales:**
271284
- **Bun + APIs nativas** = Rendimiento superior
@@ -282,10 +295,12 @@ iot-bench/
282295

283296
| Framework | Runtime | Requests/sec | Transfer/sec | Latencia (avg) | Mejora vs Node.js | Rank |
284297
|-----------|---------|-------------|--------------|---------------|------------------|------|
285-
| **🥇 NestJS Ultra-Fast** | **Bun + SQLite nativo** | **21,154** | **3.47MB** | 92ms | **+89.6%** | **** 🚀 |
286-
| **🥈 NestJS Ultra-Fast** | **Node.js + SQLite3** | **11,157** | **2.35MB** | 120ms | **Referencia** | ****|
298+
| **🥇 Spring Boot Ultra-Fast** | **Java 21 (VT OFF)** | **22,289** | **3.60MB** | 135ms | **+99.8%** | **** 🚀 |
299+
| **🥈 Spring Boot Ultra-Fast** | **Java 21 (VT ON)** | **21,999** | **3.55MB** | 168ms | **+97.2%** | ****|
300+
| **🥉 NestJS Ultra-Fast** | **Bun + SQLite nativo** | **21,154** | **3.47MB** | 92ms | **+89.6%** | **** 🔥 |
301+
| **NestJS Ultra-Fast** | **Node.js + SQLite3** | **11,157** | **2.35MB** | 120ms | **Referencia** ||
287302

288-
### 🎯 **¡Finalmente Bun Domina con NestJS!**
303+
### 🎯 **¡Comparación Justa: Framework vs Framework!**
289304

290305
#### **Optimizaciones Aplicadas:**
291306
- **Prepared statements** reutilizados
@@ -294,10 +309,18 @@ iot-bench/
294309
- **Fastify ultra-optimizado**
295310
- **Bun.sqlite nativo** vs node-sqlite3
296311

297-
#### 📊 **Confirmación de Benchmarks Oficiales:**
298-
- **SQLite puro**: Bun 886K ops/sec vs Node.js 78K ops/sec (**+11.3x**)
299-
- **HTTP + SQLite**: Bun 21K req/sec vs Node.js 11K req/sec (**+89.6%**)
300-
- **Coincide con** [benchmarks oficiales de Bun](https://github.com/oven-sh/bun/tree/main/bench/sqlite)
312+
#### 📊 **Resultados Clave:**
313+
- **🏆 Spring Boot (VT OFF)**: 22,289 req/sec - **Ganador absoluto**
314+
- **⚡ Spring Boot (VT ON)**: 21,999 req/sec - Solo 1.3% más lento
315+
- **🔥 NestJS + Bun**: 21,154 req/sec - **Mejor latencia** (92ms)
316+
- **💡 Virtual Threads**: No siempre mejoran el rendimiento
317+
- **🎯 Empate técnico**: Diferencia mínima entre los 3 primeros
318+
319+
#### 🤔 **¿Por qué Virtual Threads OFF gana?**
320+
- **Menos overhead** de context switching
321+
- **Thread pool tradicional** optimizado para este workload
322+
- **Sin complejidad** de virtual thread scheduling
323+
- **Workload simple**: No necesita miles de threads concurrentes
301324

302325
---
303326

result_spring_ultra_fast_off.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Running 1m test @ http://localhost:8080/ultra/ingest
2+
12 threads and 2000 connections
3+
Thread Stats Avg Stdev Max +/- Stdev
4+
Latency 135.00ms 225.92ms 1.99s 92.07%
5+
Req/Sec 2.24k 1.02k 7.50k 68.49%
6+
1339516 requests in 1.00m, 216.36MB read
7+
Socket errors: connect 0, read 0, write 0, timeout 2538
8+
Requests/sec: 22288.74
9+
Transfer/sec: 3.60MB

result_spring_ultra_fast_on.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Running 1m test @ http://localhost:8080/ultra/ingest
2+
12 threads and 2000 connections
3+
Thread Stats Avg Stdev Max +/- Stdev
4+
Latency 167.61ms 300.63ms 2.00s 87.85%
5+
Req/Sec 2.46k 1.21k 6.80k 67.87%
6+
1320983 requests in 1.00m, 213.36MB read
7+
Socket errors: connect 0, read 0, write 0, timeout 3129
8+
Requests/sec: 21998.57
9+
Transfer/sec: 3.55MB

run_spring_ultra_fast.sh

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,19 +83,31 @@ echo "Cleaning up any existing processes..."
8383
pkill -f "iot-bench-0.1.0.jar" || true
8484
wait_for_port_free 8080
8585

86+
echo ""
87+
echo "=== Spring Boot Ultra-Fast (Virtual Threads OFF) ==="
88+
java -Xms2g -Xmx2g -jar $JAR --spring.threads.virtual.enabled=false --spring.profiles.active=ultrafast &
89+
SPRING_ULTRA_OFF_PID=$!
90+
wait_for_port_ready 8080
91+
echo "Running ultra-fast benchmark (Virtual Threads OFF)..."
92+
wrk -t12 -c2000 -d60s -s post.lua http://localhost:8080/ultra/ingest > result_spring_ultra_fast_off.txt
93+
stop_app $SPRING_ULTRA_OFF_PID "Spring Boot Ultra-Fast OFF"
94+
8695
echo ""
8796
echo "=== Spring Boot Ultra-Fast (Virtual Threads ON) ==="
8897
java -Xms2g -Xmx2g -jar $JAR --spring.threads.virtual.enabled=true --spring.profiles.active=ultrafast &
89-
SPRING_ULTRA_PID=$!
98+
SPRING_ULTRA_ON_PID=$!
9099
wait_for_port_ready 8080
91-
echo "Running ultra-fast benchmark..."
92-
wrk -t12 -c2000 -d60s -s post.lua http://localhost:8080/ultra/ingest > result_spring_ultra_fast.txt
93-
stop_app $SPRING_ULTRA_PID "Spring Boot Ultra-Fast"
100+
echo "Running ultra-fast benchmark (Virtual Threads ON)..."
101+
wrk -t12 -c2000 -d60s -s post.lua http://localhost:8080/ultra/ingest > result_spring_ultra_fast_on.txt
102+
stop_app $SPRING_ULTRA_ON_PID "Spring Boot Ultra-Fast ON"
94103

95104
echo ""
96105
echo "=== SPRING BOOT ULTRA-FAST RESULTS ==="
97-
echo "Spring Boot Ultra-Fast (Virtual Threads):"
98-
grep -E "(Requests/sec|Transfer/sec|Latency)" result_spring_ultra_fast.txt || echo "No results found"
106+
echo "Spring Boot Ultra-Fast (Virtual Threads OFF):"
107+
grep -E "(Requests/sec|Transfer/sec|Latency)" result_spring_ultra_fast_off.txt || echo "No results found"
108+
echo ""
109+
echo "Spring Boot Ultra-Fast (Virtual Threads ON):"
110+
grep -E "(Requests/sec|Transfer/sec|Latency)" result_spring_ultra_fast_on.txt || echo "No results found"
99111

100112
echo ""
101113
echo "=== COMPARISON WITH NESTJS ULTRA-FAST ==="
@@ -111,8 +123,11 @@ if [ -f "result_ultra_fast_node.txt" ]; then
111123
echo ""
112124
fi
113125

114-
echo "Spring Boot Ultra-Fast (Java + H2):"
115-
grep -E "(Requests/sec|Transfer/sec)" result_spring_ultra_fast.txt || echo "No results"
126+
echo "Spring Boot Ultra-Fast (Java + H2 + Virtual Threads OFF):"
127+
grep -E "(Requests/sec|Transfer/sec)" result_spring_ultra_fast_off.txt || echo "No results"
128+
echo ""
129+
echo "Spring Boot Ultra-Fast (Java + H2 + Virtual Threads ON):"
130+
grep -E "(Requests/sec|Transfer/sec)" result_spring_ultra_fast_on.txt || echo "No results"
116131

117132
echo ""
118133
echo "🎯 FAIR COMPARISON: Framework vs Framework (Ultra-Optimized)"

0 commit comments

Comments
 (0)