# Baseline Performa & Sumber Daya (Performance Baseline) Dokumen ini mencatat metrik baseline awal sebelum dan sesudah optimasi sumber daya pada KeluargaMart Monorepo. --- ## 1. Spesifikasi Server Target (Hostinger KVM 2) | Parameter Hardware | Kapasitas Server | |---|---| | **Virtualisasi** | KVM | | **Penyedia** | Hostinger | | **CPU** | 2 vCPU (Dual Core) | | **Memory (RAM)** | 8 GB RAM | | **Penyimpanan** | 100 GB NVMe Disk | | **Bandwidth** | 8 TB / bulan | | **Public Gateway** | Cloudflare Tunnel | --- ## 2. Metrik Pengukuran Aktual (Measured vs Estimated) ### A. Kompilasi & Build Artifacts (Measured) - **Go Backend Executable**: `apps/backend/bin/server` - Ukuran binary: **18 MB** (dikompilasi dengan `-trimpath -ldflags="-s -w"`) - Waktu kompilasi bersih: **~2.8 detik** - **Shared Packages**: - `@keluargamart/contracts`: ~12 KB (368 rute) - `@keluargamart/permissions`: ~8 KB (198 permissions) - `@keluargamart/utils`: ~6 KB - `@keluargamart/api-client`: ~5 KB - **Frontend Production Bundles**: - `apps/erp/dist`: ~4.2 MB (aset statis terkompresi) - `apps/pos/dist`: ~3.8 MB (aset kasir terkompresi) - `apps/b2b/.output`: ~24 MB (termasuk Nitro serverless runtime) ### B. Hasil Pengujian Unit & Durasi (Measured) - **Total Test Files**: 80 files - **Total Unit Tests**: **643 unit tests passing (100% pass rate, 0 failures)** - **Waktu Eksekusi Suite**: - Go Backend: ~2.5s (semua modul internal) - ERP: ~37.4s (39 test files, 344 tests) - POS: ~31.7s (20 test files, 111 tests) - B2B: ~17.7s (20 test files, 170 tests) - Shared Packages: ~0.5s (18 tests) --- ## 3. Estimasi Alokasi Memori Container Produksi (Target Budget) | Container Service | Alokasi CPU (Limit) | RAM Idle (Estimasi) | Hard Cap RAM (Limit) | Memory Reservation | |---|---|---|---|---| | **Go Backend (`apps/backend`)** | 1.0 vCPU | ~30 MB | **768 MB** (`GOMEMLIMIT=512MiB`) | 128 MB | | **B2B Nuxt SSR (`apps/b2b`)** | 0.8 vCPU | ~65 MB | **512 MB** (`max-old-space=256MB`) | 128 MB | | **ERP SPA (`apps/erp`)** | 0.5 vCPU | ~12 MB | **128 MB** (Nginx static) | 32 MB | | **POS SPA (`apps/pos`)** | 0.5 vCPU | ~12 MB | **128 MB** (Nginx static) | 32 MB | | **NextReport (`apps/nextreport`)** | 0.8 vCPU | ~40 MB | **512 MB** (Chromium/Node) | 64 MB | | **PostgreSQL 16** | 1.0 vCPU | ~45 MB | **1024 MB** (1.0 GB) | 256 MB | | **Redis 7** | 0.2 vCPU | ~15 MB | **128 MB** (maxmemory 96MB) | 32 MB | | **Total Container Limits** | — | **~219 MB** | **~3.20 GB (Maksimal)** | **~672 MB** | > **Analisis Kapasitas:** Dari total 8 GB RAM VPS Hostinger, batas atas seluruh container hanya mengonsumsi **~3.2 GB RAM (40%)**. Sisa **~4.8 GB RAM (60%)** dialokasikan penuh untuk kernel OS Linux, SSH, disk buffer cache, dan agen Cloudflare Tunnel.