Threads, connections, queues và downstream budgets
Capacity là chuỗi queue; tăng maxThreads chỉ chuyển bottleneck nếu database, CPU hoặc dependency không có headroom.
Capacity
Resource layers
SYN/listen queue → accepted connections → connector/poller → executor queue/threads → application bulkhead → DB/HTTP pool. Đo active, queued, wait và reject ở từng layer để tìm queue đầu tiên tăng.
Little's Law
Trong steady state, concurrency xấp xỉ throughput × latency. Dùng arrival distribution và service-time percentiles thực tế; average che tail. Capacity target cần SLO, overload policy và headroom cho GC/dependency variance.
Executor configuration
Connector có internal executor hoặc shared Executor. maxThreads, min spare, queue size và virtual-thread executor có semantics/version riêng. Virtual threads giảm scarcity của carrier cho blocking nhưng không tăng CPU, DB connection hay remote quota.
Overload behavior
Bound queue, timeout, admission control và 503 sớm thường an toàn hơn unbounded latency. Load test phải giữ input constant khi đổi một limit; quan sát p99, error, CPU, allocation, DB acquire và recovery sau spike.