Site logo
Tác giả
  • avatar Nguyễn Đức Xinh
    Name
    Nguyễn Đức Xinh
    Twitter
Ngày xuất bản
Ngày xuất bản

AWS Instance Store là gì? Hướng dẫn toàn diện về EC2 Instance Store - Lưu trữ tạm thời hiệu suất cao

🧭 Giới thiệu

AWS Instance Store là dịch vụ lưu trữ tạm thời (ephemeral storage) được gắn trực tiếp vào máy chủ vật lý chạy Amazon EC2 instance. Khác với EBS (Elastic Block Store) hoạt động qua mạng, Instance Store cung cấp hiệu suất I/O cực cao nhưng dữ liệu sẽ mất hoàn toàn khi instance bị stop, terminate hoặc fail.

Instance Store phù hợp cho các workload yêu cầu hiệu suất cao như databases, cache systems, big data processing, và các ứng dụng có thể tái tạo dữ liệu từ nguồn khác.


🧩 Instance Store là gì?

Instance Store (còn gọi là ephemeral storage hoặc local storage) là ổ đĩa SSD hoặc NVMe được gắn trực tiếp vào máy chủ vật lý hosting EC2 instance của bạn.

🔹 Đặc điểm chính:

  1. Hiệu suất cực cao:

    • I/O trực tiếp không qua network
    • Độ trễ thấp (low latency)
    • Throughput cao
  2. Ephemeral (Tạm thời):

    • Dữ liệu mất khi stop/terminate instance
    • Không persist qua instance lifecycle
    • Mất dữ liệu khi hardware fail
  3. Miễn phí:

    • Bao gồm trong giá instance type
    • Không tính phí storage riêng
  4. Kích thước cố định:

    • Không thể resize sau khi launch
    • Size phụ thuộc vào instance type

⚙️ Cách hoạt động của Instance Store

Instance Store được pre-attached vào EC2 instance khi launch và hoạt động như một ổ đĩa cục bộ thông thường.

📋 Quy trình hoạt động:

  1. Launch EC2 instance với instance type hỗ trợ Instance Store
  2. Format và mount Instance Store volumes
  3. Sử dụng storage với hiệu suất cao
  4. Backup dữ liệu định kỳ ra external storage
  5. Mất dữ liệu khi instance lifecycle kết thúc

🎯 Sơ đồ Architecture:

┌─────────────────────────────────────┐
│          Physical Server            │
├─────────────────────────────────────┤
│  ┌─────────────┐  ┌───────────────┐ │
│  │ EC2 Instance│  │ Instance Store│ │
│  │             │──│   (NVMe/SSD)  │ │
│  │ Application │  │   Direct I/O  │ │
│  └─────────────┘  └───────────────┘ │
└─────────────────────────────────────┘

🔄 So sánh Instance Store vs EBS vs EFS

Tính năng Instance Store EBS EFS
Performance Rất cao (direct attached) Cao (network attached) Trung bình (shared)
Persistence ❌ Ephemeral ✅ Persistent ✅ Persistent
Cost ✅ Miễn phí (included) 💰 Tính phí riêng 💰 Pay per use
Backup ❌ Manual backup required ✅ EBS Snapshots ✅ Backup service
Encryption ❌ Không hỗ trợ ✅ Hỗ trợ đầy đủ ✅ Hỗ trợ đầy đủ
Multi-Attach ❌ Single instance ✅ Limited support ✅ Multiple instances
Size Flexibility ❌ Fixed size ✅ Resizable ✅ Auto-scaling
Availability ⚠️ Một số instance types ✅ Tất cả instance types ✅ Tất cả instance types
Latency 🚀 Thấp nhất 🔸 Thấp 🔹 Trung bình
IOPS 🚀 Up to 3.5M 🔸 Up to 256K 🔹 Up to 7K

💻 Instance Types hỗ trợ Instance Store

🔹 Compute Optimized (C-Series):

Instance Type Instance Store Performance Use Cases
c5d.large 1 x 75 GB NVMe Up to 2.3M IOPS Web servers, caching
c5d.xlarge 1 x 150 GB NVMe Up to 2.3M IOPS HPC, gaming
c5d.2xlarge 1 x 300 GB NVMe Up to 2.3M IOPS Scientific computing
c5d.4xlarge 1 x 600 GB NVMe Up to 2.3M IOPS Batch processing
c6gd.medium 1 x 59 GB NVMe Up to 2.1M IOPS ARM-based workloads

