Irene has to present the data platform budget to NovaMarket's management. She knows what she wants to build and she knows the data is reliable; what she is missing is a figure. And not just any figure: in Big Data it is easy to spend ten times more than necessary without anything working better, because almost all resources are paid for by use, and an oversight (a cluster nobody switched off, a query that reads a whole year every five minutes) turns into a bill.

In this lesson you will learn where the costs of a platform come from, how to estimate storage and compute from figures you already know, how to compare on-premises infrastructure with the cloud, and how to use the cost-saving levers you have been preparing without realising it since Module 2. You will write a calculator, estimate_costs.py, and use it to build NovaMarket's annual budget in three scenarios.

About the prices in this lesson. All the prices that appear are fictitious assumptions, chosen so that the proportions are plausible and the sums easy to follow. Real prices change frequently and depend on the provider, the region, the type of contract and the discounts. For a real budget, always use your provider's official pricing calculator. What you should take away from here is the method, not the figures.

Where the costs come from

A data platform has five sources of cost. The first four appear on the bill; the fifth, which is usually the largest, does not.

Source What you pay for What it depends on Example at NovaMarket
Storage GB stored per month Volume, format, compression, copies, retention The lake: bronze, silver and gold
Compute Processor and memory hours How much is processed, how efficiently and how long it is running The nightly load, Marc's queries, the fraud stream
Network GB transferred, above all those leaving the cloud Where the consumers of the data are Exporting results to an external system
Licences and managed services Subscriptions or a surcharge on compute The tools chosen A managed orchestrator, a paid BI tool
People Salaries of the team that builds and operates Complexity of the platform Laura, Marc and Irene

Two ideas worth being clear about from the start:

  • Storage is cheap; compute is not. Storing a GB costs cents a month. Processing it badly costs much more, and it is repeated every day.
  • People cost more than machines. In a small or medium-sized platform, the team far outweighs the infrastructure. A decision that saves €2,000 a year on servers and consumes a month of Laura's work is a bad deal. That is why managed services, which look more expensive, usually pay off.

Estimating storage

The formula

The space taken up by a dataset, once it has reached its steady state, is:

space = (daily volume at source ÷ compression ratio) × retention days × copies

Each factor is a decision you have already made at some point in the course:

Factor NovaMarket's figure Where it comes from
Daily volume 7.6 GB/day of events in JSON (2.77 TB/year) estimate_scale.py, lesson 01-01
Ratio JSON → JSON with gzip 13.5 37.77 MB → 2.79 MB (02-02)
Ratio JSON → Parquet with snappy 12.2 37.77 MB → 3.09 MB (02-02)
Ratio JSON → Parquet with zstd 22.8 37.77 MB → 1.66 MB (02-02)
Copies 3 in HDFS; in object storage, included in the price 02-01
Retention A business and legal decision This lesson

Orders, customers and products are negligible next to events (50,000 daily orders take up a few MB), so the estimate focuses on web_events.

The ratios deserve a caveat: you measured them on generated data, which is more regular than real data. With production data, always measure on a sample of your own before budgeting.

The zones add up

The lake does not store the data once, but three times:

  • Bronze keeps the original. If the JSON is stored as is, it is by far the bulkiest zone; compressed with gzip it takes up 13.5 times less. Since bronze is only read for reprocessing, the fact that gzip is not splittable (lesson 02-02) matters little.
  • Silver stores the same data, clean and in Parquet.
  • Gold contains aggregates: it is usually a small fraction of silver. Here 5% is assumed.

With two years of retention in each zone:

Zone Unoptimised Optimised
Bronze Uncompressed JSON: 7.6 × 730 = 5,548 GB JSON with gzip: 410 GB
Silver Parquet snappy: 454 GB Parquet zstd: 244 GB
Gold 5% of silver: 23 GB 12 GB
Total 6,025 GB 666 GB

Nine times less space with two format decisions. And in an on-premises HDFS cluster, the figure on the left is multiplied by three because of replication: more than 18 TB of raw disk.

