Skip to content

Benchmark

Hiệu suất In-Memory

Thao tác cache trực tiếp (không có network overhead):

╔══════════════════════════════════════════════════════╗
║  Cache Operations (5000 ops, 1000 keys)            ║
╠══════════════════════════════════════════════════════╣
║  GET:   120,000+ ops/sec   avg: 0.008ms            ║
║  SET:   131,000+ ops/sec   avg: 0.008ms            ║
║  MIXED: 119,000+ ops/sec   (80% read, 20% write)   ║
╚══════════════════════════════════════════════════════╝

Phân phối dữ liệu

╔══════════════════════════════════════════════════════╗
║  1000 keys trên 3 nodes                             ║
║  node-0: 365 keys (36.5%) ██████████████████████   ║
║  node-1: 346 keys (34.6%) █████████████████████    ║
║  node-2: 289 keys (28.9%) ████████████████████     ║
╚══════════════════════════════════════════════════════╝

Thực tế: Tích hợp Medusa.js

Benchmark với Medusa server đang chạy và PostgreSQL:

TestThroughputAvgP50P95P99
GET /products (100 items)22 req/sec45ms44ms52ms97ms
GET /products?limit=1030 req/sec34ms33ms42ms56ms
10 concurrent requests6 req/sec171ms170ms206ms239ms

Kết quả chính: Cache reads nhanh hơn PostgreSQL queries 5600 lần.

Cách chạy

bash
# Benchmark in-memory
npm run benchmark

# Test sử dụng bộ nhớ
npm run memory

# Benchmark tích hợp Medusa
cd medusa && node scripts/benchmark-real.js

Released under the MIT License.