Tanggal: 2 November 2025 Durasi Test: ~3 menit 27 detik Tool: k6 (Concurrent Load Test)
WebFlux secara signifikan lebih unggul dibanding Spring MVC + Virtual Thread dalam concurrent load test ini:
- 53% throughput lebih tinggi (9,777 req/s vs 6,393 req/s)
- 35% lebih cepat (7.18ms vs 11.01ms rata-rata)
- 40% lebih rendah P95 latency (14.83ms vs 24.69ms)
- 53% lebih banyak request (880,614 vs 575,379)
Pemenang: WebFlux (Reactive) π
Ramp up: 15 detik β 50 concurrent users
Hold: 30 detik β 100 concurrent users
Peak: 15 detik β 150 concurrent users
Ramp down: 30 detik β 0 users
Total: ~90 detik per service
- Sequential Isolated Testing - Setiap service ditest terpisah untuk menghindari contention database
- Cooldown 10 detik antar test agar database settling
- Fair comparison - Kedua service dapat full database resources
- Java Version: 21
- Spring Boot: 3.5.7
- Database: Shared (tested sequentially)
- Max Concurrent Users: 150 VUs
| Metric | WebFlux | Spring MVC | Pemenang | Peningkatan |
|---|---|---|---|---|
| Average | 7.18ms | 11.01ms | WebFlux | 35% lebih cepat |
| Median (P50) | 6.51ms | 9.70ms | WebFlux | 33% lebih cepat |
| P90 | 12.79ms | 21.11ms | WebFlux | 39% lebih cepat |
| P95 | 14.83ms | 24.69ms | WebFlux | 40% lebih cepat |
| Min | 0.44ms | 0.48ms | WebFlux | 8% lebih cepat |
| Max | 130.19ms | 140.96ms | WebFlux | 8% lebih cepat |
| Metric | WebFlux | Spring MVC | Pemenang | Peningkatan |
|---|---|---|---|---|
| Requests/detik | 9,776.97 | 6,392.97 | WebFlux | +53% lebih tinggi |
| Total Requests | 880,614 | 575,379 | WebFlux | +53% lebih banyak |
| Iterations/detik | 9,776.97 | 6,392.97 | WebFlux | +53% lebih tinggi |
| Metric | WebFlux | Spring MVC | Status |
|---|---|---|---|
| Success Rate | 100% | 100% | Keduanya sempurna β |
| Failed Requests | 0 | 0 | Keduanya sempurna β |
| Error Rate | 0.00% | 0.00% | Keduanya sempurna β |
| Metric | WebFlux | Spring MVC | Pemenang |
|---|---|---|---|
| Data Diterima | 130 MB (1.4 MB/s) | 164 MB (1.8 MB/s) | MVC (+26%) |
| Data Dikirim | 80 MB (890 KB/s) | 52 MB (582 KB/s) | WebFlux (+54%) |
| Req Blocked (avg) | 0.90Β΅s | 2.67Β΅s | WebFlux (-66%) |
| Req Receiving (avg) | 12.07Β΅s | 45.63Β΅s | WebFlux (-74%) |
| Req Sending (avg) | 4.12Β΅s | 4.91Β΅s | WebFlux (-16%) |
File: app_resource_20251102_235058.log
| Fase | CPU % | Memory (MB) | Threads | Open Files |
|---|---|---|---|---|
| Idle | 0.0% | 69-74 | 44 | 150 |
| Startup | 47.7-133% | 75-96 | 15 | 18-41 |
| Ramp Up | 108-145% | 96-138 | 15-16 | 41-118 |
| Steady State | 110-139% | 138-194 | 16 | 118-167 |
| Peak Load | 109-145% | 194-280 | 16 | 167 |
| Cooldown | 56.3% β 0% | 280 β 231 | 16 β 51 | 169 β 160 |
Observasi Kunci:
- Thread count rendah: 15-16 threads (reactive, non-blocking)
- CPU optimal: 108-145% saat load (1-1.5 cores)
- Memory growth: 69 MB β 280 MB saat load (lebih tinggi dari sebelumnya)
- File descriptors: 18 β 167 (stabil di peak)
File: app_resource_20251102_235242.log
| Fase | CPU % | Memory (MB) | Threads | Open Files |
|---|---|---|---|---|
| Idle | 0.0% | 35 | 40 | 101 |
| Startup | 52-135% | 78-105 | 15 | 20-62 |
| Ramp Up | 103-136% | 105-152 | 15 | 62-138 |
| Steady State | 112-135% | 152-191 | 15 | 138-167 |
| Peak Load | 91-132% | 191-207 | 15 | 166-168 |
| Cooldown | 75.5% β 0% | 207 β 195 | 15 β 49 | 168 β 101 |
Observasi Kunci:
- Thread count rendah: 15 threads (virtual threads enabled!)
- CPU moderate: 91-136% saat load (1-1.4 cores)
- Memory stabil: 35 MB β 207 MB saat load
- File descriptors: 20 β 168 (similar pattern dengan WebFlux)
| Metric | WebFlux | Spring MVC | Analisis |
|---|---|---|---|
| Peak CPU | 145.8% | 135.7% | WebFlux +7% lebih tinggi tapi menghasilkan +53% throughput |
| Avg CPU (load) | ~120% | ~120% | Keduanya similar CPU usage (~1 core) |
| CPU Efficiency | Sangat efisien | Efisien | WebFlux +53% lebih banyak request per CPU cycle |
Pemenang: WebFlux - Efisiensi CPU lebih baik = throughput +53% lebih tinggi dengan CPU similar
| Metric | WebFlux | Spring MVC | Pemenang |
|---|---|---|---|
| Idle Memory | 69 MB | 35 MB | MVC (baseline -49%) |
| Peak Memory | 280 MB | 207 MB | MVC (-26% lebih sedikit) |
| Memory Growth | 69 β 280 MB (+306%) | 35 β 207 MB (+491%) | WebFlux (growth lebih stabil) |
Pemenang: Spring MVC - Hemat 26% memory di peak load
| Metric | WebFlux | Spring MVC | Analisis |
|---|---|---|---|
| Idle Threads | 44 | 40 | Baseline similar |
| Active Threads | 15-16 | 15 | SAMA! Keduanya pakai 15 threads |
| Thread Model | Event loop (reactive) | Virtual threads (blocking) | Paradigma berbeda |
Pemenang: TIE - Thread count identik (virtual threads tidak terlihat di metrics)
| Metric | WebFlux | Spring MVC | Pemenang |
|---|---|---|---|
| Idle | 150 | 101 | MVC (lebih rendah) |
| Peak | 167 | 168 | TIE (hampir identik) |
| Growth | 18 β 167 (9x) | 20 β 168 (8.4x) | Similar growth pattern |
Pemenang: TIE - Connection handling serupa
00:00 - 00:03 Idle CPU: 0% Memory: 69-74 MB Threads: 44
00:03 - 00:13 App Start CPU: 47-133% Memory: 75-96 Threads: 15
00:13 - 00:43 Ramp Up CPU: 108-145% Memory: 96-138 Threads: 15-16
00:43 - 01:13 Steady 100VU CPU: 110-139% Memory: 138-194 Threads: 16
01:13 - 01:28 Peak 150VU CPU: 109-145% Memory: 194-280 Threads: 16
01:28 - 01:35 Shutdown CPU: 56β0% Memory: 280β231 Threads: 16β51
Observasi: CPU optimal di 108-145% (1-1.5 cores) - sangat efisien!
01:40 - 01:44 Idle CPU: 0% Memory: 35 MB Threads: 40
01:44 - 01:54 App Start CPU: 52-135% Memory: 78-105 Threads: 15
01:54 - 02:24 Ramp Up CPU: 103-136% Memory: 105-152 Threads: 15
02:24 - 02:54 Steady 100VU CPU: 112-135% Memory: 152-191 Threads: 15
02:54 - 03:09 Peak 150VU CPU: 91-132% Memory: 191-207 Threads: 15
03:09 - 03:16 Shutdown CPU: 75.5β0% Memory: 207β195 Threads: 15β49
Observasi: CPU moderate di 91-136% (1-1.4 cores) - tidak fully utilize multi-core
WebFlux:
Min βββββββββββ Max
0.44ms 6.51ms (P50) 14.83ms (P95) 130ms
MVC:
Min ββββββββββββββββββββ Max
0.48ms 9.70ms (P50) 24.69ms (P95) 141ms
Visualisasi: WebFlux 33-40% lebih cepat di semua percentile
WebFlux: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ 9,777 req/s
Spring MVC: ββββββββββββββββββββββββββββββββββββββββββββ 6,393 req/s
Visualisasi: WebFlux handle +53% lebih banyak request
checks.........................: 100.00% β 2641842 β 0
http_req_duration..............: avg=7.18ms min=438Β΅s med=6.51ms max=130.19ms p(90)=12.79ms p(95)=14.83ms
http_req_failed................: 0.00% β 0 β 880614
http_reqs......................: 880614 9776.966036/s
iterations.....................: 880614 9776.966036/s
vus............................: 1 min=1 max=149
vus_max........................: 150 min=150 max=150
checks.........................: 100.00% β 1726137 β 0
http_req_duration..............: avg=11.01ms min=484Β΅s med=9.7ms max=140.96ms p(90)=21.11ms p(95)=24.69ms
http_req_failed................: 0.00% β 0 β 575379
http_reqs......................: 575379 6392.972496/s
iterations.....................: 575379 6392.972496/s
vus............................: 1 min=1 max=149
vus_max........................: 150 min=150 max=150
TETAP di WebFlux dengan optimizations:
- β Performance sudah optimal (9,777 req/s)
- β Latency rendah (7.18ms average, 14.83ms P95)
- β CPU efficiency tinggi (+53% vs MVC)
- β Codebase sudah mature
- β Tidak perlu effort migrasi (save 18-25 jam development)