Retention: how long each thing is kept

Retention is the most forgotten factor, because the cost of not deciding it grows silently, month after month. A retention policy states, for each dataset, how long it is kept and what happens afterwards.

Zone Proposed retention Reason
Bronze 2 years Allows reprocessing if a logic error is detected late
Silver 2 years Year-on-year comparisons
Gold Indefinite It is small and contains the history of the business
Quarantine 90 days If nobody has reviewed it in three months, nobody will

When there is personal data, retention is not only a question of cost: data protection regulations require that it is not kept longer than necessary for its purpose (developed in lesson 07-02). The specific periods must be validated by the person responsible for regulatory compliance.

Sizing compute

How to reason about the size of a job

On your laptop, Spark uses local[*]: all the cores of one machine. In a cluster you have to decide how many executors to request, with how many cores and how much memory each (lesson 03-02). There is no exact formula, but there is a line of reasoning that gives a good starting point:

  1. How many tasks there are. Spark splits the input into partitions of about 128 MB. The 7.6 GB of daily JSON make about 60 partitions, that is, 60 tasks in the first stage.
  2. How many cores. Each core runs one task at a time. With 16 cores, the 60 tasks are dispatched in four waves. Doubling the cores roughly halves the time, but only while there are tasks to distribute: with 200 cores for 60 tasks, 140 would sit idle.
  3. How many cores per executor. Between 4 and 5 is the usual value. Fewer wastes memory on repeated processes; many more degrades input/output performance and lengthens memory-management pauses.
  4. How much memory. As a starting point, about 4 GB per core, leaving room for each task to handle its partition comfortably. You have to add the overhead that Spark reserves outside the main memory (around 10%).
  5. The driver. 2-4 cores and a few GB are enough, unless a lot of data is brought back with collect() or toPandas(), which you already know how to avoid.

For NovaMarket's nightly load this gives: 4 executors with 4 cores and 16 GB each, plus a driver with 4 cores. 20 cores in total. It would be requested like this (illustrative, for a cluster managed by YARN):

spark-submit \
  --master yarn --deploy-mode cluster \
  --num-executors 4 --executor-cores 4 --executor-memory 14g \
  --driver-cores 4 --driver-memory 4g \
  --conf spark.sql.sources.partitionOverwriteMode=dynamic \
  daily_load.py 2026-06-15
  • --num-executors, --executor-cores and --executor-memory set the size. 14 GB is requested rather than 16 to leave room for the memory overhead within the machine.
  • --deploy-mode cluster makes the driver run in the cluster too, not on the computer it is launched from.

Then you measure and adjust. The Spark UI (lesson 03-04) tells you whether the executors are idle (there are too many), whether there is spilling to disk or memory errors (not enough memory, or skew) or whether a stage has very few tasks (not enough parallelism). Sizing is an iterative process: start with a reasonable estimate, measure with real data and correct.

What not to do: extrapolate from the laptop. The fact that the whole month takes half a minute on your machine with 38 MB does not let you predict how long 7.6 GB will take on a cluster; fixed costs, the shuffle and the network behave differently. You test with a representative sample in the real environment.

How long it is running

In the cloud, the cost of compute is cores × hours × price. The number of cores matters less than the hours:

Model What it consists of When it is appropriate
Permanent cluster Running 24 hours, whether it is used or not Continuous, stable workloads: stream processing, queries at all hours
Ephemeral cluster Created for a job and destroyed when it finishes Scheduled batch workloads, such as the nightly one
Autoscaling The cluster adds and removes nodes according to the load Load that varies throughout the day
Serverless No cluster is managed; you pay per query or per second of execution Sporadic or unpredictable use; teams with no time for administration

Ephemeral clusters are possible thanks to the separation of compute and storage (lesson 02-01): since the data lives in object storage and not on the cluster's disks, the cluster can be destroyed without losing anything.

