MLOps

Cutting Spark cluster cost by 60%

Most Spark spend is wasted in places that are easy to fix: the wrong storage format, partitions that are too small, avoidable shuffles, and clusters idling overnight.

BigAI data engineering team
· 1 min read · Updated

This is drawn from a cost-reduction engagement for a customer running roughly 340 Spark jobs a day.

1. Measure before optimising {#measure}

The first step is always a per-job cost dashboard. On this project, 12 jobs accounted for 68% of total spend — optimising exactly those twelve produced nearly all the value.

Without that measurement, teams usually optimise whichever job they happen to be looking at.

2. Seven techniques applied {#techniques}

  1. Move to a columnar format. Several jobs still read JSON and CSV. Switching to Parquet immediately cut bytes read by 40–60%.
  2. Fix partition sizing. Thousands of small files meant scheduling overhead exceeded actual compute time.
  3. Remove avoidable shuffles. Reordering joins and using broadcast joins for small tables.
  4. Enable Adaptive Query Execution. Let Spark adjust partition counts against real data volumes.
  5. Right-size the instance type. Many jobs were I/O bound, not CPU bound, so high-core machines were pure waste.
  6. Shut down idle clusters. Development clusters were running overnight, unnoticed.
  7. Filter and project early. Push predicates and column selection as close to the source as possible.

3. Results {#results}

Total infrastructure cost fell 60% in six weeks, with no architecture change and no rewrite of business logic.

Worth noting: the first four techniques delivered 80% of the saving. The remaining three were worth doing but would not have justified the project on their own.

Related content

How RAG works and when to fine-tune instead

The two approaches are often framed as alternatives. RAG solves a knowledge problem; fine-tuning solves a behaviour problem. Confusing them is a common way to overspend.

Start with a free 60-minute data assessment

A BigAI solution engineer will review your current data estate with you, identify the highest-value problem to solve and sketch a realistic roadmap. No commitment.

  • Data maturity assessment
  • 2–3 use cases with clear ROI
  • Budget and timeline estimate

By submitting this form you agree to the BigAI Privacy Policy.

Hotline Free consultation