🔹 Memory Optimized (R-Series):

Instance Type Instance Store Performance Use Cases
r5d.large 1 x 75 GB NVMe Up to 2.3M IOPS In-memory databases
r5d.xlarge 1 x 150 GB NVMe Up to 2.3M IOPS Real-time analytics
r5d.2xlarge 1 x 300 GB NVMe Up to 2.3M IOPS High-performance databases
r6gd.medium 1 x 59 GB NVMe Up to 2.1M IOPS ARM-based memory workloads

🔹 Storage Optimized (I-Series):

Instance Type Instance Store Performance Use Cases
i3.large 1 x 475 GB NVMe Up to 3.3M IOPS NoSQL databases
i3.xlarge 1 x 950 GB NVMe Up to 3.3M IOPS Distributed file systems
i4i.large 1 x 468 GB NVMe Up to 3.5M IOPS Search engines
i4i.xlarge 1 x 937 GB NVMe Up to 3.5M IOPS Data warehouses

🎯 Use Cases phù hợp

✅ Phù hợp cho:

  1. High-Performance Databases:

    • NoSQL databases (MongoDB, Cassandra)
    • In-memory databases (Redis, Memcached)
    • Temporary database operations
  2. Big Data & Analytics:

    • Apache Spark temporary storage
    • Hadoop local processing
    • Data transformation workloads
  3. Cache Systems:

    • Application caching
    • CDN edge caching
    • Session storage
  4. High-Frequency Trading:

    • Low-latency applications
    • Real-time data processing
    • Market data feeds
  5. Gaming & Media:

    • Game asset caching
    • Video rendering temporary files
    • Live streaming buffers

❌ Không phù hợp cho:

  1. Critical data storage (không thể mất dữ liệu)
  2. Long-term persistence requirements
  3. Compliance yêu cầu encryption at rest
  4. Small workloads không cần high performance
  5. Cost-sensitive applications (nên dùng EBS gp3)

🚀 Performance Characteristics

🔹 IOPS Performance:

Instance Store IOPS by Type:
├── NVMe SSD (Latest generation)
│   ├── i4i.* : Up to 3.5M IOPS
│   ├── c5d.* : Up to 2.3M IOPS  
│   └── r5d.* : Up to 2.3M IOPS
├── SSD (Previous generation)
│   ├── i3.* : Up to 3.3M IOPS
│   └── m5d.* : Up to 2.6M IOPS
└── HDD (Legacy)
    └── d2.* : Up to 48K IOPS

🔹 Throughput Performance:

Instance Family Max Throughput Typical Latency
i4i (NVMe) Up to 16 GB/s < 100 μs
i3 (NVMe) Up to 16 GB/s < 100 μs
c5d/r5d (NVMe) Up to 9 GB/s < 100 μs
m5d (NVMe) Up to 6.6 GB/s < 100 μs

🎯 Kết luận

AWS Instance Store là lựa chọn tối ưu cho các workload yêu cầu hiệu suất I/O cực cao và có khả năng tái tạo dữ liệu.

✅ Instance Store phù hợp khi:

  • Cần performance I/O cực cao (>100K IOPS)
  • Dữ liệu có thể tái tạo hoặc replicated
  • Cost-sensitive workloads (không muốn trả phí storage)
  • Temporary processing requirements

❌ Không phù hợp khi:

  • Dữ liệu critical không thể mất
  • Cần persistence qua instance lifecycle
  • Yêu cầu encryption at rest
  • Infrequent access patterns

🚀 Takeaways quan trọng:

  1. Always backup: Implement robust backup strategy
  2. Monitor performance: Sử dụng CloudWatch và system tools
  3. Optimize configuration: Tune file system và application settings
  4. Plan for failure: Design application để handle data loss
  5. Cost analysis: So sánh với EBS cho từng use case

Instance Store là công cụ mạnh mẽ cho high-performance workloads nhưng cần thiết kế architecture cẩn thận để đảm bảo data durability và availability.


📚 Tài liệu tham khảo