The difference is huge. NovaMarket's nightly load needs 20 cores for an hour and a half:

  • Permanent cluster: 20 × 24 × 365 = 175,200 core-hours a year.
  • Ephemeral cluster: 20 × 1.5 × 365 = 10,950 core-hours a year.

Sixteen times less, for the same work. Spark can also adjust the number of executors during execution with dynamic allocation (spark.dynamicAllocation.enabled), which releases those that become idle.

The serverless model takes the idea to the extreme: zero cost when not in use. In exchange, the price per unit of work is higher, so with intensive, constant use it ends up more expensive than a well-utilised cluster of your own. Each provider's specific services are covered in lesson 06-04.

On-premises infrastructure or cloud

The classic decision. On-premises means buying servers and installing them in your own or a rented data centre; cloud, renting capacity from a provider and paying by use. Behind them are two forms of spending:

  • CAPEX (capital expenditure): a large initial outlay that is depreciated over several years. It is the model of on-premises infrastructure.
  • OPEX (operating expenditure): a recurring payment proportional to use. It is the model of the cloud.
Criterion On-premises infrastructure Cloud
Type of spending CAPEX: high initial investment OPEX: pay as you go
Start-up Weeks or months (purchase, installation) Minutes
Elasticity Sized for the peak; the rest of the time there is spare capacity Adjusts to demand
Cost with a stable, high load Usually lower in the long run Higher, except with discounted usage commitments
Cost with a variable or uncertain load High: you pay for idle capacity Lower
Operations An in-house team for hardware, network and base software Largely taken on by the provider
Main risk Falling short or buying too much A bill out of control; dependence on the provider
Control and location of the data Total Depends on region and contract; must be reviewed for compliance

To compare fairly, you use TCO (total cost of ownership): the sum of all the costs over the useful life. The typical mistake is to compare the purchase price of the servers with the annual cloud bill. The TCO of on-premises infrastructure also includes electricity and cooling, space, maintenance and spare parts, replacement every four or five years and, above all, the people who administer it. The cloud's includes data egress, managed services and the time spent controlling spending.

In practice, many organisations adopt a hybrid model: part in-house, out of inertia, regulation or very stable workloads, and part in the cloud.

Cost-saving levers

Almost all the optimisation techniques in the course are also cost-saving techniques, because what is not read, processed or stored is not paid for either.

Lever What it reduces Where you learnt it
Columnar format and compression Storage and data read 02-02
Partitioning and partition pruning Data read per query 02-04
Column pruning and predicate pushdown Data read per query 02-02, 03-04
Incremental processing instead of full reprocessing Daily compute 03-06
Aggregated gold tables Compute for each dashboard query 02-05, 04-05
Compacting small files Compute and calls to storage 03-04
Storage classes and lifecycle Price per GB This lesson
Retention policies GB stored This lesson
Interruptible instances Price per core-hour This lesson
Switching off what is not in use Compute hours This lesson
Quotas and limits The cost of carelessness This lesson

The cost of a badly designed query

Many SQL engines in the cloud charge by data read. Assume a fictitious price of €5 per TB. Marc wants the funnel for 15 June:

How the data is stored Data read Cost of the query
A year of unpartitioned JSON 2,774 GB €13.87
A year of Parquet without a date filter 227 GB €1.13
Partitioned Parquet, only date = 2026-06-15 0.62 GB €0.003
The above, reading only session_id and event_type Even less Negligible

The same question can cost four thousand times more or less depending on how the data was stored. And €13.87 does not seem serious until that query feeds a dashboard that refreshes every five minutes: 288 times a day comes to almost €4,000 a day. That is how the bills that make the news come about.

Storage classes and lifecycle

Providers offer several storage classes, cheaper the less immediate the access:

Class Price per GB Access What for
Hot The highest Immediate, no charge per read Data in daily use: gold, recent silver
Cold Intermediate Immediate, but you pay to read; minimum storage duration Data queried once in a while each month
Archive Very low Retrieval takes from minutes to hours, and is charged Data that is almost never read: old bronze, legal obligations

