Podcast about DevSecOps

#48 - Building Data Platforms

Processing data is only the start: a platform also needs APIs, documentation, access control and support.

17 min read

Julien has extensive experience building data platforms for data engineering, so we got him talking and sharing. If infra for data engineering is your cup of tea, then this episode is for you.

Discuss the episode or ask us anything on LinkedIn


Your machine learning problem is probably a data movement problem

Mid-stage startups keep telling us a version of the same story. They hired a PhD in deep learning, and what the work turned out to need was a data engineer who can get data from point A to point B. The model was not the bottleneck. Having clean data in a place where a model can be trained was. You can’t decorate a house before you have built it.

The second surprise is scale. A CI/CD pipeline moves code: a few megabytes, maybe a gigabyte if your company is enormous. A data pipeline gets into petabyte territory fast, and the tooling we all know from application delivery was not built to carry that. So teams conclude they need a platform of their own. The plan goes into the deck before anyone has written down a single use case.

We have built data platforms for a living, and we would still tell you not to build one. The engineering is possible. What sinks these projects is that almost none of the effort lands where teams expect it to.

What building a platform commits you to

Start with the list of things a platform needs before anyone outside your own team will touch it.

What does building your own platform commit you to?

A command line interface, a web interface, APIs, SDKs, documentation with examples, a migration path off whatever people use today, monitoring, cost reporting, access control, reliability, and a support rota.

Go through them one at a time and the scope becomes obvious. Engineers want a CLI so they can script and automate. Analysts want a UI so they can look at results and send a colleague a URL. Both need APIs underneath, and agreeing on the shape of an API object is time consuming on its own, which is why JSON:API exists and is worth reading before you invent your own conventions. APIs want SDKs. SDKs want documentation, and documentation nobody can copy and paste from doesn’t count. Everyone already running the old pipeline needs a way across to the new one. Then they all need to see what their jobs are doing, what those jobs cost, and who is allowed to run them.

Google’s own research group made a close version of this point about machine learning systems in 2015. In their NeurIPS paper on hidden technical debt, the ML code is a small black box in the middle of a diagram crowded with configuration, data collection, serving infrastructure, resource management and monitoring. The caption says it plainly: “Only a small fraction of real-world ML systems is composed of the ML code.”

Then there is the cost nobody puts in the estimate. You are the builder and the user of the same system, which is two jobs. The second job eats the first: answer enough questions about your own platform and there is no time left to improve it. We doubt five people can deliver that whole list well without years of work. A team that has already built one, and knows going in what it wants, might get there, but that is the timescale.

Your CI server already runs DAGs

Before any of that, check whether you need a dedicated orchestrator at all.

Why do Airflow DAGs look so much like CI pipelines?

In the implementations we have seen, a DAG was containers run one after another, with something scheduling them and reading how they exited, which is what a CI pipeline does.

Airflow started at Airbnb in October 2014 and became the default answer for ETL orchestration, along with a reputation for being heavy to operate. We have sat with teams who looked at their own DAGs, saw those containers and the coordination logic around them, and asked whether Jenkins would do. For a scheduler that triggers ETL jobs in sequence, a classic CI/CD orchestrator does fit, and it is less strange an idea than it sounds out loud.

That is the shape the comparison holds for. An Airflow task does not have to be a container: the three basic kinds are Operators, Sensors, which are “entirely about waiting for an external event to happen”, and @task-decorated Python functions that run on the worker. A DAG built from those is a pile of Python, and moving it to a CI server means rewriting each task as something that server can run.

The honest caveat is maintainability. Jenkins ends up locked down, abstracted away from developers, with a dedicated group maintaining the pipelines, which is roughly what a data engineering team turns into anyway. The question to settle is who maintains the thing on a Monday morning, and that question has the same answer whichever tool wins.

At the other end of the scale, we have seen a working pipeline built from awk, files in buckets and a file naming convention. It is so simple it is frightening, and it worked, because the people who built it understood their problem first and picked the smallest thing that solved it.

Batch until something forces streaming

Tooling is the cheap decision. Freshness is the one that shapes everything downstream.

How fresh does your data actually need to be?

Ask that before you design anything: a daily report means 24 hours, 24 hours means batch, and batch is far less work than streaming.

If you publish a daily report and you miss a day, you failed. That is a real requirement, and a modest one. Two weeks of history, a decade of archive, the same question applies, and the answer guides the whole architecture around what you build.

Tyler Akidau’s Streaming 101 sets out where that complexity comes from: event time against processing time, records arriving out of order, and the question of when a window is complete enough to emit. A batch run over a bounded, complete input never has to answer any of it. Point repeated batches at data that keeps arriving and the same problems come back, because a record that shows up after its window has been processed lands in the wrong batch unless you write the handling for it.

