💸 Cloud Cost Optimization for Data Engineers
“Data càng lớn, bill càng đau.” Trên AWS/GCP/Azure, tối ưu chi phí là kỹ năng sống còn của Data Engineer. Mục tiêu: giảm cost 30–70% mà không thắt cổ chai hiệu năng. Chiến lược xoay quanh 4 mảng: Storage/Data Lake, Warehouse/Query, Compute cho ETL/ELT/Big Data, và FinOps + Guardrails.
Nội dung bài viết
1️⃣ Storage & Data Lake – Cất nhiều nhưng phải khéo
Kỹ thuật lõi
-
Tiering & Lifecycle Rule: tự động chuyển Hot ↔ Cool/Archive theo tuổi dữ liệu.
-
Định dạng & nén: ưu tiên Parquet/ORC + Snappy/ZSTD; bỏ CSV trừ khi ingest tạm.
-
Partitioning & Layout: theo date/tenant; tránh “quá chi tiết” gây nhiều small files.
-
Compaction & Small files: gom file ~128–512MB để tối ưu scan & shuffle.
-
Table format: Iceberg/Delta/Hudi cho snapshot/time travel, vacuum, clustering.
-
Schema evolution có kỷ luật: thêm cột “append-only”, hạn chế rewrite full table.
Best tips theo cloud
-
AWS:
-
S3 Intelligent-Tiering cho data ít truy cập;
-
S3 Glacier Instant Retrieval cho log cũ cần tra cứu nhanh;
-
Bật S3 Request Metrics để phát hiện request “đốt tiền”.
-
-
GCP:
-
Autoclass cho GCS;
-
Object Versioning có kiểm soát (lưu ý nhân bản cost);
-
GCS Compose để giảm small files.
-
-
Azure:
-
Hot/Cool/Archive;
-
Immutable cho log audit (compliance rẻ);
-
ADLS Gen2 hierarchical namespace tối ưu analytic.
-
Use case tiết kiệm
-
Log 12 tháng: 30 ngày ở hot, ngày 31–180 chuyển cool, >180 vào archive → giảm 40–60% phí lưu trữ.
2️⃣ Warehouse & Query – Trả tiền theo byte, tối ưu ngay trong SQL
Kỹ thuật lõi
-
Partition/Cluster:
-
BigQuery: Partition BY DATE, Cluster BY user_id/country;
-
Snowflake: Clustering keys khi cần;
-
Redshift: dist/ sort keys hợp lý.
-
-
Pruning & Projection:
SELECT
đúng cột; pushdown predicates; tránhSELECT *
. -
Approx/Sketch:
APPROX_TOP_COUNT
, HLL++; sampling cho dashboard thăm dò. -
Materialized View / Summary Table: tiền tính daily KPI; dashboard đọc MV thay vì scan 2TB fact.
-
Workload Management: slot/warehouse theo khung giờ; tách BI interactive vs batch heavy.
Best tips theo cloud
-
Snowflake: Auto-suspend 60–120s, warehouse nhỏ scale-out khi cần; tận dụng Result Cache.
-
BigQuery: Byte-limit per query; Reservations chia slot theo team; BI Engine cache dashboard.
-
Redshift: Short Query Acceleration, Concurrency Scaling có quota; Spectrum khi đọc S3.
Use case tiết kiệm
-
Dashboard ngày chỉ đọc MV 100GB thay vì quét fact 2TB → cost query giảm ~95%.
3️⃣ Compute cho ETL/ELT & Big Data – Chạy nhanh, dừng gọn
Kỹ thuật lõi
-
Ephemeral cluster: EMR/Dataproc/Synapse tạo–chạy–auto-terminate sau job.
-
Spot/Preemptible: batch chịu gián đoạn; checkpoint/idempotent để an toàn.
-
Incremental & CDC: đẩy delta, tránh full refresh; merge-on-read (Hudi) hoặc MERGE (Delta/Iceberg).
-
Vectorized processing: DuckDB/Polars cho job nhỏ → khỏi spin Spark.
-
Spark tiết kiệm: AQE, Dynamic Allocation, G1/Parallel GC hợp lý, shuffle file consolidation.
Best tips theo cloud
-
AWS EMR: Instance Fleet + 60–80% Spot, Managed Scaling, EMRFS consistent.
-
GCP Dataproc: Preemptible worker, autoscaling policy, DPMS (serverless Spark) cho job bursty.
-
Azure Synapse/Spark: Auto-Pause pool, chọn SKU vừa đủ, serverless SQL cho ad-hoc.
Use case tiết kiệm
-
Job nightly 2h: 70% Spot + checkpoint 5’ → tiết kiệm >50% compute mà vẫn ổn định.
4️⃣ FinOps, Networking & Guardrails – Không quản là “cháy ví”
Kỹ thuật lõi
-
Budget & Alert theo project/env/team; tag/label bắt buộc (owner, env, cost_center).
-
Catalog & Governance: data contract, quy ước schema → hạn chế bảng rác & duplicate.
-
Egress & Cache: hạn chế cross-region/cloud; Private Link/Peering; cache kết quả nóng.
-
Observability chi phí: dashboard cost/pipeline, cost/table, USD per 1k events / per report.
Best tips theo cloud
-
AWS: Cost Explorer + Budgets, S3 Request Metrics, Compute Optimizer.
-
GCP: Cloud Billing Export → BigQuery + Looker Studio report; Recommender.
-
Azure: Cost Management + Advisor; Policy bắt buộc tag/sku.
Use case tiết kiệm
-
Budget alert 70/90/100% + auto scale-down warehouse ngoài giờ hành chính → tránh overprovision 16h/ngày.
5️⃣ Governance bổ sung (ít nói nhưng “ăn tiền”)
-
Retention & Time Travel: đặt số ngày hợp lý (Iceberg/Delta) + vacuum định kỳ.
-
PII cost: tokenize/partition riêng PII để truy vấn không kéo theo dữ liệu nhạy cảm (cost + compliance).
-
Multi-tenant: tách bucket/dataset/role → dễ chargeback/showback.
📈 KPI & Báo cáo “nói chuyện được với sếp”
-
Storage: $/TB/tháng; % hot vs cool/archive; số small files; tỷ lệ compaction đạt chuẩn.
-
Warehouse: $/query; scanned bytes/query; cache hit rate; % dashboard đọc MV.
-
Compute: $/job; preempt rate; runtime p95; % Spot/Preemptible; cost per 1k rows processed.
-
FinOps: % tài nguyên có tag; budget breach; egress $; idle time %.
🚀 Lộ trình 30–60–90 ngày (gợi ý thực thi)
30 ngày (Quick wins)
-
Bật lifecycle cho log/data lạnh; auto-suspend warehouse; giới hạn byte-limit BQ; budget + alert.
-
Tạo MV cho top 3 dashboard đốt tiền.
60 ngày (Stabilize)
-
Áp dụng Spot/Preemptible cho batch; compaction & file sizing; AQE/Dynamic Allocation Spark.
-
Dashboard cost theo pipeline/table; policy tag bắt buộc.
90 ngày (Scale & Govern)
-
Chuẩn hóa Iceberg/Delta/Hudi cho lakehouse; CDC/incremental end-to-end.
-
Slot/warehouse reservation theo team; chargeback/showback.
☑️ Checklist Audit Cost – 1 trang (in dán cạnh màn hình)
Storage
-
Lifecycle Hot→Cool→Archive?
-
Parquet/ORC + Snappy/ZSTD?
-
File size 128–512MB, compaction chạy daily?
-
Iceberg/Delta/Hudi + vacuum?
Warehouse
-
Partition/Cluster đúng chiều truy vấn?
-
MV/summary tables cho dashboard nặng?
-
Byte-limit/slot/warehouse policy?
-
SELECT
đúng cột, cấmSELECT *
?
Compute
-
Ephemeral cluster + auto-terminate?
-
Spot/Preemptible + checkpoint/idempotent?
-
AQE/Dynamic Allocation bật?
-
DuckDB/Polars cho job nhỏ?
FinOps & Network
-
Budget 70/90/100% + alert?
-
Tag/label bắt buộc (owner/env/cost_center)?
-
Cross-region egress tối thiểu, có peering/private link?
-
Dashboard cost/pipeline/table & cost per unit?
Governance
-
Retention/time-travel hợp lý?
-
PII tách partition/bucket, tokenize?
-
Policy review hàng quý?
💡 Insight chốt
Tối ưu chi phí không phải “cắt tính năng” mà là kỷ luật kiến trúc + vận hành: format chuẩn, partition đúng, MV thông minh, compute “chạy xong dừng”, và FinOps có dashboard–policy rõ ràng.
Hotline: 0352.433.233
Website: mcivietnam.com

Các khóa học
- Mastering AWS : From Basics to Applications Specialized
- Data Engineer Track Specialized
- Combo Data Engineering Professional Hot
- AI & DASHBOARD – CHỈ 990K Hot
- Combo Python Level 1 & Level 2 Bestseller
- Business Intelligence Track Hot
- Data Science Track Bestseller
- Data Analyst Professional (Data Analyst with Python Track) Bestseller
- RPA UiPath Nâng Cao: Chiến Thuật Automation Cho Chuyên Gia Specialized
- RPA UiPath cho Người Mới Bắt Đầu: Thành Thạo Automation Chỉ Trong 1 Ngày Specialized
- Business Analyst Fast Track Bestseller
- Business Analyst Bestseller
Đăng ký tư vấn khóa học
*Vui lòng nhập số điện thoại của bạn
*Vui lòng nhập họ tên của bạn
*Vui lòng chọn giới tính
*Vui lòng chọn 1 trường