A lifecycle rule moves data from one class to another automatically according to its age, and deletes it at the end of its retention period. For NovaMarket's bronze: 30 days in hot (in case the latest load has to be reprocessed), 60 more in cold and the rest, up to two years, in archive. The trap lies in the cold classes: if they are read often, the read and retrieval fees outweigh what was saved. Only cool down what really is not touched.

Interruptible instances

Providers sell their spare capacity at large discounts (often more than half), on one condition: they can withdraw it at very short notice. These are called spot or preemptible instances. They suit Spark batch jobs, which tolerate the loss of an executor by recomputing its tasks, and even more so if the pipeline is idempotent: in the worst case, it is rerun. They are not suitable for anything that cannot be interrupted, such as the driver, a database or a streaming process with latency commitments.

Switch off, limit and don't repeat

  • Switch off what is not in use. Development clusters left running over the weekend, notebooks left open with a cluster behind them, forgotten test environments. Automatic shutdown on inactivity is the measure with the best ratio of effort to savings.
  • Avoid full reprocessing. Recalculating the whole history every night costs a little more each day. daily_load.py processes only the day's partition; the mistake in exercise 3 of lesson 03-06, forgetting the date filter, multiplied the cost by thirty.
  • Quotas and limits. A maximum of data read per query, a cap on cores per team, a maximum execution time. They do not save money day to day: they prevent disaster.

FinOps: managing cost as just another metric

FinOps is the discipline that makes the cost of the cloud a responsibility shared between engineering, finance and the business. Its central idea is simple: whoever decides how a resource is used must see what it costs. Its basic practices:

  • Tagging. Every resource (cluster, storage, job) carries tags: team, project, environment, pipeline. Without tags, the bill is a single figure that nobody can explain.
  • Cost per pipeline and per team. With tags, spending is allocated: how much the daily load costs, how much the fraud stream, how much the analytics queries. You usually discover that a few processes account for most of it.
  • Budgets and alerts. A monthly budget per team and warnings on reaching, for example, 50%, 80% and 100%. Also anomaly alerts: today's spending is double that of a normal day.
  • Unit cost. Dividing the cost by a business quantity: cost per order, per active customer or per thousand events processed. It is the metric that makes judgement possible: a 30% rise in the bill is good if orders have risen by 50% and bad if they have not changed.
  • Periodic review. A short monthly meeting: what has gone up, why, what gets switched off.

Notice the similarity with the previous lesson: rules, thresholds, alerts, an owner. Cost is governed in the same way as quality.

Case study: NovaMarket's budget

Irene wants to compare three options:

  • A. On-premises cluster. Six servers (the reasonable minimum for a cluster with replication 3 and fault tolerance), HDFS, and an additional half-time systems administrator.
  • B. Unoptimised cloud. Moving the traditional approach to the cloud: bronze in uncompressed JSON, always in the hot class, and a cluster running 24 hours a day.
  • C. Optimised cloud. Compressed bronze with a lifecycle, silver with zstd, an ephemeral cluster with interruptible instances for the nightly load, an analysis cluster that switches off outside working hours and a small permanent cluster for the fraud stream.

All three include stream processing, which by its nature runs 24 hours a day. The cost of the current team (Laura, Marc and Irene) is the same in all three and is left out of the comparison; the additional person that option A requires is counted.

The calculator

Create ~/novamarket/estimate_costs.py. It only uses the Python standard library:

"""Annual cost calculator for NovaMarket's data platform.

Usage:  python estimate_costs.py [SCALE_FACTOR]
SCALE_FACTOR multiplies the daily volume (default: 1).

WARNING: all prices are FICTITIOUS ASSUMPTIONS for teaching purposes.
Real prices change frequently and vary by region and provider:
always check your provider's official pricing calculator.
"""
import sys

SCALE = float(sys.argv[1]) if len(sys.argv) > 1 else 1.0