Batch pays you back when something is wrong, because a batch run can produce an immutable dataset. It works like a pure function: it doesn’t edit the data in place, it writes a new version with the change applied. Find a bug and you fix the code and rerun it. That is also the habit worth building into storage generally. Don’t delete and don’t modify in place, add, so you can see what happened, what the old value was and what the new one is.

Kubernetes gets you started, observability is where it hurts

If the answer is batch, you may already be running the scheduler you need.

Is Kubernetes enough to run batch work?

It is a good starting point, not a batch platform. A Job retries a failed execution until the number of completions you asked for is reached, but only within the limits you set: pass backoffLimit retries or the activeDeadlineSeconds deadline and the Job is marked failed and any running Pods are terminated. A CronJob creates those Jobs on a repeating schedule. Everything specific to data work is still yours to write, starting with the partial output a dead run leaves behind.

The shape fits. A batch process has a beginning, a middle and an end, and Job is built for exactly that. What Kubernetes does not have an opinion about is the middle failing. An application is supposed to run forever, so the platform restarts it and the failure mode is well understood. A batch job that dies at step four of seven has left partial output somewhere, and whether to resume, rerun or discard is domain logic nobody can write on your behalf.

Build on it and the next pain point is not security, which is a known hassle. It is observability, and specifically knowing what changed. Google’s SRE book attributes roughly 70% of outages to changes in a live system, under the heading Change Management. Our own estimate from data platforms runs higher, around 80%, and that is a figure from experience rather than a count. Most of those turn out to be a configuration or access control change rather than new application code.

Which explains the bare metal box that has run for years without incident: nobody has touched it. That is a frozen system, not a reliable one, and the first change turns into a hassle that burns a lot of somebody’s time. CI/CD makes change cheap, and observability is what makes change safe. Without the second one you are shooting at the problem in the dark and leaving when the alarm stops.

Data gravity decides where the compute runs

Where your data physically sits settles more of the design than the platform question does.

Why does the data decide where the compute runs?

Because moving a model is nearly free and moving petabytes is not, so the cheaper direction is to run the query next to the storage.

In February 2023, Google’s Premium Tier internet egress was $0.12 per GB from US and European regions, falling to $0.08 per GB above 10 TB. A petabyte out of a cloud at that rate is around $80,000 before anybody has processed anything. On your own hardware the same move does not come with that bill. This is the reasoning behind BigQuery ML, where you train a model with a CREATE MODEL statement against the table where the data already is.

This is also why some multi-cloud estates stay multi-cloud. We have seen transfer costs make companies leave acquired workloads in their original cloud: the new work gets built in the new provider, and the old estate is left alone until nobody needs it.

Physical transfer is sold for the leg between your own data centre and a provider. AWS Snowmobile moved up to 100 PB per trip in a 45-foot ruggedized shipping container pulled by a semi-trailer truck, and the smaller Snowball devices have carried data out as well as in since AWS added export in February 2016. As far as we could tell, nobody is driving one of those trucks from a Google data centre to an AWS one, and we would pay to watch the footage if anyone is. Network links between two providers are a separate thing, and they do exist: Microsoft and Oracle interconnected Azure and Oracle Cloud in June 2019, first in Ashburn and Azure US East, so one application can run across both. That is plumbing for traffic between two clouds, not a service for shifting a petabyte out of one.

Multi-cloud is leverage, hybrid is capacity

Which raises the question of why teams run in two clouds in the first place.

What is multi-cloud actually for?

Negotiation, in most cases. It buys a discount from your current provider, and it has little to do with reliability.

At the scale where this is played seriously, hundreds of millions of dollars a year, a few points of discount pays for a lot of duplicated tooling.

Hybrid is a different and more concrete case. We see customers who bought GPU machines for cost reasons, keep them busy, and reach into a cloud for elastic capacity when demand spikes past what sits in the rack. Every provider sells a way to do it: AWS Outposts, ECS Anywhere, EKS Anywhere, Google’s Anthos. Andrey reads that as the direction this grows in, a piece of someone’s cloud running in your own data centre.

Julien’s objection is the invoice. He grants the premise, since data protection rules leave plenty of teams without the luxury of a pure cloud estate, and still thinks the sticker is worth reading first. The software itself can be free: AWS ships EKS Anywhere as open source you download and run on your own hardware, and what you buy is support and the features around it. In January 2023, an EKS Anywhere Enterprise Subscription was $24,000 per cluster for a year, with an AWS Enterprise Support or Enterprise On-Ramp plan as a prerequisite for buying one. Anthos charged by the vCPU under management instead of by the cluster: $0.03288 per vCPU per hour on your own hardware, about $24 per vCPU per month. Both are defensible if the alternative is not having the capacity. Neither is the cheap option it sounds like when somebody says “we already own the servers”.

Be boring with the database

The same build-or-buy question shows up in miniature, early, in the choice of database.

Which database should you start with?

