Data Integration
Amazon EMR (Elastic MapReduce)
Managed Big Data Platform, Spark, Hadoop, Hive, Presto, 3 deployment options
Giới thiệu
Amazon EMR (Elastic MapReduce) là managed cluster platform giúp chạy các big data frameworks như Apache Spark, Hadoop, Hive, Presto để xử lý và phân tích petabytes of data.
Đặc điểm chính
| Đặc điểm | Mô tả |
|---|---|
| Managed Service | AWS quản lý cluster, bạn focus vào data processing |
| Scalable | Xử lý từ GB đến PB data |
| Cost-effective | Per-second billing, Spot Instances support |
| Open Source | Spark, Hadoop, Hive, Presto, Flink... |
| Flexible | EC2, EKS, hoặc Serverless deployment |
Kiến trúc
EMR Cluster Nodes
| Node Type | Vai trò | Bắt buộc |
|---|---|---|
| Master Node | Quản lý cluster, run YARN ResourceManager | ✅ Yes |
| Core Node | Chạy tasks + lưu data trong HDFS | Tùy chọn |
| Task Node | Chỉ chạy tasks, không lưu data | Tùy chọn |
Storage Options
| Storage | Đặc điểm | Dùng khi |
|---|---|---|
| HDFS | Ephemeral, distributed, fast I/O | Temporary processing |
| EMRFS (S3) | Persistent, scalable, cost-effective | Long-term storage |
| Local FS | Instance storage | Buffers, caches |
EMRFS = EMR File System - cho phép EMR đọc/ghi S3 như file system thông thường
Deployment Options
EMR có 3 deployment options:
So sánh Deployment Options
| EMR on EC2 | EMR on EKS | EMR Serverless | |
|---|---|---|---|
| Quản lý | Bạn quản lý cluster | Bạn quản lý EKS | AWS quản lý hoàn toàn |
| Control | Full control instances | Container-level | Chỉ submit jobs |
| Scaling | Manual/Managed | Kubernetes autoscaling | Auto (fine-grained) |
| Spot support | ✅ | ✅ (EC2 mode) | ❌ |
| Best for | Long-running, predictable | Kubernetes shops | Bursty, batch jobs |
Frameworks hỗ trợ
| Framework | Dùng để | Đặc điểm |
|---|---|---|
| Apache Spark | General processing, ML, streaming | In-memory, rất nhanh |
| Apache Hadoop | Batch processing | MapReduce traditional |
| Apache Hive | SQL queries on big data | Data warehouse style |
| Presto | Interactive SQL queries | Fast, federated queries |
| Apache Flink | Real-time streaming | Low latency |
| Apache HBase | NoSQL database | Random read/write |
| Apache Hudi | Data lake transactions | ACID on data lakes |
| TensorFlow/MXNet | Machine Learning | Distributed ML training |
Use Cases
Pricing
Per-second billing (1-minute minimum)
| Deployment | Chi phí |
|---|---|
| EMR on EC2 | EC2 price + EMR uplift (varies by instance) |
| EMR on EKS | EKS price ($0.10/hr) + EC2/Fargate + EMR uplift |
| EMR Serverless | vCPU/hr + Memory/hr + Storage/hr |
Cost Optimization Tips
| Strategy | Tiết kiệm |
|---|---|
| Spot Instances | Đến 90% cho Task nodes |
| EMR Serverless | Chỉ trả cho resources dùng |
| Auto-termination | Terminate cluster khi xong job |
| Right-sizing | Chọn instance types phù hợp |
Ví dụ pricing
So sánh với các services khác
| Service | Dùng khi |
|---|---|
| EMR | Big data processing với open-source frameworks (Spark, Hadoop) |
| AWS Glue | Serverless ETL, nhẹ hơn EMR |
| Athena | Ad-hoc SQL queries trên S3 (không cần cluster) |
| Redshift | Data warehouse, structured data |
| Kinesis | Real-time streaming ingestion |
EMR vs Glue
| EMR | AWS Glue | |
|---|---|---|
| Type | Cluster-based | Serverless ETL |
| Control | Full control, flexible | Limited, managed |
| Frameworks | Nhiều (Spark, Hadoop, Hive...) | Spark only |
| Pricing | Per-second (cluster) | Per DPU-hour |
| Best for | Complex processing, ML | Simple ETL jobs |
Exam Tips
Key Points cho Cloud Practitioner
| Câu hỏi | Đáp án |
|---|---|
| "Process petabytes of data với Hadoop/Spark?" | Amazon EMR |
| "Managed big data cluster platform?" | Amazon EMR |
| "Run Apache Spark on AWS?" | Amazon EMR |
| "ETL với full control, nhiều frameworks?" | Amazon EMR |
| "Simple serverless ETL?" | AWS Glue (không phải EMR) |