# --- Volume (figures from the course) -------------------------------------
GB_PER_DAY_JSON = 7.6 * SCALE       # web_events in uncompressed JSON (lesson 01-01)
RATIO_JSON_GZIP = 37.77 / 2.79      # ratios measured in lesson 02-02
RATIO_PARQUET_SNAPPY = 37.77 / 3.09
RATIO_PARQUET_ZSTD = 37.77 / 1.66
GOLD_OVER_SILVER = 0.05             # assumption: gold aggregates take up 5% of silver

# --- Prices: FICTITIOUS ASSUMPTIONS (euros) -------------------------------
PRICE_GB_MONTH = {"hot": 0.023, "cold": 0.010, "archive": 0.002}
PRICE_VCPU_HOUR = 0.06              # on-demand compute, memory included
SPOT_DISCOUNT = 0.65                # interruptible instances cost 65% less
PRICE_GB_EGRESS = 0.08              # data leaving the cloud
SERVER_PRICE = 9000                 # purchase of one node: 16 cores, 128 GB, 48 TB of disk
DEPRECIATION_YEARS = 4
ANNUAL_MAINTENANCE = 0.12           # support and spare parts: 12% of the purchase price per year
DATACENTRE_PER_SERVER_YEAR = 1200   # electricity, cooling and space
COST_PER_PERSON_YEAR = 55000        # total cost to the company of a technical profile


def storage_gb(bronze_ratio, silver_ratio, bronze_days, silver_days):
    """GB occupied in steady state (with retention already full), by zone."""
    bronze = GB_PER_DAY_JSON / bronze_ratio * bronze_days
    silver = GB_PER_DAY_JSON / silver_ratio * silver_days
    return {"bronze": bronze, "silver": silver, "gold": silver * GOLD_OVER_SILVER}


def cloud_cost(name, gb, bronze_split, vcpu_hours, spot_fraction, egress_gb_month):
    """Annual cost in the cloud. bronze_split: fraction of bronze in each class."""
    stor = sum(gb["bronze"] * frac * PRICE_GB_MONTH[cls] for cls, frac in bronze_split.items())
    stor += (gb["silver"] + gb["gold"]) * PRICE_GB_MONTH["hot"]
    stor *= 12
    compute = 0.0
    for use, hours in vcpu_hours.items():
        spot = spot_fraction.get(use, 0.0)
        compute += hours * PRICE_VCPU_HOUR * (1 - spot * SPOT_DISCOUNT)
    network = egress_gb_month * PRICE_GB_EGRESS * 12
    return {"scenario": name, "storage": stor, "compute": compute, "network": network,
            "extra_people": 0.0}


def on_prem_cost(name, gb, replication, min_nodes, extra_people):
    """Annual cost of an on-premises cluster (HDFS with replication)."""
    raw_tb = sum(gb.values()) * replication / 1000 / 0.75         # 25% free space
    nodes = max(min_nodes, int(raw_tb / 48) + 1)
    hardware = nodes * SERVER_PRICE * (1 / DEPRECIATION_YEARS + ANNUAL_MAINTENANCE)
    datacentre = nodes * DATACENTRE_PER_SERVER_YEAR
    # In an on-premises cluster, storage and compute are bought together: they go under "compute"
    return {"scenario": name, "storage": 0.0, "compute": hardware + datacentre, "network": 0.0,
            "extra_people": extra_people * COST_PER_PERSON_YEAR, "nodes": nodes}


# --- Three scenarios ------------------------------------------------------
HOURS_PER_YEAR = 24 * 365

# A. On-premises cluster: at least 6 nodes, an extra half-time systems administrator
gb_a = storage_gb(1, RATIO_PARQUET_SNAPPY, bronze_days=730, silver_days=730)
a = on_prem_cost("A. On-prem cluster", gb_a, replication=3, min_nodes=6, extra_people=0.5)