The boring one, which in practice means Postgres: small enough to run in a container today, and sold as a managed service by every cloud provider for the day it isn’t.

That migration path is the entire argument. We have run WordPress as two pods with block storage, one web server and one MySQL, a single replica each, which is fine until it isn’t. When the load arrived, the fix was mechanical: move the database to managed RDS, swap block storage for EFS so the files can be shared, add pods. Every step existed because every piece was standard. We have also seen teams run Postgres in a container on a network volume for as long as the data didn’t matter much, then move to a managed service once losing it would hurt. Pick a database nobody offers as a service and the day you hit its limit you are buying servers and learning its clustering story under pressure.

The counter-argument is that you will outgrow it, and the way to settle that is arithmetic. Measure how much data you add per day, project it out one, three and five years, and you can almost name the quarter in which you have to scale up or migrate. A scalable database you chose for a few gigabytes costs money now; scaling Postgres or a MySQL cluster later costs time. Some teams have money and no time, others have time and no money, and that is the honest version of the decision.

Start with the use case, and ship a CLI instead

All of it comes back to the step teams skip.

What do teams get wrong when they build their own platform?

They start from the decision to build. The use case shows up later, if it shows up at all.

The order that works is the reverse. Use something that already exists. Find out what your workloads need from it. If it turns out to be too slow or too expensive for a case you can now describe precisely, you have an argument for building, and a specification to build against. Marketing copy is the other trap here: teams read that they should be handling terabytes like the big companies and design for a volume they will not see for years, if ever.

What the people you hired need from you is smaller than a platform anyway. A data scientist once came to one of us to ask what Docker is, and a few hours of explaining containers later the real question was whether that is what you hire a modelling specialist to do with their week. Those people are rare. Build your company’s CLI instead, with one command per task: create a service, deploy it, or build a container. The command list doubles as the onboarding and the documentation. Data people then get the deal developers ask for: say what goes in and what comes out, and let the platform handle where it runs. Up to a point, since some infrastructure knowledge is useful, and with one exception: if your product is AI infrastructure, that knowledge is the job.

There is a usable self-test in all of this. If you are asking whether you should build your own data platform, the answer is no, because asking means the use cases are not worked out yet. Teams that should build it know they should, and they know it from a number their provider cannot meet. Even then, the CLI, the APIs, the SDKs, the docs and the support rota are all still waiting, and your company is not in the platform business.

What this means for teams

None of this says data engineering is easy or that managed products are good. It says the expensive mistakes get made in the first week, before any code exists, and they are cheap to avoid.

Four things worth doing this week:

  • Inventory the workflows that matter and write down the freshness requirement for each. We would guess most companies have something like ten, which is a list one person can manage.
  • Price the managed option against your real data volume, egress included, and compare it with a staffed estimate of the platform surface, not just the processing.
  • List who owns the CLI, the API, the docs, the access control and the support rota if you build. Every unowned line on that list is your schedule risk.
  • Measure daily data growth and project it three years out, so the database migration has a date on it instead of arriving as a surprise.

Common questions, answered

How do I stop a cloud migration from blowing up on data transfer costs?

Move the compute to the data rather than the data to the compute, and price egress before you commit to anything. Cloud providers bill outbound transfer per gigabyte, so a petabyte-scale move is a five-figure line item on its own. Run the analysis, the training or the query in the account where the data already lives, and migrate only the workloads whose data is small enough that the transfer is a rounding error.

What do I need before I can run data pipelines on my CI server instead of Airflow?

You need pipeline steps your CI workers can execute, and a clear owner for the CI server itself. A container is one way to package a step, not a requirement: a Jenkins stage can invoke make through an sh step like any other build. If the dependency between steps is “this one, then that one”, a CI/CD orchestrator can schedule it. What you give up is Airflow’s own task types, the operators and the sensors that wait on an external event without you writing that waiting yourself.

Do data scientists need to learn Docker and Kubernetes?

Not deeply: give them a CLI with one command per task they have to get done, and keep the containers behind it. Some infrastructure knowledge is useful, so the question is how much of their time it takes, and a few hours explaining containers to a specialist you hired for modelling is a bad trade if it turns into the job. The exception is a company whose product is AI infrastructure, where that knowledge is the work. Otherwise it is the deal developers ask for when they say they want to ship code rather than configure load balancers, and the docs for that CLI are part of what you maintain.

Resources

Since we recorded

In January 2024 Google stopped charging for network data transfer when a customer migrates off Google Cloud, which covers leaving the provider and not the routine egress that still makes a query next to the data cheaper than a copy of it. AWS put Snowmobile into full shutdown on March 14, 2024, so the truck is no longer part of anyone’s migration plan. The build-or-buy argument came back round on the show with #90 K8s vs managed services and #95 From platform theater to golden guardrails, where the test for a platform worth keeping is still whether anyone can say what it is for.