Index

Free, with Google

Keep going, free.

A free account opens lessons 2 and 3 of every track, 33 more lessons, and keeps your progress and review cards on every device.

Start free with Google

A chalk plan

Open everything on chalk.

Every lesson, board, video, lab and paper, and the full review decks. Yearly is $39/year.

See plansStart free instead

Data Systems the lesson

The Choices Before the Requirements a show in 8 chapters

Goal: make the bakery chain's 3 choices before naming a database

1 of 8 Your guess

Before we start

Every app that remembers things, an order history, a feed, a bank balance, has a computer somewhere keeping them. Someone had to decide how.

You are that someone, for a new app. Which picture is closest to what you decide first?

Pick the closest. You find out which fits at the end.

one 2014 laptopits chip: a few cores,the run used the lit one128 cores8 boxes × 16 = 128A core: one worker inside a chip, doingone instruction after another.A cluster: many machines wired togetherto share one job.The paper counted cores, not machines.The boxes only make 128 easy to count.

2 of 8 The problem

A laptop against 128 cores

May 2015, a small workshop in Switzerland. Three researchers took the published results of big data systems, software built to spread one job across many computers, and asked what those papers rarely asked.

Not "how much faster with more machines?" but "is it faster than one ordinary computer doing the job alone?" They raced one core of a 2014 laptop against clusters of 128 cores.

Your goal: a chain of 40 bakeries wants its orders kept. Before anyone names a database, make its 3 choices: how many machines, where the number-crunching lives, and who runs it.

Step 1 of 4

time →machine 1machine 2machine 3machine 4work: 0 boxeswaiting for the slowest: 0talking, to swap and agree: 0one box: one unit of a machine's time (made up)

3 of 8 The cost

The bill for splitting

Split one job across machines and the pieces have to talk, wait for each other, and agree on who has what. Here are four machines on a made-up job, three rounds.

Press Play to run three rounds.

Step 1 of 6

the bakery's orders, kept as a tableshopitempricetimeShop 3rye loaf4.5009:02Shop 17croissant2.2009:02Shop 3cake18.0009:03Shop 40bun1.1009:03Shop 8rye loaf4.5009:04Shop 21tart3.8009:04Shop 17bun1.1009:05Shop 3croissant2.2009:05… and 3,649,992 more rowsa row: one order. A column: one fact about it

4 of 8 The idea

The till and the back office

The bakery keeps its orders as a table: one row per order, one column per fact about it.

Two very different kinds of work read this one table.

Step 1 of 5

a data warehouse: sorted before anyone asksthe clerksalesshopsstockstaffEasy to ask: everything is in its folder.The cost: the folders are chosen before thepaper arrives. An unplanned question is hard.

5 of 8 The idea

Warehouse or lake

When analytics outgrows a replica, its copy takes one of two shapes. The first: a separate database every system's data is copied into, cleaned and arranged into tidy tables first. The back office with a filing clerk: a data warehouse.

Step 1 of 4

the appand its parts: a data systemdatabasekeeps every record for goodcacherecent answers kept closesearch indexword → where it appearsqueuejobs waiting their turnrenting the machines, and these parts,by the hour: the cloud

6 of 8 The fix

Rent or own, one or many

A real app is rarely one database. It is a database plus a cache plus a search index plus a queue, stitched together. Whoever stitches them is designing a data system.

Each part needs machines, and you can rent them by the hour from a company like Amazon, which also runs the parts for you.

Step 1 of 7

7 of 8 Your guess

Your picture now

Goal met: one machine, analytics on a replica, managed. All from 3.65 GB, one write every 43 s and 3 developers. Which picture is closest now?

Pick one.

The choices before the requirementsMeasure the job first. Then decide the machines, and who runs them.How many machines?One laptop core: 300 s. 128 cores: 857 s. Ask first.Which job?The till: one row, now. The back office: every row, later.Where does analytics live?Warehouse: sorted first. Lake: raw, sorted later.Who runs it?Rent for tiny or spiky load. Owning can win on steady.Where may it live?The law can decide before engineering does.chalkbrain.com
The choices beforethe requirementsMeasure the job first. Then decidethe machines, and who runs them.How many machines?One laptop core: 300 s.128 cores: 857 s. Ask first.Which job?The till: one row, now.The back office: every row, later.Where does analytics live?Warehouse: sorted first.Lake: raw, sorted later.Who runs it?Rent for tiny or spiky load.Owning can win on steady.Where may it live?The law can decide beforeengineering does.chalkbrain.com

8 of 8 Keep this

Keep this

Before arguing about which database, ask what the data is for, how big it is, and who is waiting. Then ask whether you need more than one machine at all.

The price: one machine has no spare when it dies, and stays far from users on other continents. If the load needs those, name the reason, then pay the bill. With the graph in memory, the one core took 275 s.

Read the full lesson