# B. Cloud "as is": uncompressed bronze, always hot, cluster running 24x7
gb_b = storage_gb(1, RATIO_PARQUET_SNAPPY, bronze_days=730, silver_days=730)
b = cloud_cost(
    "B. Unoptimised cloud", gb_b, {"hot": 1.0},
    vcpu_hours={"batch and analysis (20 vCPU 24x7)": 20 * HOURS_PER_YEAR * SCALE,
                "streaming (8 vCPU 24x7)": 8 * HOURS_PER_YEAR},
    spot_fraction={}, egress_gb_month=50 * SCALE,
)

# C. Optimised cloud: compressed bronze with lifecycle, zstd silver, ephemeral clusters
gb_c = storage_gb(RATIO_JSON_GZIP, RATIO_PARQUET_ZSTD, bronze_days=730, silver_days=730)
c = cloud_cost(
    "C. Optimised cloud", gb_c, {"hot": 30 / 730, "cold": 60 / 730, "archive": 640 / 730},
    vcpu_hours={"batch (20 vCPU, 1.5 h/night)": 20 * 1.5 * 365 * SCALE,
                "analysis (8 vCPU, 8 h, 220 days)": 8 * 8 * 220,
                "streaming (8 vCPU 24x7)": 8 * HOURS_PER_YEAR},
    spot_fraction={"batch (20 vCPU, 1.5 h/night)": 1.0}, egress_gb_month=50 * SCALE,
)


# --- Report ---------------------------------------------------------------
def thousands(x):
    """Formats a number with no decimals and a comma as thousands separator."""
    return f"{x:,.0f}"


print(f"Daily volume in JSON: {GB_PER_DAY_JSON:.1f} GB  (scale x{SCALE:g})")
print("FICTITIOUS PRICES: indicative result, not a real budget\n")

print(f"{'Steady-state storage (GB)':<30}{'bronze':>10}{'silver':>10}{'gold':>8}{'total':>10}")
for name, gb in [("A and B (JSON bronze, snappy)", gb_a), ("C (gzip bronze, zstd)", gb_c)]:
    print(f"{name:<30}{thousands(gb['bronze']):>10}{thousands(gb['silver']):>10}"
          f"{thousands(gb['gold']):>8}{thousands(sum(gb.values())):>10}")

print(f"\n{'Annual cost (EUR)':<24}{'storage':>10}{'compute':>10}{'network':>8}"
      f"{'people':>10}{'TOTAL':>10}")
for e in (a, b, c):
    total = e["storage"] + e["compute"] + e["network"] + e["extra_people"]
    e["total"] = total
    print(f"{e['scenario']:<24}{thousands(e['storage']):>10}{thousands(e['compute']):>10}"
          f"{thousands(e['network']):>8}{thousands(e['extra_people']):>10}{thousands(total):>10}")

print(f"\nNodes in the on-prem cluster: {a['nodes']}")
orders_per_year = 50_000 * 365 * SCALE
events_per_year = 40_000_000 * 365 * SCALE
print(f"Unit cost of scenario C: {100 * c['total'] / orders_per_year:.3f} cents per order, "
      f"{100 * c['total'] / (events_per_year / 1000):.4f} cents per thousand events")

The script has four parts:

  • Volume and prices, at the beginning and in named constants. This is the part you must change to adapt it to a real case: replace the fictitious prices with your provider's and the ratios with the ones you measure on your data. vCPU is the unit in which the cloud sells processor capacity: for practical purposes, it is equivalent to one core.
  • storage_gb applies the formula from the second section to each zone.
  • cloud_cost adds up storage (bronze split across classes; silver and gold in hot), compute (core-hours for each use, with the interruptible instance discount where indicated) and data egress.
  • on_prem_cost calculates how many servers are needed to store the data with replication and 25% free space, with a minimum, and adds up depreciation, maintenance, data centre and additional staff.

The result

cd ~/novamarket
python estimate_costs.py
Daily volume in JSON: 7.6 GB  (scale x1)
FICTITIOUS PRICES: indicative result, not a real budget

