AWS Burst Credit Patterns
Baseline, burst credits/capacity trong EC2 T, EFS, EBS gp2/st1/sc1, DynamoDB
Tổng quan
Trong AWS, một số service/feature có behavior kiểu:
Dùng thấp hơn baseline → tích credit/capacity.
Dùng cao hơn baseline → tiêu credit/capacity để burst.
Hết credit → quay về baseline, throttle, hoặc bị tính thêm phí tùy service.
Đây là pattern phổ biến cho workload trung bình thấp nhưng thỉnh thoảng tăng vọt:
Các service/feature quan trọng có behavior này:
- EC2 T instances (
t2,t3,t3a,t4g) — CPU credits - EFS Bursting throughput — burst credits cho file system throughput
- EBS gp2 — I/O credits cho IOPS
- EBS st1/sc1 — throughput credits / burst bucket
- DynamoDB provisioned mode — burst capacity ngắn hạn
Mental model: baseline + credits + burst
Hãy nhớ 3 lớp:
Ví dụ đời thường:
Điểm quan trọng: burst không phải vô hạn. Nó chỉ phù hợp khi workload có peak ngắn hạn, không phải workload cao liên tục.
Amazon EC2 T instances: CPU credits
Các instance burstable như:
có baseline CPU utilization và CPU credits.
AWS định nghĩa CPU credit là đơn vị vCPU-time:
Cơ chế:
Standard mode
Trong Standard mode:
Phù hợp nếu bạn muốn kiểm soát chi phí và chấp nhận performance giảm khi hết credits.
Unlimited mode
Trong Unlimited mode:
T3/T3a/T4g thường dùng Unlimited mặc định. Vì vậy có thể thấy instance vẫn chạy CPU cao dù CPUCreditBalance thấp, nhưng có khả năng phát sinh charge thêm.
Metrics cần monitor
CloudWatch metrics:
CPUCreditBalance— số CPU credits còn lạiCPUCreditUsage— CPU credits đã dùngCPUSurplusCreditBalance— surplus credits trong Unlimited modeCPUSurplusCreditsCharged— surplus credits bị tính phí
Khi nên dùng
Dùng EC2 T instances khi workload:
- CPU thường thấp
- thỉnh thoảng spike
- không cần CPU cao liên tục
Ví dụ:
- bastion host
- dev/test server
- small web app
- low-traffic API
Không nên dùng nếu app cần CPU cao liên tục. Khi đó nên chọn fixed-performance instances như m, c, r families tùy workload.
Amazon EFS Bursting throughput: burst credits
EFS Bursting throughput dùng burst credits cho file system throughput.
Cơ chế:
Baseline phụ thuộc vào lượng data trong EFS Standard storage class:
Ví dụ:
Read throughput được tính ưu đãi hơn write:
| Size trong EFS Standard | Baseline write | Burst write | Baseline read | Burst read |
|---|---|---|---|---|
| 100 GiB | 5 MiB/s | 100 MiB/s | 15 MiB/s | 300 MiB/s |
| 1 TiB | 50 MiB/s | 100 MiB/s | 150 MiB/s | 300 MiB/s |
| 10 TiB | 500 MiB/s | 1 GiB/s | 1.5 GiB/s | 3 GiB/s |
Max burst credit balance:
| File system size | Max burst credit balance |
|---|---|
| Nhỏ hơn 1 TiB | 2.1 TiB credits |
| Lớn hơn 1 TiB | 2.1 TiB credits cho mỗi 1 TiB stored |
Điều này cho phép file system burst liên tục tối đa khoảng 12 giờ khi credits đầy.
Ví dụ 100 GiB
Metrics cần monitor
BurstCreditBalance— số burst credits còn lạiPermittedThroughput— throughput tối đa EFS đang cho phépMeteredIOBytes— throughput thực tế đang dùng
Lưu ý hiện đại
AWS hiện khuyến nghị Elastic throughput cho workload spiky/unpredictable hoặc khó forecast. Elastic throughput tự scale theo activity và không accrues/consumes burst credits.
Vì vậy:
Amazon EBS gp2: I/O credits
gp2 là General Purpose SSD thế hệ cũ của EBS. Nó dùng I/O credits để burst IOPS.
Baseline IOPS:
Quy tắc:
Ví dụ:
Cơ chế:
AWS cho biết gp2 có:
Số này đủ để volume burst tối đa 3,000 IOPS trong ít nhất khoảng 30 phút.
Ví dụ burst duration
Formula:
Với 100 GiB gp2:
Metric cần monitor
BurstBalance— phần trăm I/O credits còn lại
Đừng nhầm với gp3
gp3 không dùng burst performance. gp3 có baseline ổn định và có thể provision thêm IOPS/throughput độc lập với volume size.
Amazon EBS st1 và sc1: throughput credits
st1 và sc1 là HDD-backed EBS volumes, tối ưu theo throughput hơn là IOPS.
st1— Throughput Optimized HDD, cho dữ liệu thường xuyên truy cập, sequential I/O lớnsc1— Cold HDD, cho dữ liệu ít truy cập, chi phí thấp hơn
Cả hai dùng burst bucket model:
st1
Với st1:
Ví dụ 1 TiB st1:
sc1
Với sc1:
Ví dụ 1 TiB sc1:
Khi nên dùng
Dùng st1/sc1 khi workload là:
- large sequential reads/writes
- log processing
- big data scan
- data warehouse staging
- cold data scan
Không phù hợp cho workload small random I/O. Với random I/O, dùng SSD volume như gp3 hoặc io2.
Amazon DynamoDB provisioned mode: burst capacity
DynamoDB có behavior gần giống, nhưng không gọi là credit balance kiểu EC2/EFS.
Trong provisioned mode, bạn cấu hình:
Nếu table không dùng hết capacity, DynamoDB có thể giữ lại unused capacity để xử lý spike ngắn hạn.
AWS nói DynamoDB giữ tối đa:
Ví dụ:
Khác với EC2/EFS/EBS
DynamoDB burst capacity có vài điểm khác:
- Không nên coi là capacity đảm bảo tuyệt đối.
- DynamoDB có thể dùng burst capacity cho background maintenance mà không báo trước.
- Chi tiết burst capacity có thể thay đổi trong tương lai.
- Nếu spike kéo dài hoặc vượt quá table/partition limit, vẫn bị throttle.
DynamoDB còn có adaptive capacity để xử lý hot partition tốt hơn. Adaptive capacity tự động tăng capacity cho partition nhận traffic cao, miễn là không vượt tổng table capacity hoặc partition maximum.
Những dịch vụ dễ nhầm nhưng không dùng burst credits
Không phải cứ “scale” hoặc “burst traffic” là dùng credit bucket.
EBS gp3
gp3 không dùng burst performance.
EFS Elastic throughput
EFS Elastic throughput tự scale theo workload activity và không dùng burst credits.
Lambda
Lambda scale bằng concurrency và quota, không phải burst credit bucket theo kiểu EC2 T/EFS/EBS. Có các khái niệm như account concurrency, reserved concurrency, provisioned concurrency, scaling rate — nhưng không phải “tích credit lúc idle rồi tiêu lúc peak”.
Auto Scaling Group
ASG scale bằng cách tăng/giảm số EC2 instances theo policy. Đây là horizontal scaling, không phải burst credits.
So sánh nhanh
| Service / Feature | Resource burst | Baseline dựa trên | Credit/capacity | Hết credit/capacity |
|---|---|---|---|---|
| EC2 T instances | CPU | Instance type | CPU credits | Standard: về baseline; Unlimited: có thể tính phí thêm |
| EFS Bursting | File throughput | EFS Standard size | Burst credits | Về baseline throughput |
| EBS gp2 | IOPS | Volume size | I/O credits | Về baseline IOPS |
| EBS st1 | Throughput | Volume size | Throughput credits | Về baseline throughput |
| EBS sc1 | Throughput | Volume size | Throughput credits | Về baseline throughput |
| DynamoDB provisioned | RCU/WCU ngắn hạn | Provisioned capacity chưa dùng | Burst capacity ~5 phút | Throttle nếu vượt khả năng phục vụ |
Cách nhận diện trong đề thi AWS
Nếu đề có các keyword sau, nghĩ tới burst-credit pattern:
Map keyword sang service:
| Keyword trong đề | Nên nghĩ tới |
|---|---|
| CPU low average, occasional high CPU | EC2 T instances |
| Shared file system, throughput scales with storage, burst credits | EFS Bursting |
| EBS SSD old generation, burst to 3,000 IOPS | EBS gp2 |
| Large sequential HDD workload, throughput burst bucket | EBS st1/sc1 |
| Provisioned RCU/WCU, temporary read/write spike | DynamoDB burst capacity |
Cách chọn nhanh:
[!TIP] Trong thiết kế thực tế, nếu workload spike thường xuyên, kéo dài, hoặc khó dự đoán, đừng chỉ dựa vào credits. Hãy cân nhắc mode/service có performance ổn định hoặc tự scale tốt hơn:
gp3,EFS Elastic throughput, DynamoDB on-demand, hoặc EC2 fixed-performance instances.
Nguồn tham khảo
- Key concepts for burstable performance instances - Amazon EC2
- Monitor CPU credits for burstable instances - Amazon EC2
- Amazon EFS performance specifications
- CloudWatch metrics for Amazon EFS
- Amazon EBS General Purpose SSD volumes
- Amazon EBS Throughput Optimized HDD and Cold HDD volumes
- Amazon EBS CloudWatch metrics
- DynamoDB burst and adaptive capacity