Steady-state storage (GB)         bronze    silver    gold     total
A and B (JSON bronze, snappy)      5,548       454      23     6,025
C (gzip bronze, zstd)                410       244      12       666

Annual cost (EUR)          storage   compute network    people     TOTAL
A. On-prem cluster               0    27,180       0    27,500    54,680
B. Unoptimised cloud         1,663    14,717      48         0    16,428
C. Optimised cloud              88     5,280      48         0     5,416

Nodes in the on-prem cluster: 6
Unit cost of scenario C: 0.030 cents per order, 0.0371 cents per thousand events

Interpretation and decision

  • Storage is almost irrelevant at this scale. Even unoptimised, €1,663 a year. Optimised, €88. Format decisions matter here less for what is stored than for what is read in each query.
  • Compute dominates, and within it, the hours. Moving from the permanent cluster (B) to ephemeral ones (C) cuts compute to a third. The nightly load, with interruptible instances, costs about €230 a year.
  • Streaming is the most expensive item in C. The 8 cores running all year amount to about €4,200, almost 80% of compute. It is the economic translation of the decision in lesson 01-04: batch for almost everything, streaming only where a requirement measured in seconds justifies it. Every use case moved to real time without needing it is paid for 24 hours a day.
  • The on-premises cluster does not compete at this size. Six servers for 18 raw TB is far more capacity than needed, and the half-time administrator costs more than the whole of option B. On-premises infrastructure starts to make sense with much larger volumes and a stable load, or when a regulation requires it.
  • The unit cost is tiny: three hundredths of a cent per order. With an average order value of €1,677, the platform pays for itself with a minimal improvement in conversion.

Irene's decision: option C, with a budget of about €6,500 a year (the estimate plus a 20% margin), an alert at 80% of the monthly budget and cost per order as a tracking indicator. And a note for management: the three-person team costs about thirty times more than the infrastructure; the investment that pays off most is the one that saves them time.

A final caveat about the exercise itself. The model leaves out real items: BI licences, the managed orchestrator, backups, development environments, provider support, taxes. An estimate like this one is useful for comparing options and spotting orders of magnitude, not for signing a contract.

Common Mistakes and Tips

  • Budgeting only for storage. It is the easiest to calculate and the least important. Start with compute and with the hours.
  • Forgetting the zones and the copies. The data is stored in bronze, silver and gold, and in HDFS each one is tripled.
  • Not setting retention. Without a policy, everything is kept forever and the cost can only grow.
  • Cooling data that is read. Cold classes charge per read and have a minimum storage duration; used badly, they make things more expensive.
  • Oversizing "just in case". Requesting 50 executors for a 60-task job does not speed it up; it only makes it more expensive. Measure before scaling up.
  • Using interruptible instances for what cannot be interrupted. The driver and critical streaming processes need guaranteed capacity.
  • Comparing the purchase price with the cloud bill. Compare TCO with TCO, people included.
  • Treating the prices in an example as real. That includes the ones in this lesson. They change, and each provider has its own pricing structure.
  • Optimising without measuring. Before spending a week reducing a cost, check how much it weighs on the bill. Tagging tells you where the money is.
  • Tip: add to each pipeline, alongside its duration and volume metrics, its estimated cost per run. A cost that is visible every day rarely gets out of control.

Exercises

Exercise 1: estimating by hand

A logistics company records 120 GB a day of vehicle positions in JSON. It wants to keep the original compressed with gzip for one year and a copy in Parquet with zstd for three years. Using NovaMarket's ratios (13.5 and 22.8) and the fictitious price of €0.023 per GB per month, calculate: (a) the GB in each zone in steady state; (b) the annual storage cost if everything is in the hot class; (c) what you would do to reduce it.

Exercise 2: changing the scale

Run python estimate_costs.py 100 to simulate a NovaMarket one hundred times bigger. Compare option C with the scale-1 one: what percentage of the total does storage represent in each case? Which item grows least? What do you conclude about how cost-saving priorities change with size? Also point out one limitation of the model when the scale factor is applied.

Exercise 3: reviewing a bill

A company's data team receives a monthly bill for €9,000, three times the usual amount. The tags show: €6,200 on a pay-per-data-read SQL engine, €2,100 on a development cluster and €700 on storage. Give a likely cause for each anomalous item and the measure that would have prevented it.

Solutions

Exercise 1

(a) Bronze: 120 ÷ 13.5 × 365 ≈ 3,244 GB. Silver: 120 ÷ 22.8 × 1,095 ≈ 5,763 GB. Total: about 9,000 GB.

(b) 9,007 × 0.023 × 12 ≈ €2,486 a year.

(c) Bronze is only read for reprocessing: a lifecycle rule that moves it to archive after 30 days. In silver, positions more than a year old will rarely be queried: cold class from 12 months onwards, or replacing the old detail with aggregates (positions per minute instead of per second). And ask the business whether three years of detail are really needed.

Common mistake: also multiplying by 3 "for replication". In cloud object storage, redundancy is included in the price per GB; multiplying by 3 applies when sizing the disks of an on-premises HDFS cluster.

Exercise 2

Annual cost (EUR)          storage   compute network    people     TOTAL
C. Optimised cloud           8,798    28,045   4,800         0    41,642

At scale 1, storage is €88 of €5,416, 1.6%. At scale 100, €8,798 of €41,642, 21%. Storage, the batch load and the network grow in proportion to volume; streaming and the analysis cluster, in the model, do not change. That is why the total is multiplied by less than eight rather than by a hundred, and the split shifts: in a small platform the priority is not to have compute running unnecessarily; in a large one, retention, compression and lifecycle become decisions worth tens of thousands of euros. The unit cost falls, from 0.030 to 0.002 cents per order: these are economies of scale.

Limitation: the scale factor is a linear simplification. With a hundred times more events, the fraud stream would not fit in 8 cores, the analysis team would be bigger and the nightly load would not scale in an exactly proportional way. The model is useful for seeing trends, not for budgeting for that company.

Exercise 3

  • SQL engine (€6,200): one or more queries that read much more than necessary and are repeated: a dashboard with automatic refresh on a table without a partition filter, or a SELECT * on raw data. Measures: a limit on data read per query, aggregated gold tables for dashboards, partitioning and a review of the most expensive queries.
  • Development cluster (€2,100): it was left running day and night, or someone scaled it up for a test and did not scale it back down. Measures: automatic shutdown on inactivity, a maximum size and a budget alert per environment.
  • Storage (€700): probably normal; not everything that appears on a bill is an anomaly.

The common measure that would have limited the damage: budget and anomaly alerts, which warn you on the second day rather than when the bill arrives.

Conclusion

The cost of a data platform comes from storage, compute, the network, licences and managed services and people. Storage is estimated from the daily volume, the compression ratio, retention and the copies, adding up the zones of the lake. Compute is sized by reasoning about tasks, cores and memory, and above all by deciding how long it is running: ephemeral clusters, autoscaling and serverless models avoid paying for idle capacity. The comparison between on-premises infrastructure (CAPEX) and the cloud (OPEX) is only fair in terms of TCO. The cost-saving levers are, for the most part, the course's technical best practices, complemented by the storage lifecycle, interruptible instances and limits; and FinOps provides the discipline to sustain it: tags, budgets, alerts and unit cost. With estimate_costs.py you have confirmed that, for NovaMarket, the optimised cloud costs a third of the unoptimised cloud and a tenth of an on-premises cluster, and that stream processing is its most expensive item.

Best practices, quality, governance and costs: you now have the criteria by which a platform is judged. Until now you have applied them to a single company, an online shop. But a bank that has to block a card in milliseconds, a hospital that handles health data or a factory with thousands of sensors make very different decisions with the same ingredients. In the next lesson, Case Studies Across Industries, you will go through five sectors to see how the architecture, latency and risks change depending on the problem, and which patterns are repeated in all of them.

© Copyright 2026. All rights reserved