# Building resilient systems with Sam Newman

Markdown copy of https://realalpha.app/v/a0sZV0qIbI0/ on Real Alpha, the best minutes from long interviews with the people building AI. Cite and link the page, not this copy.

Sam Newman calls microservices an architecture of last resort and says resilience decisions depend on business context and observability.

- Show: The Pragmatic Engineer
- Hosts: [Gergely Orosz](https://realalpha.app/people/gergely-orosz/)
- Guest: [Sam Newman](https://realalpha.app/people/sam-newman/) is author of Building Microservices and Building Resilient Distributed Systems.
- Published: Oct 7, 2026
- Length: 1 h 59 m

## The best minutes

- [1:21:33](https://realalpha.app/v/a0sZV0qIbI0/?t=4893) [Fail open or fail closed depends on the business context](https://realalpha.app/s/fail-open-or-fail-closed-depends-on-the-business-context/) (5 min)
- [1:08:19](https://realalpha.app/v/a0sZV0qIbI0/?t=4099) [Make retries safe with idempotency keys, not just fingerprints](https://realalpha.app/s/make-retries-safe-with-idempotency-keys-not-just/) (5 min)
- [1:26:21](https://realalpha.app/v/a0sZV0qIbI0/?t=5181) [Robustness is only one of four parts of resilience](https://realalpha.app/s/robustness-is-only-one-of-four-parts-of-resilience/) (2 min)

## Also worth watching

- [1:01:59](https://realalpha.app/v/a0sZV0qIbI0/?t=3719) [Decide how resilient you need to be before building resilience](https://realalpha.app/s/decide-how-resilient-you-need-to-be-before-building/) (6 min)
- [35:16](https://realalpha.app/v/a0sZV0qIbI0/?t=2116) [Spec or code as source of truth depends on tacit knowledge](https://realalpha.app/s/spec-or-code-as-source-of-truth-depends-on-tacit-knowledge/) (5 min)
- [1:44:55](https://realalpha.app/v/a0sZV0qIbI0/?t=6295) [Run an AI software factory on one module, not the whole system](https://realalpha.app/s/run-an-ai-software-factory-on-one-module-not-the-whole/) (5 min)
- [1:16:04](https://realalpha.app/v/a0sZV0qIbI0/?t=4564) [Thundering herds have different causes, so the fixes differ](https://realalpha.app/s/thundering-herds-have-different-causes-so-the-fixes-differ/) (5 min)
- [1:32:49](https://realalpha.app/v/a0sZV0qIbI0/?t=5569) [Hedge AI vendor risk by being multi-model and using plain code](https://realalpha.app/s/hedge-ai-vendor-risk-by-being-multi-model-and-using-plain/) (4 min)

Skip the sponsor reads, the 20-minute career story, the microservices history chat and the closing book and contact details.

## Full analysis: Sam Newman says resilience draws on David Woods's four concepts

- Newman, drawing on David Woods, uses four resilience concepts, but says resilience itself is a matter of degree.
- The framework helps when choices reflect user harm, operating costs and production evidence.
- Teams can set failure policies and test AI autonomy in bounded modules with observable results.

Its 6 sections, what it means for you and what to watch are on [the page](https://realalpha.app/v/a0sZV0qIbI0/#analysis), free with an account:

- [52:56](https://realalpha.app/v/a0sZV0qIbI0/?t=3176) Three distributed-system rules explain common outages
- [1:02:30](https://realalpha.app/v/a0sZV0qIbI0/?t=3750) Resilience spending should follow the user contract
- [1:21:46](https://realalpha.app/v/a0sZV0qIbI0/?t=4906) The same outage can require opposite decisions
- [1:11:29](https://realalpha.app/v/a0sZV0qIbI0/?t=4289) Retries need identity, not a matching payload
- [1:35:43](https://realalpha.app/v/a0sZV0qIbI0/?t=5743) AI resilience starts with options and deterministic steps
- [1:47:07](https://realalpha.app/v/a0sZV0qIbI0/?t=6427) Software factories belong inside bounded modules first

## Summary

Sam Newman wrote Building Microservices and says he was in the room when the term microservices was coined. He worked at ThoughtWorks for years, tried three startups, and has worked independently since. His new book, Building Resilient Distributed Systems, is out now.

Newman says microservices fit best when an organization wants team autonomy, and that independent deployability is their defining trait. His three rules of distributed systems are that data takes time to travel, that remote services are sometimes unavailable, and that resource pools are finite. He argues resilience is a matter of degree, set by business context and informed by observability, idempotency and learning from incidents. On AI, he favors hedging across vendors and models, keeping humans connected to the system, and trying software factories inside low-risk modules.

### Minute by minute

- [8:58](https://realalpha.app/v/a0sZV0qIbI0/?t=538) **ThoughtWorks and programming as collaboration.** Newman describes his years at ThoughtWorks: extreme programming, build pipeline work from about 2004, and a stint at Google teaching automated testing. He says programming is not typing. He describes a program as a theory held by a team, with code a side effect of working together, and says AI does not change that.
- [20:50](https://realalpha.app/v/a0sZV0qIbI0/?t=1250) **How microservices emerged from SOA.** Newman says James Lewis coined the term after studying companies with fine-grained service-oriented architectures. Newman came to it from continuous delivery and infrastructure automation. He started writing his book in that context. He says Uber and Netflix brought attention, while many firms simply relabeled their SOA as microservices.
- [26:12](https://realalpha.app/v/a0sZV0qIbI0/?t=1572) **Microservices are an architecture of last resort.** Newman's definition rests on independent deployability and, by default, service boundaries drawn around the business domain. He calls the style a last resort because it pushes state into a more distributed form. His best reason to adopt it is organizational autonomy. Enterprise domains are more complex than those of tech companies.
- [33:42](https://realalpha.app/v/a0sZV0qIbI0/?t=2022) **Specs versus code as source of truth.** Newman says the industry is debating whether the spec can replace code as the definition of a system, and he does not think everywhere is ready. He cites tacit knowledge, lost shared context and the end of code review as risks. Teams must define what good looks like, and he says production is the real truth.
- [44:38](https://realalpha.app/v/a0sZV0qIbI0/?t=2678) **Why he wrote the resilience book.** Newman says a paper on resilience engineering baffled him at first. He then saw that many people were building distributed systems anyway, so he wrote a book of foundations such as observability and timeouts. It also covers socio-technical ideas. He praises candid public post-incident reports, with Cloudflare as an example.
- [51:42](https://realalpha.app/v/a0sZV0qIbI0/?t=3102) **Three rules of distributed systems.** Newman reduces distributed systems problems to three rules. Information cannot travel instantly. The thing you want to call is sometimes not there, as with a fire or rabbits eating cables. Resource pools are not infinite, and he says most outages come down to saturation, often through retry storms.
- [55:39](https://realalpha.app/v/a0sZV0qIbI0/?t=3339) **Observability sets how resilient you need to be.** Newman says a distributed system must emit structured events, which build into traces, service level indicators and objectives. Resilience is not binary, so teams need that data to decide how much to invest. He cites Monzo's stripped-down standby bank and Zoom's multi-region choice. He adds that engineers must communicate with business stakeholders.
- [1:07:06](https://realalpha.app/v/a0sZV0qIbI0/?t=4026) **Idempotency keys make retries safe.** Newman explains that an idempotent operation can run repeatedly with one effect, and uses payments as the example. His preferred fix is a unique key generated by the client, such as a UUID, though both sides must support it. A server-side fingerprint of the request fields can be retrofitted, but it risks rejecting legitimate duplicates.
- [1:15:06](https://realalpha.app/v/a0sZV0qIbI0/?t=4506) **Thundering herds have different mitigations.** Newman defines a thundering herd as too many requests for too few resources. His examples are denial-of-service attacks, cache collapse, and Square's 2017 retry storm against Redis. He also cites healthcare.gov and Twitter, where success caused the overload. Autoscaling suits some cases but can turn an attack into a cost problem.
- [1:20:57](https://realalpha.app/v/a0sZV0qIbI0/?t=4857) **Business context decides fail open or closed.** Newman says the choice to fail open or closed depends on the business. An e-commerce shop can sell an item it may lack and refund later, while a concert ticket seller cannot. Orosz adds that Uber moved from failing open to failing closed as its focus shifted to profitability. Newman says the decision is made feature by feature with product owners.
- [1:25:06](https://realalpha.app/v/a0sZV0qIbI0/?t=5106) **Woods's four concepts of resilience.** Newman describes four concepts from David Woods: robustness, rebound, graceful extensibility and sustained adaptability. Most engineers focus on robustness, which adds complexity of its own. Rebound is about recovery time, graceful extensibility is about handling surprise, and sustained adaptability is about learning over time. The last two depend on culture and psychological safety.
- [1:32:24](https://realalpha.app/v/a0sZV0qIbI0/?t=5544) **Hedging against AI vendor risk.** Newman says conservative economist analyses show AI labs need $2.6 trillion in revenue by 2030, against a $1.4 trillion software market. He advises being multi-vendor and multi-model and splitting agents into workflows that can use deterministic code. He argues LLMs have no concept of causality, so teams should decide where to use them.
- [1:39:05](https://realalpha.app/v/a0sZV0qIbI0/?t=5945) **Cognitive debt and cognitive surrender.** Newman describes cognitive debt as eroding critical thinking, and as a lost shared mental model when people work separately with AI. Cognitive surrender is approving AI output without reading it, much like approving a pull request without review. He contrasts AI that assists an expert with AI that turns the expert into an approver.
- [1:44:18](https://realalpha.app/v/a0sZV0qIbI0/?t=6258) **Modular architecture for experimenting with AI.** Newman recommends modular systems where humans design the modules and their connections while AI works inside them. Teams can try a software factory in one low-risk module with specs and verification, and keep a collaborative approach elsewhere. He says you need to define good across developer, operational and business requirements.

## Transcript

The Pragmatic Engineer, hosted by Gergely Orosz, with Sam Newman.

Transcribed by machine (Whisper) from the episode’s audio, so a word may be off here and there. Where the podcast’s audio and the video part ways, some times are a minute or so off.

[0:00](https://realalpha.app/v/a0sZV0qIbI0/?t=0) Sam Newman is the author who wrote probably the most widely read book on microservices, and yet, as you heard, he said that microservices are an architecture of the last resort. But why? Sam was in the room when the term microservices was coined. I find him to be one of the most thoughtful engineers on this topic, as well as on resilient systems, and his latest book, Building Resilient Distributed Systems, is out now. Today we cover Specs vs. Code as the Source of Truth and Why Sam Says That Production is Truth The four dimensions of resilience, robustness, rebound, graceful extensibility, and sustained adaptability, cognitive depth and cognitive surrender, and Sam's advice on how to better use AI to avoid these, and many more.

[0:46](https://realalpha.app/v/a0sZV0qIbI0/?t=46) If you want to understand what it takes to build resilient systems, from an expert who has been knee-deep in this topic for 10 plus years, this episode is for you. This episode is presented by TurboBuffer, the AI retrieval layer built on object storage. It's fast, cheap, and extremely scalable. Antropic, Cognition, Notion, and many others are happy customers. Before we start, let me mention Tire, our seasoned sponsor and our product and team I'm very bullish on. You probably already know that Git hosting has a problem. AI agents. Git is increasingly becoming a bottleneck for modern agent-heavy software development.

[1:16](https://realalpha.app/v/a0sZV0qIbI0/?t=76) Engines like you or me are creating more code with agents, those agents push more code, and most of us are running parallel agents, which push way more code. GitHub is clearly struggling to keep up and has frequent outages. So what's the solution? Entire was founded by GitHub's last CEO, Thomas Dumka, who, by the way, was a guest on a podcast when he was still at GitHub. And Thomas revealed Git hosting for the agentic era from scratch. Entire was built to be very fast and to have your repos regionally close to you to reduce latency. And this allows for fleets of agents to push in parallel. And Entire's performance is next level.

[1:47](https://realalpha.app/v/a0sZV0qIbI0/?t=107) Their repo can handle 418 pushes per second, which is up to 89 times faster than every competitor on the market. When GitHub is down, you can still keep working and you don't even need to migrate away from GitHub. You just sign up to Entire and the platform mirrors your repo. And here's a neat thing. Have you ever wondered what prompt resulted in this specific code being generated? I find that the prompt and conversation with the agent carries more information than the PR itself oftentimes. Entire captures all the prompt history with your agent right inside of the repo, easy to check back. And it's got a pretty innovative UI to show all of this.

[2:20](https://realalpha.app/v/a0sZV0qIbI0/?t=140) If you're looking for Git hosting that works even when GitHub is down, head to entire.io slash pragmatic install the cli and mirror your repo with a click i've already done it and i love it oh and did i mention that it works with any agent and it's open source sam it's great to have you in the podcast thank you so much for having me i'm happy to be here really happy to be here big fan of the show as they say i'm not gonna lie i've become a bit of a millennial and i think i'll watch a lot of shorts rather than watching the whole things now i'm becoming my son but yeah millennial is a new boomer apparently i've learned so i was i was happy enough being gen y now i'm wherever i am now well so so let's go back to the beginning you've been known for a lot of your books your takes on resilience system microservices before that you worked at thoughtworks but let's run to the very beginning how did you get interested in tech and computers i'm quite fortunate living in uk we had at places and access to computers quite early on we had an acorn electron at home which was sort of one of the generations of the bbc computers that came after the bbcb and then i got a spectrum 128 3 which is the spectrum that had the built-in tape drive this is way before the commodores i think some

[3:34](https://realalpha.app/v/a0sZV0qIbI0/?t=214) of this was the bb i think i'm pretty sure that the acorn electron was pre- commodore but the spectrum would have been around the same time the uk was a bit more of a spectrum and bbc market whereas the US, the Commodores and the Ataris and things were a bit bigger. So that sort of got me a bit interested. And then I always sort of stayed interested in it. Dad had a computer. I did the very boring thing. I went to uni. I did a software engineering degree at a place called De Montfort University, which is the running joke in my family. is it's in the top five universities in the Leicester area.

[4:12](https://realalpha.app/v/a0sZV0qIbI0/?t=252) There are only two universities in Leicester. I mean, I loved it, actually. It was a great class. It's basically an MIT syllabus. And then I just did the work after. I got a great... Back then, we did these things called sandwich courses. Sandwich course. Yeah. And so, basically, the idea was you would do two years of study. You'd do a year in industry that was paid, but you were effectively going in as a student. And then you did your final year. Oh, nice. which is actually fantastic because i kind of was drifting a bit and whenever i did my year in industry so many things clicked it meant as much focus going in and i got to do work for a company called back then they were called gc gc alstom that was called alstom and we did software for the european space agency and gas and steam turbines yeah it's really cool i joined about the first time at that and then i went back after and when i went back it was just around the time the first dot-com boom and so everybody left so i went from being the person that was doing like nothing to person did everything but i remember my first week there i was given a fortran 77 code base so fortran 77 was released in the year i was born and every single for loop had a break

[5:34](https://realalpha.app/v/a0sZV0qIbI0/?t=334) condition because we were basically doing analysis on these unix machines this if the models and And the time on the machines was expensive. And we were worried about accidental infinite loops. This is us trying to solve the halting problem, basically. So every for loop across these 8,000 files had a break condition of, I think it was 99,999 loops. And if it went over that, the program basically broke and aborted. The models had got bigger. The computer got more powerful. So it had to go through and change them all. By hand back then. By hand, well, this is one of the nicest things that anyone's ever done to me in a professional career.

[6:14](https://realalpha.app/v/a0sZV0qIbI0/?t=374) because Fortran 77 is based on the old punch card limitations to an extent. So your lines can't go very long. So it's all a bit fiddly. You can't just go and put a nine. And my boss said, I reckon it'll take about two weeks if you do it by hand. Or, and he slid a book across to me, you can read this. And he gave me a copy of the O'Reilly Set and Orc book. And so I spent two days learning how to do regular expressions. and i wrote a refactoring using regular expressions accounting for line lengths and everything else and it's i think the closest i've ever come to feeling like a god i did it and i thought that's the thrill that's the absolute i'm not sure if it's a joke or a story but you know the two the two um builders who need to build a wall and and one of them starts to build the wall one by one by one and the other one is kind of drawing making plans and like i don't know like it takes us three days to build the wall and the first two days this guy does nothing and the builder building it feels really good and then on day three this builder like builds a machine that builds or like puts together a machine that builds the wall for them and then yeah but sometimes sometimes of course the wall falls down the moment you set the machine the thing is i love that that

[7:30](https://realalpha.app/v/a0sZV0qIbI0/?t=450) story that story is all true and it's one of the earliest times i can remember learning something and having such a visual reaction and i remember this has been just towards one of the end of I was doing ThoughtWorks and some grads in and they were asked to tell some stories about like what had happened in previous career. And I told this story. I said, I added the nine, made the models bigger. And then one of the, one of the grads said, why didn't you just replace it all with a constant? So you could just change the number once anytime in the future. And I was like, I thought I'm learning once again. Yeah. So that's, that's But also what I love is you get humbled all the time in this industry.

[8:15](https://realalpha.app/v/a0sZV0qIbI0/?t=495) You get to learn stuff. Yes, there's reinvention of the wheel going on, but we're inventing better wheels the whole time. And I think it's just nice to remind us every now and then I'm sure everyone who's built code and programs, at some point you have the realization that you do feel like a god, that you can do things with these things, which is just so difficult to do by hand, right? i think we forget about that when it's kind of day-to-day and we're just like doing our stuff or even like right now we're using llms which also do incredible magical stuff that would have been impossible but like it's kind of cool that we are in charge we can do amazing stuff you get that little fizzy dopamine here and i think that's something we're struggling with a bit now is as people are getting further away from the code they're trying to work out like how do i still get that kind of dopamine yeah in the same way um it's not as much an issue for me because i've later on you know i've been doing this for almost 30 years now and i've already been mostly working at the area of architecture for and sort of architecture and infrastructure for a while so i feel a little bit more removed but it's uh yeah talking to my son who's a programmer

[9:25](https://realalpha.app/v/a0sZV0qIbI0/?t=565) he's got into it around an interesting time right now and then you eventually made your way to thought works where you spent a bunch of time what kinds of things did you do at thought works and And what are things that you learned there? I did anything. I mean, I joined when there were probably just under 400 people left with about 4,000. And I worked and got to go all over the place. I joined at a good time because a lot of the, I mean, we were very much an XP shop. And I think that the core of the business still kind of primarily is when I speak to people there. By the way, XP, was that influenced by Ken Beck's XP?

[10:02](https://realalpha.app/v/a0sZV0qIbI0/?t=602) Yeah, no, that extreme programming is very much, it's Ken's extreme programming. There was a bit of a London flavor. So the kind of London School of Test-Driving Development and the Extreme Tuesday Club, XTC, around here. So what's the London flavor of XTC? It's sort of like, if you want to know, you probably need to read Growing Object-Oriented Software Guided by Tests, one of the worst titled books in existence written by a couple of friends of mine, Steve Freeman and that price. And I think that was a lot. There's a lot of people in the community around here that knew that. There's a rich meetup scene.

[10:34](https://realalpha.app/v/a0sZV0qIbI0/?t=634) And so I kind of got introduced to people through there and came in and I was same time as offer a job by somebody else. It was a bank. The bank could tell me exactly what I was going to be doing and ThoughtWorks, basically the recruiter at the time is now one of my very good friends, one of my oldest friends now. She said to me, I don't really know what you'll be doing. And I'm like, that sounds like the job for me. I went for that one. And this is at a time when like, you know, we talk about continuous integration, but the tooling wasn't there. and talks about TDD and the tooling wasn't there.

[11:07](https://realalpha.app/v/a0sZV0qIbI0/?t=667) So it was in, you know, it was around that sort of time that we started work. I started building the Build Pipeline stuff in about 2004. And then I worked, Dave Farley was my first tech lead. Dave Farley? Yeah, yeah. He's my first tech lead at ThoughtWorks. I was one of the people that interviewed Jez Humble to backfill for me on a project. No way. So a project at AOL of all places. And we'd use it as a backfill. because I was like, I'm sort of half his CIS admin, half dev really is how I see myself. So we needed someone to take over my job. And so I interviewed Jez. And so I was around when a lot of interesting things were happening.

[11:45](https://realalpha.app/v/a0sZV0qIbI0/?t=705) So I was fortunate enough to be there while we were sort of kicking those ideas around. And obviously people like Dave and Jez put those ideas together really, really well. You're sort of surrounded by everyone talking and thinking about these ideas. I think you got that. I got the idea very early on that this stuff's all up for grabs. These things aren't set in stone that we can push. And when you're saying these things, like you mentioned continuous delivery, you mentioned what other... Test automation, build pipeline optimization, infrastructure automation. I went over to the US in 2007, actually to work in a big...

[12:22](https://realalpha.app/v/a0sZV0qIbI0/?t=742) I actually worked at Google for like a year and a half as a ThoughtWorks employee. Wow, that's quite rare. We were there doing a project. It's all been talked about publicly. is a great write-up by Mike Bland all about our experiences. It was me, it was a few of me, a few of my Thorpe's colleagues, some people from Industrial Logic and some people from Pivotal, the old Pivotal, pre-actual. They were known for their really excellent engineering culture. Back when it was just Robby's company or anything else. And we were there to teach Googlers primarily how to write automated tests and how to write code that was testable.

[12:55](https://realalpha.app/v/a0sZV0qIbI0/?t=775) And so I got out there and I was talking to people out in the Valley and stuff. It's like we were going into these enterprise companies doing test automation, using stuff like Selenium. And you go around talking to people and it's like people didn't. I remember having conversations with people like Yahoo and even big chunks of Google who did not think you could do functional automated testing of, like, websites and stuff. I guess because they just never did it, right? Yeah, absolutely. And for me, like, I hate it whenever I haven't pushed myself or, like, found a better way of doing something.

[13:27](https://realalpha.app/v/a0sZV0qIbI0/?t=807) And I was lucky enough that early days in ThoughtWorks, that was just a constant churn of ideas and reinvention. I mean, goodness knows how many mocking frameworks and inversion of control things I was. i i built two different replacements for cruise control myself right and so but like i you know it was at that time i created a thing called db deploy my friends nick ashley and gram tactic which was like the first database refactoring tool and all these sorts of things just didn't exist we needed them and it was like if you if you want to do it just do it that was their mindset and so i think there was always this idea working at thoughtworks was always like what's next and i was quite fortunate that because thoughtworks was growing so much there was always things needed to be done. And my default was normally just to say yes to everything. So I got to travel all over the world. It was fantastic. Met my wife at ThoughtWorks. Most of my best friends will come from ThoughtWorks now still to stay. So although it's not been there for a long time, it was kind of really formative, I think, in terms of that. And it is really interesting because ThoughtWorks has an alumni pipeline, people who used to work there, who are now

[14:32](https://realalpha.app/v/a0sZV0qIbI0/?t=872) really well known in the industry for their ideas, for thinking differently. Some of them educate people others uh have created businesses to to build software in better ways in certain dimensions and it's just interesting because like usually i wouldn't think of i'll just like put it in a box like you know you have product companies like like google like meta like they have they build their own products and and you have like different tiers of these companies some can afford the best people and they have an excellent engineering culture again google was known for this meta to some extent and there's some companies maybe who are like lower in tier and then you have the so-called consultancies who are, you know, they don't build their own stuff or they don't do too much of it.

[15:11](https://realalpha.app/v/a0sZV0qIbI0/?t=911) They come in and they help companies build or you have a problem when you hire a group of experts and ThoughtWorks technically is in this group and usually you would not think that there's too much innovation going on in these places but with ThoughtWorks proofs to me, yourself and other people, it's actually you can have like when you are the best in what you do globally, you can actually have a lot of innovation happening there as well, right? Yeah, and it was innovation with a different set of constraints. I mean, I would say there aren't that many people that have come from ThoughtWorks that were really great startup product people.

[15:40](https://realalpha.app/v/a0sZV0qIbI0/?t=940) I mean, a lot of, you know, a lot of ThoughtWorkers make excellent scale-up people once you're all together. There are actually very few real entrepreneurs that came out of the ThoughtWorks machine. I know a few of them. There aren't many of them. But I think there was always the opportunity to innovate even within a constrained enterprise environment. So much of our working conditions as a consultancy, who mostly did co-source delivery at that time, we were doing kind of co-source delivery, a bit of enablement through delivery. your working conditions are often based on what the client does and unless you're there explicitly to change how the client builds software so what you work what you got but that was self-perpetuating because we were already used to sort of challenging and pushing and trying to do new things that spirit carried on and so i think we grew quite aggressively but not that aggressively rotating people through and that spirit kind of carried on i mean look we had to start most engagements with convincing people why testing was a good why pairing was a good idea let alone tdd yeah and i imagine how the conversation went like a manager going like well what would you pair then i have like you know like eight engineers and now you're making it four

[16:43](https://realalpha.app/v/a0sZV0qIbI0/?t=1003) which sounds like a terrible thing to do, right? Which, and this is, I mean, I had good fortune because of the people, because of the work at ThoughtWorks. I got to know Martin Fowler quite well. And, you know, he supported me a lot when I wrote my first book. I still remember when he said, well, programming's not typing. I said, fundamentally, it made it click for me was having those conversations with the clients. If the client thinks that programming is typing and that's why they don't want you to pair program, well, then you've got a fundamental problem that needs to be dealt with. And it's not a conversation about pairing.

[17:12](https://realalpha.app/v/a0sZV0qIbI0/?t=1032) The conversation is, what do you think programming actually is? Well, but let's bring this a little bit forward, because right now we're having the same conversation around, right? For a lot of CEOs, even founders, are thinking who have been building tech companies. You know, they all look at what is the most time-consuming part of what we do in building software. 50% of the time has historically been writing the code. So a lot of people think, you know, like programming is code, and LLMs are really good at churning out code. So what is programming? Okay, there's programming. I think it's Peter Knorr's article.

[17:46](https://realalpha.app/v/a0sZV0qIbI0/?t=1066) The guy who came up with Barker's Knorr form. Well, he's Knorr in Barker's Knorr form. He wrote his paper years ago, which he won the Turing Award for. And he sort of describes the program as being a theory that lives in the mind of the developers. That it's actually us together, working together collectively, who builds a program. The fact that we happen to make that program work through code the code is really a side effect of how we work together and i think product development is just that extended right what we are building is collectively we are building a system together and the code is one of the mechanisms we use to deliver the system it's not the only thing so i think holistically that's what it's all about it's just that we focus on the code because that's historically been where we sort of spend the time but i mean this is also a classic theory of constraint stuff though right if you speed one bit up you get constraints elsewhere and it exposes uh friction points elsewhere i would also argue that a lot of the time coding was not the problem or not the bottleneck it was how the coding was done delayed feedback cycles and things but i do come back to that peter law piece again because it's like margaret ann story referenced it

[18:58](https://realalpha.app/v/a0sZV0qIbI0/?t=1138) recently in her term pay from calculative debt but it's like building software is a collective it's a collective endeavor it's people working together who build software uh kent put it in his tidy first book that software design isn't exercising human relationships right ai doesn't change that and i think all that's really happened over say the last 15 years and my experience is that we've got a bit better at understanding that we need better working relationships like people like product owners for example but so that's what the pro the programming is the hour of creating it's a collective operating software and it's not just developers that do that never has been and so after thoughtworks you've you've gone independent right i did three startups none worked out for different reasons so don't ask me for advice on how to make a successful startup um and then i went independent yeah moved back i was living in australia at the time and moved back from australia and yeah i've been independent ever since so doing kind of a mix of stuff really ever since i'd written the first book of about microservices i thought in my spare time at ThoughtWorks and then uh that book came out and I'd been at ThoughtWorks a long time and I

[20:03](https://realalpha.app/v/a0sZV0qIbI0/?t=1203) realized that there's always a danger of becoming institutionalized you get to a point with a company it's like I think there's things as companies do to change and I've tried changing those things and they don't want me to change them so either I'm bad at changing them which is probably true or they don't think it needs to be changed which is also probably true it's like I could hang around and get bitter I'll just go now let's go now so I went off and I thought I and independent it's been really interesting ever since because it's sort of on one level the shackles are off um the problem of working for yourself though is that the boss is frequently an arsehole so yeah current sam frequently is cursing past sam for the commitments he's made a small lesson i guess yeah yeah yeah i mean as i say i'm almost 50 i'm still not learning the lessons of that right and i've made those mistakes for a few years now so i want to talk about microservices uh you you have written the book building microservices uh in in 2015 you started to write it in 2014 and as reference uber started to talk about how they have thousands of microservices in 2015 so you were kind of writing this book right as yes the

[21:10](https://realalpha.app/v/a0sZV0qIbI0/?t=1270) concept of microservices was starting to go mainstream across startups do you remember how and when microservices took off and where was it even coined was it around martin fowler no it's james lewis so it was going back in the day so you got to remember again it's like something in the water it's like we have a bushfire there was a lot of build-up before the bushfire kicked off and uh so this would have been 2011 to 2012 james was talking to a bunch of uh different companies who were building what would have classed back then as service-oriented architectures. And earlier, there'd been this kind of, what we refer to as the guerrilla SOA movement, which is an aim to simplify service-oriented architecture, you know, shift over to REST, work done by people like...

[21:54](https://realalpha.app/v/a0sZV0qIbI0/?t=1314) Yeah, the original service-oriented architecture had like this XML format. What was the name? Oh, WSDL and Simple Object Access Protocol. Never has the word simple been less well used. Soap. Soap. Yeah, soap. Yeah. Can I start with simple? It was the most complex thing ever. Exactly. So you had this whole heavyweight and then people like Ian Webber and Ian Robinson and Jim Webber had like been pushing centralized. You had mantras like make the endpoints smart and the pipes dumb to keep things simple, put all the smarts in it. So this is all the background. We were also at this time doing a lot of work around like I was running the continuous labor practice for Europe at the time.

[22:30](https://realalpha.app/v/a0sZV0qIbI0/?t=1350) And so a lot of my engagements were like optimizing the final mile. So you've written the code and it's like, How do I get it here into production as quick and effectively as possible? So basically taking the idea as a continuous delivery. So I was around when Jez and Dave started working on those in 2006. I'd had the conversations with them. So that was all happening. James was talking to companies that were creating service-oriented architectures where they could replace the services quite quickly. And so basically you'd look at it and say it's a finer-grained form of SOA. So that was all happening.

[23:02](https://realalpha.app/v/a0sZV0qIbI0/?t=1382) So James went to, we had this architectural symposium up in the Lake District. and James pitched this idea. He was called the micro apps at the time in this room. And somebody else in the room said, my immorality services, don't remember who said it. There was about 10 of us in the room. Most of us were hung over. And then James and Ian, so James and Martin wrote the first post. So the first paper on Martin's website was written by, it was sort of James's original kind of discovery of this pattern that he called microservices. At the same time, I was doing a lot of stuff on infrastructure automation.

[23:34](https://realalpha.app/v/a0sZV0qIbI0/?t=1414) And so I was coming in it from a different lens. So I think James was coming in it more from an architectural lens than I was coming into it from a continuous delivery lens. I spent at this point almost 10 years with that being my focus. And so I was starting to see the architectural impediment. So if I want to change things frequently, but the things I want to change are integrated with other things. Like a monolith. Now that's how we would describe it. Exactly right. i mean i did a talk called designing for rapid release in 2012 which is sort of touching this so basically james had this sort of had put a name to this stuff and put some patterns on it and i sort of thought hang on a bit like stuff i was talking about over here seems these things seem quite sensible and i'd always wanted to write a book i mean honestly i wanted to write an animal book i wanted to write an o'reilly book because that said knock book i was given yeah and so i just started writing i've always found writing quite i'm quite lucky that i find writing enjoyable and quite easy. So I just, yeah, sat down and wrote the book and that's it. But for me, it was an extension of continuous delivery. And it was a style of architecture that was

[24:40](https://realalpha.app/v/a0sZV0qIbI0/?t=1480) only possible because of continuous delivery. even because of DevOps. We'd had these ideas before. I mean, Erlang is a representation of these ideas, but making it a real practical and attractable thing. But I mean, really fundamentally, it's just the whole thing has been an exercise in smuggling through concepts of the 1970s, which is fine by me, right? If I get people to pay attention to information, hiding and coupling and cohesion, that's all right. But then as you said, like this was literally a spark before the bushfire And then the bushfire did start like suddenly, again, I think Uber was a very notable company starting to talk in public about having thousands of microservices on conference like InfoQ and it got people's attention.

[25:23](https://realalpha.app/v/a0sZV0qIbI0/?t=1523) And then it kind of seemed that overnight, a lot of stars started to say like, you know what, let's just do microservices. There was a bit of rebadging going on. I mean, I was lucky when I wrote the first book that I met Ben Christensen fairly early on through the Yale conference. Ben was looking after performance and sort of reliability at Netflix. and i also knew people at rea and these were two early rea realestate.com.au in australia and these were companies that were very much pushing the envelope in different ways and so i had two very good real world case studies to draw upon for my book but most other people weren't talking as publicly around that and also before netflix referred to their architectures microservices they just referred to it as fine-grained soa and to an extent you know of the mind settings that's what happened at uber and elsewhere we didn't have a different word for it then of course what happened was that everyone just called their soa architectures microservices which is sort of to be you know semantic diffusion is a thing is to be expected so i just kept fighting the good fight for like it's just independent deployability and you know it's an i've always positioned it as

[26:31](https://realalpha.app/v/a0sZV0qIbI0/?t=1591) it's an opinionated style of soa you may not agree with the opinions that's fine do something else in but there are some opinions so then what is the difference between microservices and what was the other service service oriented architecture what are the differences in in in your very now to be clear right i have my definition you might have your own definition but i'm the one that wrote the books on it so my definition wins that's how that's always been my argument right write your own damn book um i've always presented it as it's there were two kind of very strong opinions i think we hold with microservices the first and the most important is that your microservices need to be independently deployable.

[27:07](https://realalpha.app/v/a0sZV0qIbI0/?t=1627) So your unit of deployment, unit of change needs to be a single microservice boundary. A single service boundary. And, you know, rather than I'm deploying everything together, that's a monolithic application. Three services at the same time, et cetera. Yeah, even a mini monolith, right? It's a single service at a time. That's clear. That's it. And the second one, which I think there are going to be exceptions to, is that your kind of default way for defining your service boundaries is around your business domain. is taking the concepts of you can use the management design, you don't have to but rather than a lot of SOA architectures were dominated to an extent by technical decomposition the classical interior architectures layered architectures where you've picked your service decomposition based on the nature of tech rather than thinking about the business functionality that's a bit softer, independent deployability is the main thing though I'm now thinking back at Uber, I was at Uber at the time when your book was starting to become really popular.

[28:01](https://realalpha.app/v/a0sZV0qIbI0/?t=1681) I was there from 2016 and we had independently deployable services. We didn't really think too much about the businesses or domain. They had obviously their interfaces. They had contracts that they offered increasingly strongly typed and we used the ways to do it. But it was just more like, I mean, as you can imagine, there was just devs, oftentimes not very experienced devs who were like, all right, like let's build a new service. Here's the interface. Here's, and then anyone can use it, which actually, like, there were these things where a dev or even a not very experienced that deployed the microservice and then others started to use it and suddenly it became, you know, years later there would be these exercises to figure out the hot path and label services.

[28:43](https://realalpha.app/v/a0sZV0qIbI0/?t=1723) this like loan service was on the path of like some really, it needed to be requested as a really high tier service because a lot of others were using it. I mean, there was always, I mean, also no sorts of environment. So I was checking to people at SoundCloud, similar about that. And this is also like about a corporate culture and like what was acceptable. Like in that kind of environment, just go and do stuff. It's absolutely fine. And I think that's why Uber, for example, when did I just talk with Twan Palm, the C2 at the time, about like what was the real deal about microservices? And he said Uber, like he never really wanted that many services, but it was just more of a constraint because Uber had a monolith.

[29:18](https://realalpha.app/v/a0sZV0qIbI0/?t=1758) The story was like, which he told on the podcast, we'll link it at the show notes below, that Uber had this big monolith. And it was really slow. It was slowing delivery down. And they needed to move fast because all the other competitors were out there. So they said, all right, like they wanted to get rid of the monolith and put together smaller services. But they knew unless they had a strong mandate that you cannot add new stuff to it, this will never happen. So they said the mandate was everything new needs to be your own service. You take care of it. We don't care. And suddenly so many independent services were born, which was not the goal.

[29:48](https://realalpha.app/v/a0sZV0qIbI0/?t=1788) And years after the fact that when Uber decomposed the monolith, they're now looking at maybe sensitively merging based on business domain, et cetera. But this story wasn't really told at the time. It was just, oh, look, like Uber has thousands of microservices, almost one or two per engineer. Right. And this is what the world saw. I mean, it's also, though, but this is the reality of microservice adoption. is like, it's just a tool in a toolbox. I mean, I've described microservices as being an architecture of last resort. Yeah, yeah, absolutely. Because it pushes you quite naturally to a more aggressive distribution of your state and everything else.

[30:23](https://realalpha.app/v/a0sZV0qIbI0/?t=1823) And so you have to have a good reason. One of the best reasons to use microservices is if what you actually want is an organization with a higher degree of autonomy. If what you want is teams who are able to act independently from each other, the microservice architecture is a fantastically good fit. But then really it's a means to an end, right? So that's often what a lot of people get wrong, I think, is they adopt microservices and they think this other magic stuff's going to happen. If you want organizational autonomy, that's what you're working towards. And this is just one of the mechanisms to get you there.

[30:56](https://realalpha.app/v/a0sZV0qIbI0/?t=1856) And most of the enterprise organizations, the vast majority of ones I've worked with in this space, that's what they're after. They've got huge numbers of developers, lots of middle management. They're not getting much work done. They're thinking, what do we do? Organizational autonomy becomes, you know, the solution to all problems. Again, I don't always get to have to say whether or not it's a good idea. And I think that's where microservices can be especially useful. I mean, there are other exceptions as well. And so an organization like, you know, Uber, I mean, and I know Netflix as well, things like domain-driven design weren't talked about at Netflix, but the teams are already fairly well-scoped around areas of products already.

[31:33](https://realalpha.app/v/a0sZV0qIbI0/?t=1893) And so you had those natural high-level boundaries around the business domain. So those things flowed naturally. And so that, for me, was a logical kind of stepping stone. You also have the difference, and this is something I realized quite early on, when you go and do the work in the dot-coms versus the enterprise organizations. When you say dot-coms, you mean the digital companies? Yeah, yeah, tech companies. I'm old enough that I still talk about dot-coms. But the tech companies, I mean, fundamentally, algorithm you know to make from a domain concept are incredibly simple the domains are very very simple compared to enterprise organizations by and large domains in there are much much more complicated because they're based on business processes that have existed for 10 20 30 40 50 years oh yeah so what you mean in a lot of tech companies a product is pretty much here's our product here's how it makes money and that's kind of it and we have another product in uber inside uber like a simple thing is there's rides which it makes money like this and then there's uber eats which is a separate business over time by the way it does get more complex but but when you start it's like really really simple yeah and it's really separate and it's clear like where one

[32:32](https://realalpha.app/v/a0sZV0qIbI0/?t=1952) ends versus where the other begins and then you do some hacks when you need to launch uber east really quickly and you build it on the right infrastructure and then uber east order has like two trips attached to it because Anyway, but as you say, like early on, it starts very simple. But then also in those environments, your business processes and the digital implementation of those business processes is evolving together. And a lot of enterprise organizations didn't have that. I mean, their first generation of digital products were codifications of paper-based processes. Oh, so you're talking that these companies, before digital, let's say, Adidas or let's say a shoe company.

[33:08](https://realalpha.app/v/a0sZV0qIbI0/?t=1988) Virtually all banks. Virtually all banks. And now they're like, we have all these processes and now we need to build a software that mimics what we do, which of course is... That's how you start off. I mean, that's what the whole DomainJuneZine book came out in 2004. And it was a reflection of the fact that the vast majority of software development was the process of us trying to model existing non-digital processes and how you do that. I wonder if we will have a different but similar problem of the same thing. Now that we know AI tools are here, we know that, for example, they're great at generating code.

[33:43](https://realalpha.app/v/a0sZV0qIbI0/?t=2023) And we have two types of companies. We have a company, a digital company, that has pre-AI. They're used to writing product, we're having documents, deploying developers, product managers, designers, QA. They all have their roles, and it works like a really well-oiled machine. And now you have these so-called AI-native startups who just, again, they have a few people. They're just, from the start, they're using agents for everything. They have a very different process. And at some point when this whole thing will mature and we will have best practices, we'll have the existing companies who, like, the previous one they will try to retrofit you know this this tooling to how they're working today it's already happening i mean and the thing is enterprise companies will rarely be successful doing those first gen things because ultimately the corporate dna would just crush that stuff from within right and it'll take a while but i think the whole industry is getting is grappling with the idea of like are we now moving to a new level of abstraction right so i think software's all about abstractions right but you know we went from doing machine code doing assembly went from assembly general purpose programming languages and you're coming back to the idea of the program

[34:47](https://realalpha.app/v/a0sZV0qIbI0/?t=2087) being the mental model we would evolve that mental model at the code point of view that was a most effective place was us working at job you know java you know c sharp whatever it is rather than working at assembly level right and it's like okay well it's actually what we're talking about really we're stepping that level up we're still actually building a product together we're still thinking about what the software is we're still building that mental model maybe now more collaboratively involving you know more product people for example in that conversation when we're writing our specs and so the question for me is are we ready to make that step and the answer is no not everywhere and this is a really good point because if you think about it like you know like one of the the mantras inside of facebook used to be that i think some something along the line that code is truth or something like that.

[35:36](https://realalpha.app/v/a0sZV0qIbI0/?t=2136) But in general, in a lot of tech companies, if you want to know how things work, like where the truth lives, is it in documents or is it in the coded business logic? It's in the code in the business logic. And if it's well-maintained code, often well-commented or structured, you can actually see the business logic and the rules for, I don't know, for example. See, I feel like I've got to channel my friend Charity at this point and say the truth is production. Everything else is the lies we tell ourselves. Production is truth. But I think in terms of like a definition of what the system should be doing, there is this ongoing debate about where is that definition?

[36:15](https://realalpha.app/v/a0sZV0qIbI0/?t=2175) Is it the code or is it the spec? Brigitte Brockley did a nice article on Martin Fowler's website recently about spec-driven development. And she talks about the idea of some companies being spec-first or spec-ankered. And a lot of it comes down to where they see the source of truth, being so a lot of companies are using things like kiro or spec kit to define a feature and then the llm executes that spec and you could Iterate on that process, right? And so a lot of people, they start off, they use the spec to write the code, and then they throw the spec away. And then you get other companies that keep the spec, and then when the feature changes, they just update the spec. And so they're sort of seeing a bit of the code and a bit of the spec as a source of truth in terms of what the system should do. And then you're now starting to get companies where they didn't even ever look at the code, and they just look at the spec.

[37:06](https://realalpha.app/v/a0sZV0qIbI0/?t=2226) And so we're kind of going on this spectrum. She had some great terms for these. And I think for me, it's like, is that the right path? I don't know. I think there's a lot of questions about what we would need to do to get that. We have a degree of confidence about what happens when I execute a line of Java code. Beyond the safety of the compiler and the runtime and all that stuff, there's a lot more questions to answer, I think, before the whole world is ready to say the spec is the source of truth of what our system is supposed to do. production is always going to be the real truth so just to be clear but but i think it's a good question to just ask yourself what however you're building however using agents of where is the truth of your system right now is it more in the code do you have a spec is it scattered between the minds of people uh which goes back to the the collaboration because again a lot of the reality of a lot of startups are is a few people hold these things in their head right which is okay in the beginning but of course as you scale one of the reasons we used to love code review which is now going out of fashion but we used to share information and when someone left the company or

[38:10](https://realalpha.app/v/a0sZV0qIbI0/?t=2290) or got ill or you know the the famous bus factor it was okay because other people understood because they reviewed they were taking part in that part of it but now we're with the ai code review is some some some companies are like well we're not going to do it because of it's it's too much code that was always one of the superpowers of pairing right pairing you wrote if you do if you do promiscuous pairing you rotate every day when someone leaves everyone's got the same shared context. That was something people missed around one of the benefits of pairing. I think there's a lot to be said around this. I was chatting to Chris Ford. He's sort of head of software, head of technology for ThoughtWorks in Spain. And he said the biggest problem we've got around AI-driven software delivery is tacit knowledge. There's a lot of knowledge in our heads that we've built up that we don't necessarily know that we have. When you do something like a code review, You probably had looked at that and said, that doesn't really feel right.

[39:04](https://realalpha.app/v/a0sZV0qIbI0/?t=2344) I wouldn't do it like that. And sometimes it's subjectivity, but sometimes there's something about that that you can't quite pinpoint. Maybe you can unpack it. Maybe you can't. But it's also like you have bunches of things like that in your head about how software delivery should be done about how the business works and everything else. If we want to step up that level of abstraction to work at the spec level, we actually need

[39:26](https://realalpha.app/v/a0sZV0qIbI0/?t=2366) **Sam Newman:** as human beings to be able to unpack that tacit knowledge that we have and make sure it's in the spec.

[39:32](https://realalpha.app/v/a0sZV0qIbI0/?t=2372) If we really want to be hands off, I also think there's a fundamental problem that we've got in the current way a lot of people are doing software deliveries. You've got, and this comes back to the cognitive debt stuff, which is you've got a lot of people running off in different directions. I've seen a few people talking about pairing with their AI assistant, not a human. Stop pretending it is. And so you're all going off, you're doing more in a different direction. That shared mental model of the program is breaking down and there's gaps in between. AI was supposed to free us from drudgery. right it isn't for most software developers because we're doing more work we've got more context switching we're losing that big picture so i think if we can work collectively on the specs we can rebuild that model then that absolutely could be the source of truth i still think it's going to be parts our brains and part the spec right but for that to work with there does have to be the collaboration piece whether or not that's our dev teams go from being 15 people all into about five people or six people don't know but collaboration is really important you know chain guard are a proper company right they do proper stuff they're excellent for them

[40:38](https://realalpha.app/v/a0sZV0qIbI0/?t=2438) they recently announced they were getting rid of any human-based code reviews and they said we're going to spend more more time working on things like effectively working at design doc level and actually i'm okay with that because firstly i trust that they know what they're doing but also there's something about i mean i think a lot of companies are making the mistake of not doing the thinking whereas chain guard is saying we're going to spend that time doing more important thinking right and i think that's sort of how we should view this i'm okay you know not looking at the code as long as you're doing other things to make sure the system is operating correctly and that you're thinking critically about how the system needs to change and evolve if you're just not looking at the code and you're not caring about those other things well then you deserve everything that's going to happen to you which also goes back a little bit to what charity was talking about on how you want to have systems that value that works about having empathy for example for the work that qas and and sre folks have had to own code in production that they didn't they did not write they don't necessarily read or even understand

[41:40](https://realalpha.app/v/a0sZV0qIbI0/?t=2500) but they know how to operate they know what good looks like in production they know what it looks like when it goes poorly I mean that's also a bigger thing that now more developers are having to struggle with because if you want to do spec-driven development you have to know what good looks like I run these half-day conferences for O'Reilly online we did one recently on software delivery a load of speakers and about six speakers and four of them were talking specifically around different varieties of spectrum development effectively. And all of them came back and said, you can't do this unless you can define what good looks like. And if you can't, don't bother. And, you know, some of those people were much more bullish, like Addy Osamai is very bullish on all this stuff. But one of the presenters who was doing, they've got like a small software fracture, only 15 or three people, but like they're actively pulling in their observability data, their hotel stuff, right, into their agent to understand how it's changing.

[42:37](https://realalpha.app/v/a0sZV0qIbI0/?t=2557) And I think that's exposing, I think, more developers into understanding. I mean, this comes back to the acceptance criteria stuff people do in stories. They're always very narrow and functional requirement stuff. So now it's like, I think we'd have to be more grown up about those things. The discipline is absolutely important and the expertise is still needed. It's just needed at a different place. Sam made the really good point that you cannot hand your work over to agents unless it does these two things. One, define what good looks like. Two, prove that your system does what this good definition looks like.

[43:08](https://realalpha.app/v/a0sZV0qIbI0/?t=2588) You already know who I need to mention when it comes to proving that your system works as expected. Antisysys, our season sponsor. Agents are writing more of the code, so how can we trust that our system works correctly without bugs? Code review is an increasingly naive and ineffective approach to do so, which is why Antisysys goes well beyond this practice. Antisysys runs your whole system in a hostile simulation. This simulation includes both targeted testing and fast testing. By running this simulation, it finds every bug before your users do. And because the simulation is fully deterministic, it doesn't only find bugs, it gives you a perfect reproduction of every issue, which makes it a lot easier to fix issues.

[43:45](https://realalpha.app/v/a0sZV0qIbI0/?t=2625) The first thing I thought when I heard about antithesis and that it's automated bug discovery and fully deterministic testing, that it sounds like science fiction, but actually it's hardcore engineering when you look under the hood. Janestreetfly.io and the etcd community ship agent-written code with full confidence because they know it's been verified by Antithesis. To see more case studies and details, head to antithesis.com slash pragmatic. I'd also like to mention our presenting sponsor, TurboBuffer. We know it's a database that's ridiculously fast and extremely cheap. And they are doing something amazing.

[44:16](https://realalpha.app/v/a0sZV0qIbI0/?t=2656) They are completely redesigning their storage architecture from first principles to make search faster, cheaper, and more reliable at scale. If you follow TurboBuffer, you know that their storage architecture was a massive part of their early success. Redesigning a winning architecture is a big deal. It's one thing for query plans to pass unit tests, which is already happening. It's another to bring each query plan to performance parity or better while maintaining correctness and reliability in production. And the team is sharing. the messy reality of the rewrite and how the v3 version is currently a lot slower than the current production one.

[44:48](https://realalpha.app/v/a0sZV0qIbI0/?t=2688) For example, we can see how cold full-text search is 11 times slower than prod and hot full-text search is 126 times slower. But we can already see some wins like hot and cold vector search is at parity or better. I really appreciate this work-in-progress view and the real-time logs and what it takes to do a successful storage architecture rewrite. The TurboProffer team is keeping on the work to log up their journey and you can follow along at turbopuffer.com slash v3. I definitely will do. And with this, let's get back to Sam and what QA and S3 folks already know about running code that they didn't write. So I wanted to talk to you about your latest book that is just coming out, Building Resilient Distributed Systems. Yeah. What is the book about and why did you feel this is a good time to write it?

[45:27](https://realalpha.app/v/a0sZV0qIbI0/?t=2727) Years and years and years ago, I went to Velocity, which was quite a well-known conference. It's a conference, it's still on? No, no, it was the O'Reilly conference and it was like the conference where a lot of the early dot-com people went to to talk about how they made their systems scalable and stuff. I got to go, it had been like one of those career ambitions to go to one. I got to go, because after I'd written the first book and I got chatting to John Allsport there, who I still chat to for now and then. He now works in his resilience engineering space. Pointed me, I don't know if it was him or one or something else, but it pointed me at this paper by David Woods that was all about resilience engineering.

[46:00](https://realalpha.app/v/a0sZV0qIbI0/?t=2760) And the paper was utterly baffling to me. in absolutely no sense to me. But it was all, because it's not, yeah, because it's just, it's not written for computer scientists to read and I'm not even a computer scientist. So I was really in trouble. But it was really fascinating seeing this whole other world about how we make, how people view resiliency and then what we do in the software world. And people like John were trying to take some of those ideas in a little bit. But I find it very difficult to take some of those ideas from sort of safety critical systems and that type of thinking and make in any way, shape or form palatable for people.

[46:32](https://realalpha.app/v/a0sZV0qIbI0/?t=2792) normal people like me. And so I kind of, this was being back, what, 2016, maybe 2015. And so I'd go back and try and reread that paper every six months or so. And I'd read bits around the edges and see other smarter people than me that summarized it data better. And then I was thinking, okay, these ideas now are starting to make sense. And then also I kind of realized that despite my best efforts, lots of people seem to be building microservice architectures, even though if you've read my books, most of my book is about telling you not to do it. But you have to read the book, which is called microservices.

[47:04](https://realalpha.app/v/a0sZV0qIbI0/?t=2824) Let's be clear, as long as they buy the book, that's the most important thing. Whether they read it or not, that's just, you know. And so then I realized that there were more people exposed to the horror, pain and suffering of a distributed system. And so it was like, okay, so I've got this stuff happening. I've got this, like my, you know, my son's developing now. And I almost thought that if somebody found themselves building a distributed system, working as part of building a distributed system, what was like the kind of equipment of a rubber ring I could give them, say, stay afloat and don't drown. And so the goal of the book is to start you off with really easy, foundational, simple kind of engineering concepts about how you can start making, dealing with the problems of disability system, but to also take you on a journey into kind of the whole concept of resilience engineering. And so it starts off with really easy ideas and then you slowly get more and more complicated. And, you know, so I introduced kind of concepts like what a socio-technical system is, the difference between safety management and resilience engineering these are all like big concepts but the second chapter

[48:05](https://realalpha.app/v/a0sZV0qIbI0/?t=2885) after the introduction is what's observability let's talk about OTEL the third chapter is what's a time out right and these are all I think quite tractable things to talk to people about. They're building blocks right the primitives for these systems and the vocabulary as well yeah absolutely and to give you know to go through and sort of distill some of that knowledge down and also to be a bit of I'm quite happy being a bit opinionated on these things but But I'm also lucky now, partly because of my early work, I get to chat to more people so I can actually talk to people who this is their full-time job and try and distill down some of that knowledge.

[48:38](https://realalpha.app/v/a0sZV0qIbI0/?t=2918) bit. And so I wanted that book partly as about being evergreen, but it was also about saying there are lots of people building a distributed system. Let's put what type of distributed systems you've got off to one side for a moment. There are lots of people building them, whether they should or not. And they're really important to us now. So how do I, how do I help people start and grow? And that's, that's what I wanted to do. I mean, I enjoy the process of writing anyway, but this is a book I wanted to be able to give to people. That's always been why I wrote a book i want the book that book every now and i've gone sat down to read a book to write a book and i found someone else has done done already it's like well that exists now so this for me was a book that i wanted to exist but didn't that's kind of why i wrote it yeah and i think it's a book i i certainly could have used like it got dropped into a place like goober where we did have what i realized were distributed systems you don't just large systems handling a bunch of stuff lots of services depending on one another because even a simple thing of like knowing like oh you should pay attention to observability that i mean you figure it out after a while yeah but it takes

[49:38](https://realalpha.app/v/a0sZV0qIbI0/?t=2978) a while yeah and i think that's i mean again i mean maybe this is this is my attempt to unpack some of that tacit knowledge to an extent i've made so many mistakes and i keep making mistakes i think with making mistakes is useful but i think also creating opportunity where people can learn from other people's mistakes first is a good idea too and so in the book i also try and pull in like real world examples and sometimes from big companies sometimes from my mistakes to kind of make this stuff seem real and i think the other thing i think i really try and get across is that things go wrong right i mean engineering is all about making sure as many things go right as possible it's not about making sure everything goes right yeah and there's also the only way you can build resilient systems in general is also by being honest about mistakes that have been made and talking about them and sharing them because that's how everyone gets better and if you don't do that you can't build a resilient system in your company and so this again is my attempt to sort of highlight all the awesome work that's gone before the fantastic post-incident reports of people that some companies share like when there's a system that we all use or many of us

[50:44](https://realalpha.app/v/a0sZV0qIbI0/?t=3044) use has an outage i mean it's it's annoying especially when you're using it but i always greatly appreciate when the companies because they don't have to do this but when they share a public post-mortem or incident recap whatever that is they go through what happened for example GitHub had an outage and they shared a really interesting one on what all the things that went wrong and in what order. And then you also have companies where something like this happens and they don't do anything. So, of course, you're not obliged to in any way, but I always have a bit of a lesser. They are obliged to now, a lot of them.

[51:17](https://realalpha.app/v/a0sZV0qIbI0/?t=3077) Regulations are now making them. Which I think is great. Yeah, things like Dora and stuff in the UK, in Europe rather. And I think there's also, we should also separate around that post-instant report stuff that there's marketing and PR versus have you done a proper post-incident review? Now, I do think you've a duty of care really to let users know it's part of a proper post-incident review, but those companies that maybe say nothing, they might do a fantastic process internally. There's also the fact that some companies that put those things out, you read them and you're like, this does feel more marketing.

[51:45](https://realalpha.app/v/a0sZV0qIbI0/?t=3105) I think a great, if you want a good, a company that puts out some of the best self-flagellating post-incident review write-ups, go for Cloudflare stuff, they absolutely go for themselves in those and it's like i feel like guys go easy on yourselves right everyone makes some mistakes but i quite like and and do it they do it rapidly within 24 hours and they're a publicly traded company yeah which i think just goes back to the myth like some of them are like we're publicly traded we don't want to do it because it will give away information for shareholders yeah no like cloudford does it and and they're fine exactly exactly and and also it's and the build of trust it is i mean a lot of a lot of how an organization is perceived is down to how you deal with mistakes when they occur, right?

[52:36](https://realalpha.app/v/a0sZV0qIbI0/?t=3156) I mean, nothing ever goes perfectly for every company. So in your book, you talk about the three rules of distributed systems. What are these three rules? So I really tried to distill this down because I could never... If I remember the rule of eight that came out of Sun, the fallacies of distributed computing, I always forget what those eight were. There's loads of complicated stuff, but I realize when you strip it all down, there's really only three things that really cause all the other problems. The first is that you can't send information instantaneously from point A to point B. It's physics. I mean, now it turns out when you get into it and start talking to people about quantum physics, they say, aha. And there's a thing called quantum entanglement, which does allow for the theoretical instantaneous read of electron spin states across arbitrary distances.

[53:21](https://realalpha.app/v/a0sZV0qIbI0/?t=3201) At which point I point out that A, that only works for reads, as far as I'm aware, and B, not a networking protocol. So like, but it takes time, right? So I'm going to get from A to B, and that, I can't control all of that. I can control bits of that as a developer. I could control how much data I send. I could control the payload size, technology I use to serialize and deserialize. I'm unlikely to be specifying the network cabling the equipment we use or distances between them so I'm not really under my control and the moment you go over the public internet BGP has a bad day and your packet has gone down the wrong trouser leg of the internet right so that's the rule one it takes time and that's important to recognize because sometimes it looks instantaneous it's not second thing sometimes the thing you want to talk to isn't there sometimes that's under and we do things to make it under our control right like we would run say multiple copies of a service instance behind a load balancer.

[54:15](https://realalpha.app/v/a0sZV0qIbI0/?t=3255) What happens if the load balancer fails? But I mean, like, you can't control for everything, right? I've had services taken out by a fire in a data center, a SAN caught fire, and specifically one bit of a SAN. The SAN had a caching storage layer with SSDs, these two pairs of SSDs. One of the pairs of SSDs caught fire. The other pair, the SSDs, are working fine. And so we had these weird latency graphs coming out of the SAN, like perfectly fine if your load went through the ones that weren't on fire but the failovers and the other one were routing to be fair it was routing around the bits were on fire I had a system where we had ducting between the office buildings and rabbits moved into the ducts and ate their networking cable I can't control for rabbits right and sure these things are like they're real these are true things right yes you can control for that and you can reduce the chances but you can't limit those chances so sometimes rule number two is sometimes the thing you want to talk to isn't there and the third rule i'm very grateful to an old colleague of mine ben butler cole for telling for saying i'm missing is that resource pools are not infinite meaning you can run out computing resources cpu memory io whatever basically your load balancer could be overloaded

[55:27](https://realalpha.app/v/a0sZV0qIbI0/?t=3327) and then just not respond even though it's there and we know the latency but it maybe its queue fills up and look the vast majority of the time when you have a system outage you're down to that some resource has been totally saturated somewhere and it might have been that saturation might in turn have been caused by the fact that something is down and you're in a retry storm which is in turn causing you know connection starvation which is in course got a resource saturation which is in turn yada yada yada but that that's the killer and and again i think we understand that you know sort of intellectually all of these things but you can go to all the concept complicated concepts and distributed systems and so on.

[56:05](https://realalpha.app/v/a0sZV0qIbI0/?t=3365) Why is Byzantine Consensus Protocol a thing? Well, let's just go all the way down to this bit. What about CAP and PAC-HELC? Let's just put ourselves on the side. Remember these three rules first, and then most problems end up becoming a little bit easier to deal with. And in the book, after you introduce these rules, you start, as we mentioned, the second chapter is observability. To me, that kind of suggests that this is a really, really important part for distributed systems. Why is observability so important? I mean, the way to think about observability is it's a property of a system, right?

[56:31](https://realalpha.app/v/a0sZV0qIbI0/?t=3391) So the more observable something is, the easier it is for me to understand how that thing is behaving based on the external signals. When you run a system, which is a single program. But you actually get some pretty high quality signals coming out of that program, therefore give you a high degree of observability. I can get a lot of information out of that. I could attach a debugger to a process. I could generate a core dump and run that in. I could do a thread dump on the JVM and work out where my semaphores are blocked. If this is my whole system, like knowing the CPU is stuck at 100%, it's actually really useful information because that's probably a bad, that's a problem, right? So this basic information that we pretty much get for free with a single program gives us a high degree of observability.

[57:15](https://realalpha.app/v/a0sZV0qIbI0/?t=3435) It's a single program running on your own machine that you have access to. Exactly right. But now we go to a distributed system, you don't have access to the computer in the same way. You've got multiple computers. And so those basic signals are harder to get. You can't correlate them unless you do extra work. And those individual signals by themselves don't really give you a proper sense of how the system is behaving. So you have to do more work to make the system observable. And as annoying with these sorts of things, it's much easier to do that from the beginning than it is to retrofit it. And, you know, luckily we've got things like OTEL now, the Open Telemetry Protocol and specification, because that at least gives us an open framework.

[57:54](https://realalpha.app/v/a0sZV0qIbI0/?t=3474) A vendor agnostic, although Honeycomb are the best, charity pays me in stickers, just to be really clear. I always think, I work independently, I have to be very clear, charity pays me in stickers. But like, we get a vendor agnostic open standard for this now, so it makes it so much easier for me to have a conversation about this. But if I don't get the signals coming out of the system, if I don't get that stream of structured events telling me what the hell's going on with my system, I'm flying blind. Like, how do I know what appropriate timeout is from a client point of view talking to a service?

[58:23](https://realalpha.app/v/a0sZV0qIbI0/?t=3503) Well, I'm only going to know that if I have a sense of, well, what is its normal response time distribution? So I'm going to need latencies, know the success or failure of those latencies, probably want to be a plot and a histogram maybe to take a look at it. If I don't have that information coming out, I'm not going to have to set best of my time out correctly. And then we're talking about a low-level thing like latency and things that we can measure at the machine level. But of course, is it observably when I'm talking about like, does it work for the user or the customer? Does it do what they do when they click the button to submit?

[58:53](https://realalpha.app/v/a0sZV0qIbI0/?t=3533) Does it submit? Do you look at that? Because we know observability is usually we talk about these kind of latencies, the statuses, the 500 responses. That's kind of bad. That means it's down. But there's always a player that I always wondered and I found it hard even when we're working in teams to okay like we have the the easy observability like this is kind of text not textbook it's the metrics it's the metrics and the logs but then there's a stuff of does it work does it do what people care about like again in the case of like an uber like when people hit a button to request your ride like does it actually request within within usually five seconds or something like that or is it stuck in an infinite spinner which is which is bad even your logs can be as healthy as can be but people are upset right you know you you treat the raw data of making the system observable as a stream of structured events and then from that you build up the higher level abstractions and of use right so uses as primitives so a trace right where we get a sense of for a given click of a button what happened in the production system and this is a big blind spot right most organizations had to build their own tracing systems so this is where

[59:59](https://realalpha.app/v/a0sZV0qIbI0/?t=3599) things like the OpenTracing stuff came from and things like Zipkin and things like that were built as an attempt to recreate. Like, I mean, most people were just normally trying to recreate what Google had already built there. And this was an attempt to say, okay, can we at least look at a flow of calls? What happened during that flow of calls? Where did these things go? Well, that requires me to get a bunch of spans across from all these different machines. And a span meaning? A span meaning an activity, basically. It's something I did. And then a span can begat more spans. So I can say my first span might be a call has hit my server.

[1:00:33](https://realalpha.app/v/a0sZV0qIbI0/?t=3633) So I've now got a span that starts. Within that span, I might talk to my database and then do some other operations, and I can put additional information on those spans. And then I can go up to another service. And then you get a trace ID that's shared across those spans and you've got timing. So now you get effectively a view of what's happened across those calls. But that's all just based on individual events that have been stitched together. And then you also start getting into the situation which is, is my system behaving correctly? And, you know, this is going away from, again, I think half the time I'm just saying what charity would say.

[1:01:04](https://realalpha.app/v/a0sZV0qIbI0/?t=3664) You know, again, going away from the vanity dashboards. This is moving into the sort of the world we call the SLOs, the service level objectives. And SLIs. And SLIs. So an SLI, a service level indicator, that's our way of saying at this given point in time for this thing, is this thing good or is this thing bad? And we use a collection of those. So one example of that might be a successful percentile response time, right? So that would be, is it a good one or a bad one? It could be a bad one because it's an error. It could be a bad one because it's slow, good or bad. And I collect those together and that helps me know if I'm meeting my SLO.

[1:01:36](https://realalpha.app/v/a0sZV0qIbI0/?t=3696) so i might have an overarching slo which is i should be able to request a ride the 99 percentile successful ride request within uh 300 minutes yeah and that would be your statement and that would be a commitment the slo is supposed to be a commitment that's something our team is is working towards you then get this raw data you calculate your slis on the individual things and then you use that to work out what your slo is looking like if it's green everything a good time if it's red people are unhappy i mean you get a bit of red there's way more nuance to it that i'm taking a very bad introduction to this stuff i think but without those building blocks because like i talk about the first chapter of the book nobody says i don't want my system to be resilient yeah no no one but at the same time resiliency is not a binary property it's not like off or on it is a bit like observability it's a degree so then the question is how much do you need because am i having a conversation with you about multi-cloud and, you know, doing complete rewrites of systems for critical stand-ins like Monzo do, for example.

[1:02:45](https://realalpha.app/v/a0sZV0qIbI0/?t=3765) Yeah, they have a stand-in bank when they go down. They have a whole stand-in bank. So it's sitting there, it's costing them money for the most part, but then just a few weeks ago, their main application went down for a short period of time and they activated that bank, which I'm assuming it costs them millions of pounds or dollars per year just to keep it there. It's not even a slight sidebar, but so firstly, their standby bank It has a real stripped-down list of features. It's much more bare-bones, but it's all the core ones. Like, you can freeze cards, you can take money out, you can check your balance.

[1:03:15](https://realalpha.app/v/a0sZV0qIbI0/?t=3795) It's a complete rewrite, so it's no shared code because they're worried about a bug. Different cloud vendor. It's also, by design, significantly more cheap to run. So they've got thousands of microservices on the full stack. This is about a tenth the cost of the cloud cost. They also run it constantly. So it's always there. But, like, Monzo, know they're Monzo, right? That's how that works. but like there's no point you starting there so actually the reason i put the observatory stuff in is like you need the raw data but also you need to make decisions about this comes back to what good looks like then you need to know okay do i need to worry about multi-cloud vendor dr strategies because that's where i need to be going or am i somewhere else and so i think without that kind of sense of your north staff how resilient do we need to be without that defined, you don't know how deep you need to get. This is why I'm trying to say how secure does my system need to be?

[1:04:09](https://realalpha.app/v/a0sZV0qIbI0/?t=3849) Have you done a threat model? If you haven't done a threat model, I don't know. And I guess to answer this question of how resilient do I need to be, it greatly helps, and maybe it's actually a requirement to do an informed decision, is how much will it cost me in terms of operating costs, in terms of time to build it, in terms of, for example, latency. Just a simple example is if you say, like, okay, the business is like, oh, would you like multi-cloud? And the business is like, yeah, we'd love multi-cloud. like if amazon goes down because we heard they had an outage last week or a few months ago i actually want to be able to run google cloud but then you'll be like okay well first of all this will mean we're paying two cloud bills and if we want full replication it might increase our latency because we need to wait for to write for both of them which might You know, customers might see things slower. Anyway, there's all of these trade-offs. And in my experience, like oftentimes, like you might retrofit that, but if you can have a discussion upfront, that's great. But to have this discussion, you need to know what the trade-offs are. You need to know what's happening in all these dimensions that, you know, you care about, like how long will it take to build? How complex will it be? How much money will it cost to operate?

[1:05:16](https://realalpha.app/v/a0sZV0qIbI0/?t=3916) But also as technologists, we can't just say, oh, we have also got to get good at communicating with our business stakeholders, with our end users. Oh, yeah. What percentile latency do you want? Like, some developers know what I say when I say that. Not all, but some. How many, you know, experts in their field who are great product owners or subject matter experts but are not software developers would know what I meant by that? And so we also have to understand the business domain, the product domain, well enough to do the interpretation and help and to bridge that gap. And it is a dynamic thing as well.

[1:05:53](https://realalpha.app/v/a0sZV0qIbI0/?t=3953) I mean, this is the whole thing about resiliency in general, right? A resilient system is one that changes. It changes and it evolves. If you don't change, it evolves. You're a brittle system. You're not a resilient system. And so even those targets, that conversation you have to have about what is good enough does change. but like think about something like in the case of say the us east one outage towards the end of last year um there were lots of on aws on aws as a aws us east one region went down it was the biggest region big region lots of people there first because that's often where new services got launched historically when that went down it caused a lot of people to say do we need to be multi-region and some of those companies would have had the conversation before and decided no we don't and then they've seen the fallout and they may have changed their minds and that is fine this is what you mean by a resilient system evolves yeah thanks to the real world but also like it is about what problems you're not going to try and solve there were some big name companies that got taken out when US East 1 went down and got severely had severe degradation in terms of what they could offer

[1:06:58](https://realalpha.app/v/a0sZV0qIbI0/?t=4018) companies like Zoom for example they weren't taken off entirely but they were severely affected do we think that people working at Zoom are idiots? no Do we think they knew that if a cloud region went down, they'd be impacted? Yes.

[1:07:09](https://realalpha.app/v/a0sZV0qIbI0/?t=4029) **Sam Newman:** They probably looked at that and said, well, for us to come out with a multi-region approach, it's going to have this impact.

[1:07:15](https://realalpha.app/v/a0sZV0qIbI0/?t=4035) It's going to cost us this much money. It's not worth it. Let alone talking multi-cloud. Because multi-cloud versus multi-region is a whole different conversation. And that's okay. And I think as long as you've had the conversation, and as long as, this is the other secret bit of it, of course, is as long as what you think you need to do is in tune with what your users think it needs to be doing. This is why I make the point in the book when talking about the difference between SLAs and SLOs. The SLA is what you're going to get sued for if you breach. If you only ever deliver to the SLA, your customers are rarely ever happy.

[1:07:47](https://realalpha.app/v/a0sZV0qIbI0/?t=4067) You've got to do more than that, right? So there is the social contract there as well. Now, with building distributed systems, building resilient systems, it really helps to understand concepts that are not as straightforward. I'm not going to go through all the things. You explain a lot of things in the book, But I do want to touch on a concept that I found a bit tricky to understand and then appreciate and you really appreciate in distributed system, which is idempotency. Yeah. What is idempotency? So there's a mathematical concept behind idempotency that I don't understand. But basically, an idempotent operation is one that you can, you know, you can apply that operation multiple times without it actually having an effect multiple times.

[1:08:20](https://realalpha.app/v/a0sZV0qIbI0/?t=4100) So it has an effect once, first time. A really good example of an idempotent operation would be pressing a lift button. So you want to go down in the lift. You press the down button, and it lights up. If I press that down button again, nothing's changed. The lift is still coming. Well, we hope the lift is still coming, right? That's an idempotent operation. Some light switches are actually toggles. I toggle it, light goes. On Toglet, light goes off. That's not an idempotent operation. In computing, we have some operations which are not the idempotent reads. A delete is typically idempotent. But the example I think I use in my introduces concept is the one of payment. I was about to say that I have a lot better idempotent example for you. Yeah, payment is a good one. So I'm going to pay you money.

[1:09:05](https://realalpha.app/v/a0sZV0qIbI0/?t=4145) So I'm a service that wants to issue a payment, and I send you, please pay Sam, a hundred pounds. this is i'm nlp-ing people back at home right please say pay sam a hundred pounds and i don't get a confirmation back i don't get back a response the problem is from my point of view there are two possibilities the first possibility is that you receive that payment for us and you've done the payment it's been completed and the result has got lost to me for some reason i didn't get the response that's one possibility the other possibility is that you never got that You never carried out the operation.

[1:09:40](https://realalpha.app/v/a0sZV0qIbI0/?t=4180) Maybe it didn't get to you. Maybe you crashed halfway through. I think like a good example that I always, I've seen it in the past and maybe it's over, but airlines, you're about to buy this airline ticket for $1,000, $2,000. You've checked all of your details and it says like play or reserve. And then often some airlines would take you to an intermediate page which says like, please do not refresh this page or submit it again because you might be double charged. And what you really want is you pay, you know like pay and if you you get the spinner and it's not idempotent if you do it again and you get charged twice yeah but it is idempotent if you refresh you you copy the same thing you submit the exact same form although that's interesting so then the question then becomes right so i sent you that payment but my airline ticket whatever it is and i haven't had that response back but i really want to make sure that the airline ticket booking goes through this is you with the browser or the people at home sending Sam 100 pounds you really want to make sure Sam gets his 100 pounds right now when something doesn't work in a distributed system because of rule number two rule number two meaning the thing

[1:10:46](https://realalpha.app/v/a0sZV0qIbI0/?t=4246) might not be there rule number one sometimes it can take ages yeah and accepting this you just try it again you retry because you really want it to happen and in retrying there's the danger that if the first operation had been processed successfully and you didn't know about it or the first operation have been applied successfully and you do it again you're not getting paid twice and it were two

[1:11:06](https://realalpha.app/v/a0sZV0qIbI0/?t=4266) **Sam Newman:** two tickets so that's the problem with an item potency you want to make it safe to retry important

[1:11:13](https://realalpha.app/v/a0sZV0qIbI0/?t=4273) operations so to do that we need to make them item potent there's two ways to do it really one that's good and that is one you should do but you kind of have to retro retrofitting is pain and one which is one you just explained which is useful but has problems right the first one is item potency keys yep so you generate you have a unique id you'd normally use a uuid for this yep and so when you the unique id which you generate and when you generate two of them they should be different there's like this tiny tiny tiny tiny tiny tiny likelihood of clash which again what happened i think i know but like i think with uuid seven i think it's like a 50 nanosecond chance but it's something you can generate locally without an additional round trips yes your collision chance is extremely low and there's ways to modify that.

[1:11:58](https://realalpha.app/v/a0sZV0qIbI0/?t=4318) You can work with that for the most part. And this is unless you're Amazon probably. Well this but this is I mean the AWS APIs you see Stripe Adium PayPal they all use the same key scheme. So you send this to your UID so then if you send that to me say pay Sam and here's the idempotency key I don't send you back a response for whatever reason. You retry it you pass the idempotency key if I had carried out the processing I could look at it and say oh have I processed this? Yes I have. Okay, great. If I have processed it, even if I get a second or a third or a fourth, have you processed it? It's processed it.

[1:12:31](https://realalpha.app/v/a0sZV0qIbI0/?t=4351) I just keep going back to it. Yeah, it's processed. It's processed. It's fine. That's a nice, simple thing to do. The issue with making things with the idempotency key is it requires both the client and server to support it. So it has to be a required fee. That goes through, and it has to be sent to server support. So if you're trying to retrofit this in, it's a pain. But if you're building it, use an IEB on ZQ. Use it, exactly. If anything needs to be idempotent, do that from the beginning. The one you sort of mentioned was, I go back, I hit refresh, I fill in all the same fields again, and I submit the airline booking again.

[1:13:03](https://realalpha.app/v/a0sZV0qIbI0/?t=4383) You should know it's a duplicate. That's another one you can do. And this was as good if you want to retrofit idempotent again. So if I've sent the same fields, so the same person, Sam, the same amount 100 pounds and i'm sending this through again what you can do on the server side is generate was a fingerprint so i take these fields yep i then generate a hash that represents those fields so if you do a second booking it looks the same and you're using that as item as a retrofitted item potency yeah there's a couple of downsides with that um you do get false negatives with that false negative meaning that it gets it might get legitimate second requests and get rejected got it so a real world example this happens in i know this happens in denmark it might happen elsewhere i'll speak and speak in denmark who works on a payment system you go in you buy something for 40 krona with this particular payment system and you give the car scan the car 40 krona whatever if within the next sort of five minutes you buy something else 40 krona in the same shop the tilt the handset rejects it if it was 41 krona it'd be fine 69 krona it'd be fine but that's because the chances of you buying something for the exact same money

[1:14:11](https://realalpha.app/v/a0sZV0qIbI0/?t=4451) is so remote. So they're doing some basic item potency to top double taps. And so when you get situations where operations can legitimately look the same, but actually be different and carried out at the same time. So a really good example would be the AWS APIs. It is completely legitimate for me in a for loop to provision, say 20 EC2 instances. Now there's better ways of doing it than sticking in a for loop, but I could. So I could iterate through the for loop and spin up 20 identical EC2 instances. If I just relied on there being a fingerprint, they'd all look the same. So that's where this stuff breaks down.

[1:14:49](https://realalpha.app/v/a0sZV0qIbI0/?t=4489) And so if you've got situations where legitimately you have operations that look the same, but they're actually different, they can be done close to each other, you have an issue. If you've got a bit of space around them, what you can do is hold on to those fingerprints for a period of time, five minutes, 10 minutes, an hour. So there's still some potentials you can still let you stick through. So it's not ideal. Item potency key is the way to go. Fingerprints, when you have to retrofit, if you use them both together, that can be really useful. So you can pick up situations where people change the parameters between the retry attempts, which leads systems into a confusing.

[1:15:24](https://realalpha.app/v/a0sZV0qIbI0/?t=4524) It's a bit more of a complex topic, but a lot of public-facing APIs will still generate a fingerprint. And so if you send, carry out this operation and you give the same item potency key as you gave before, but you've changed the parameters, the server can reject it as being effectively an invalid request. So that's how those things work together. Actually, the ideas are really simple, but there's some nuances about implementing them. There's some interesting stuff that crops up in terms of how you store them on the server side and things, but the fundamental ideas are pretty straightforward, I think.

[1:15:55](https://realalpha.app/v/a0sZV0qIbI0/?t=4555) Another interesting topic that comes up oftentimes, these days it feels more often, is thundering birds. Yes. It's when a system restarts and suddenly it faces this big load. And specifically, GitHub had an outage now a few weeks ago where it was networking related and recovery took a lot longer time because there were retries going on and it created a thundering herd. What is a thundering herd? Genetically, I talk about it in any situation where you've got mismatched capacities. You've got too many requests for too few resources, right? Resource pool's not infinite. Coming back to rule number three.

[1:16:28](https://realalpha.app/v/a0sZV0qIbI0/?t=4588) Rule number three. Yeah, so in the chapter, I talk about a whole bunch of different ones from different types of scenarios, right? So you've got everything from the malicious thundering herd, like a denial of service attack, right? A digital denial of service attack, malicious attack, often short notice and... there's not that much you can do about them. The answer is use faster or Cloudflare, but I go into details about how that happens. You get things like a kind of internal self-inflicted ones. So a good example would be something like a cache collapse, right? A system relies on the cache, not only for speed of operation, but also for reducing load on other components.

[1:17:05](https://realalpha.app/v/a0sZV0qIbI0/?t=4625) Yep. Cache gets restarted. You then have a lot of cache misses. You're hitting the origin and the origin goes down. Yeah, originally was not expecting so much load. Yeah, so a common thing there would be, first you'd flush those cache snapshots of disk, reduces the chance of you being out or having high cache misses over a restart. But also a lot of companies I know will just turn their services off until the cache refills. And so that's kind of another example of one. RetryStorms, another one, back in 2017, Square had a big outage. They'd restarted Multipass, which was their multifactal authentication system.

[1:17:39](https://realalpha.app/v/a0sZV0qIbI0/?t=4659) Multipass in turn pulled its data from Redis that they're using as a database because you can do that, apparently. I don't think it's a database. Well, they're using it as a cache, basically, right? Well, no, I think they were using it as a database. There are some people that think Redis is a database. This is a different podcast. I'm thinking of starting a stupid technology podcast where we talk about using technology in a stupid way. So that's a separate conversation. Anyway, so they were putting this data back from Redis and they had a problem that the clients in Multipass were basically, if the Redis calls failed, they'd try again.

[1:18:07](https://realalpha.app/v/a0sZV0qIbI0/?t=4687) but without any delay between the retries and they had a hard-coded limit of 500 retries. So they just basically smashed Redis and they kept restarting Redis and then they'd restart multipass. And again, this is a long time ago and they fixed it, right? They fixed it by having a more sensible retry policy and externalizing those values. That's not a thundering herd. The last kind of sections or ones I talked about were ones caused by like products being too successful like Twitter and healthcare.gov, right? This is where you have an external real legitimate load that takes you out and things you look at all of these as solutions although what's happened is the same the kind of solutions are a bit different so like when i've got a thundering herd that's coming from externally that's legitimate well i've got different things i'll look at like i will have more i'll have a more constrained sign up i'll have fewer invite codes yeah so with healthcare gov one of the issues there was many others but was that they went live at like 36 states at once and they were massively overloaded so in In hindsight, maybe going live in one state would have been a good idea first.

[1:19:09](https://realalpha.app/v/a0sZV0qIbI0/?t=4749) For example, with Twitter, they were going down all the time. So they could have constrained signups or put tweet limits on you and things like that. Those are things. And they did those things as well, right? And so although they look the same, the mitigations for Eaton was a little bit different. So I kind of quite like talking about that because they were all great stories I found. And of course, I think we're talking about solving it with when you have same resources, but then we get into things like scaling like can you scale horizontally add more resources because there's two sides of this right like whenever you have it and so what point can you do it or are you going to face a bottleneck because you still have a central whatever but like that's a great example of where sometimes mitigations work and sometimes they don't so an example of something like your product is successful if you're a startup or whatever and you suddenly got successful that success comes like a wave right the wave of success hits you and then a lot of it recedes you'll get a thousand customers in and maybe you'll keep a hundred maybe right that's just how things work so you need to be up during the peak but then you probably can shrink down again

[1:20:18](https://realalpha.app/v/a0sZV0qIbI0/?t=4818) to keep the cost low so if you've built your application to have some dynamic scalability in it and if you're on the public cloud or similar place where you can spin up and spin down that's a viable mechanism right okay we can scale up to handle this and that's fine would i use that as

[1:20:33](https://realalpha.app/v/a0sZV0qIbI0/?t=4833) **Sam Newman:** defense against a distributed denial of service attack? No, because then your distributed denial of service attack becomes a distributed denial of cash attack, right? You go from to not only

[1:20:43](https://realalpha.app/v/a0sZV0qIbI0/?t=4843) you're having no service, but also now no money. Because you hit spinning up, you know, nodes on your Kubernetes cluster and Amazon just keep taking the money. It's great. And you still can't keep up. So that's a perfectly valid mechanism for some things, but you kind of have to know the context in which to say, you can't just scare yourself out of trouble. I think we're going back to a lot of times as like as an engineer, you want to know about the business. You want to know what creates a value, what creates revenue what is important for the company versus what is not and then where we want to maybe invest to yeah with our infrastructure with our reliability versus where it doesn't matter and it's not worth doing it's all about trade-offs and i think it's about you don't know unless you get information out of your production systems you don't know how close you are to the red lines that's why the observability is keeping is all about trade-offs and it and that's why i do a whole chapter on like formal methods I talk about cap and pack elk and I say look these things are complicated but actually really all comes down to a conversation with understanding the business context so the example I give there is like if an e-commerce company if I want to buy an item

[1:21:53](https://realalpha.app/v/a0sZV0qIbI0/?t=4913) online right physical item online and if at that moment I want to purchase it if you're not sure if you've got it or not most e-commerce companies will say yeah sure you can have it because they know there's a good chance they do actually have it in stock and if they don't have it in stock They can get it in and back order it. And the worst case scenario, they can email and say, sorry, and refund you the money, right? So that's not great. It's not ideal. Now, if they said, we don't know if we've got this item, therefore we're not going to sell it to you. They're missing out on a sale. And I could go buy that somewhere else probably.

[1:22:23](https://realalpha.app/v/a0sZV0qIbI0/?t=4943) And they might have had it. So e-commerce companies in that situation, because of that sort of understanding of the relationship with the customer and the impacts if they get it wrong, they're going to try selling the item.

[1:22:33](https://realalpha.app/v/a0sZV0qIbI0/?t=4953) **Sam Newman:** Keep that problem exactly the same, but now change the business context. Now we're sending concert tickets. So you're getting tickets to go see Tay-Tay, right?

[1:22:42](https://realalpha.app/v/a0sZV0qIbI0/?t=4962) You're going to go see Taylor Swift. And we're not sure if you've got the Taylor Swift ticket or not because our link to that system is down. But those Taylor Swift tickets are yours. You're taking your kids, taking your wife. It's all going to be awesome. We're going to Portugal. We're going to go see Taylor Swift. It's going to be amazing. And then we email you. Sorry. We don't actually have those tickets. Now, the problem with that is, firstly, the devastation in your organization is a bit different. They can't backorder a ticket. Yep. and so in that situation it's like the impact to the customer is so much greater and then they book the flight and well you might book the flight so what they do is they make a different decision so in that situation if they don't know if they got the ticket they don't sell a ticket I'm not sure if you cover it in the book but this is the fail open versus fail close right when you have an error or you're unsure are you going to go through or not and as you say this can be a decision the same problem two companies can take a decision a company years down the road could take a decision Uber had this classic example of when we weren't sure if the payment went through.

[1:23:39](https://realalpha.app/v/a0sZV0qIbI0/?t=5019) Do we allow the ride to continue or not? And early in the company's years, we always failed open. Yeah, just have the ride. We might have the money and if not, we'll deal with it. As the company starts to go for profitability, we fail closed. We're not sure we have the money. If the charge went through, you're not going to get the ride. And again, same company, different focus. And if you're a developer, you needed to pay attention to what is important right now for the business. It was growth initially, and it's okay if we lose money. And then now it's, I don't know, unit economics, profitability.

[1:24:10](https://realalpha.app/v/a0sZV0qIbI0/?t=5050) But also that open close versus open, that's a failed close versus a failed open discussion isn't one size fits all for the whole system. It's on a feature by feature basis. And even then, you could say this taxi ride is 10 euros, or it's a thousand euros. You can make different decisions. Now, if you approach this from a mathematical and from a computer science viewpoint, we just talked about cap theory. that was a conversation about cap theory right so in the chapter i talk about here's cap here's which is an extension of cap i explain what those models are because when you get deep You'll hear about them. But fundamentally, that's what this is about, right? When you have a partition, that's what the P in CAP really defines. I can't talk to one part of my system. Remember, it's rule number two. But I can't talk to another part of my system. What do I do? And all you need to know as a developer, I can't talk to that. What do I do? Sometimes we can make technical decisions. I'll try again. I hope I don't bring my systems down for the retry storm, but I'll try again. If that doesn't work, what do I do?

[1:25:13](https://realalpha.app/v/a0sZV0qIbI0/?t=5113) Well, actually, often the answer is, yeah, sure, you can look at CAP and Pac-Helk or whatever else, but go have a conversation with a product owner. What should we do? The resolution of that often ends up being a decision about are we trading off consistency versus availability in Pac-Helk or harvest and yield if you're going into that version of Brewer's Conjecture. But don't worry about that. That's in the book. That's why it's a later chapter. That's chapter like 12, I think, or 11. Don't start there. Start with having the conversation. Rule number two, I can't talk to this part of the system right now.

[1:25:41](https://realalpha.app/v/a0sZV0qIbI0/?t=5141) What should we do? and that starts with having the chat that starts having the chat when we're talking about resilience you talk about the dimensions to think about resilience what what are these dimensions i start in the first chapter way coming back to that paper by david woods i mentioned that was impenetrable to me at the start and he comes up with four concepts for resilience engineering and i like the four concepts he comes up because he helps us think broadly right so it starts off with robustness this is where we can basically i think in his words absorb known perturbation so we model a system and something goes wrong and we can kind of just deal with it in a way that none cares about doesn't even know so a very simple example would be uh in kubernetes a pod fails and kubernetes means a replacement now the pod failing that's a perturbation it's gone a bit wrong but we dealt with it great so that's the start and the thing is most engineers i speak to they focus entirely on this.

[1:26:46](https://realalpha.app/v/a0sZV0qIbI0/?t=5206) Don't look at the other three. They focus entirely on this.

[1:26:49](https://realalpha.app/v/a0sZV0qIbI0/?t=5209) **Sam Newman:** One of the really nasty things about robustness is the things we often do to make our systems more robust in turn increases the complexity of our system,

[1:26:57](https://realalpha.app/v/a0sZV0qIbI0/?t=5217) which in turn increases the surface area for new types of failure. I bring Kubernetes in to deal with the failure of a container. Now I've got Kubernetes and that becomes... And that's not solvable, by the way. That's just something to be aware of. That is also why sometimes people don't go multi-region or multi-cloud because it's increasing the surface of other failure types. So that's number one, it's robustness, right? Can we just do one of those things? And for things to be robust, we have to know about them ahead of time. This is predictable, we deal with it. Then there's rebound, which is when something does happen and goes wrong, how quickly can we recover?

[1:27:29](https://realalpha.app/v/a0sZV0qIbI0/?t=5249) So this is typically the time to recovery, well, time to detection and time to recovery. Yeah, and there's different ways of measuring that. And I talk about in the DR chapter, I talk about, you know, data loss. Disaster recovery. Exactly, yeah. but that's like how quickly can we get back up and running so we've gone into a degraded functionality how quickly can we get up and running so that's that's thinking about the rebound and again for that you have to be very humble as a developer because the robustness is the system will never fail it's like but what if we got it wrong okay well we have to admit things go outside and then i guess for recovery on on how you can recover this is where i mean if you want to do it well teams that are serious about this they they do uh simulations of the system going down this is where Netflix is a very famous chaos monkey comes in where it goes and shuts off parts of the system to like test this live and there's drills that are being done on how we can how our on-call process works how our decision making etc etc this is actually a hard problem and then you did it once that's not enough because you need to do it regularly because the system keeps changing

[1:28:25](https://realalpha.app/v/a0sZV0qIbI0/?t=5305) I'd like to give a shout out to Uptime Labs who are basically partly here in London they do excellent instant training that you can do online in a web browser it's fantastic we'll add them to the show notes below they're nice people So you've got that recovery process, like how do we get up and running? And I think kind of techies a lot with me. And then we go into the next two, which the third one is graceful extensibility. And so graceful... Again, it's a slightly weird name, but it's basically dealing with surprise. When we make our system robust, we're dealing with the known problems. What about things we don't expect? If we don't expect it, this is now not about computers, it's about humans. This is why distributed systems are fundamentally associated with technical systems, people and technology are working together. We couldn't expect the rabbits. How do we deal with the rabbits? How do we deal with the farm and the data center? It turns out badly is the answer.

[1:29:14](https://realalpha.app/v/a0sZV0qIbI0/?t=5354) But if you're in a corporate environment, which is very command and control, quite hierarchical, but you've got a very narrow job description, you're often constrained in what you're able to do. Those organizations tend to deal with surprise badly because the corporate structure is structured around the known. And so often structurally, you'll find that difficult. You mentioned drills earlier. Drills are a great way of helping with surprise. Coming in and having people often from outside saying, this has happened, how will you deal with it? Google had a thing, I don't know if they still do it, SREs would pop around, they'd do a thing called the wheel of misfortune. They had a physical wheel. Today, your system has suffered a spin the wheel. DNS poisoning attacked by a state, insert name of rogue state here. Here's what's happening. How do you deal with it? That is all about people and experiences and trying new things and constantly pushing yourselves. I guess learning also from others. I remember this like very famous outage happened a few years ago at meta where their dns system through bgp it just all went down whatsapp meta everything to fix this because they they pushed out an update to their

[1:30:19](https://realalpha.app/v/a0sZV0qIbI0/?t=5419) bgp table which is inside dns to their servers now to fix this they needed to get access to the computer that physically to get access for whatever because they couldn't reach it remotely so they need to go into the building now in going to the building they have to go to a door that protected this system which was running on their own domain which was down so they had to break physically into but but again this is the thing where they share the details which was great because now everyone else could think about like do we have any of our physical security for example tied to our own domain because if you have it you want to change that learning from what meta have learned about and this learn takes us from that grace of extensibility which is dealing with surprise that's like sort of almost in the moment are we ready to deal this by into the fourth one which is sustained adaptability which is how can we learn from what's happened not just the learning so do we have the environment in which we can learn and share and grow but then also adapt the system based on that learning and it's called sustained adaptability because it is that is a completely continual process that's not just today that's not just when you have an incident

[1:31:24](https://realalpha.app/v/a0sZV0qIbI0/?t=5484) that's when you don't have an incident what are we doing to learn and i think your point you made there was excellent which is i like reading other people's instant reports there's a little bit schadenfreude with companies i don't like but there's also a little bit of it is like they've learned something can i learn from them and do something that resolves my system so when you don't have an instant read other people instant reports says the place called the void uh it hasn't been updated for a bit there's like hundreds and hundreds of instant report services worth going through so that idea of sustained adaptability is all about us adapting and changing over longer timescales for those last two things sustain that's releasing greater extensibility this all comes down to people and culture like having proper environment psychological safety is just absolutely required if you can't raise issues if you can't challenge in a safe way you will deal with surprise badly because things won't get raised and you won't learn because things will be hidden yeah and so that all comes down to behavior stuff and so the last three chapters of the book we focus on that is looking at some of the people and the social

[1:32:26](https://realalpha.app/v/a0sZV0qIbI0/?t=5546) aspects of that so i've got like 14 13 chapters or 12 chapters sorry about the other technical and then the last three chapters are all about that side of things so like what can we do to make sure that we have that environment of psychological safety because without it you can't actually be resilient that's just pretty Because so far, throughout this whole conversation, we talked about building resilient systems. We talked a lot about people, about how to think about resiliency. One thing that we didn't really talk about just passively is AI. Even though this book is coming out now, and I know it has a section on AI as well, but it's just interesting to reflect that even though AI is changing how we're building software, it seems like some of these ground truths of how to operate reliable software are a little bit just outside of this realm.

[1:33:02](https://realalpha.app/v/a0sZV0qIbI0/?t=5582) right well i mean or is it no it's not i mean firstly there's some stuff there's some ai stuff in there that can help um i i detail quite a few examples where around sort of correlation analysis and you know help support around posting there's some instant.io doing some amazing stuff in this area this is saying we can use tools to do a lot bits but really there's more fundamental kind of things here and the first thing is the macro and the micro the micro level there's some useful stuff we can do here um and i talk about that but the macro level is that that none of it stacks up financially right so if you're like taking a longer view about resilience if i'm building my products based on a market sector that is fundamentally flawed these companies don't have a viable path to sustainability when you say which companies are we talking about open ai and anthropic and the hypervisors right conservative analysis by the economists are showing that they

[1:33:54](https://realalpha.app/v/a0sZV0qIbI0/?t=5634) **Sam Newman:** They need to be generating $2.6 trillion in revenue to justify their capex expenditure by 2030. The entire software market is $1.4 trillion.

[1:34:03](https://realalpha.app/v/a0sZV0qIbI0/?t=5643) So macro level, I don't know how that gets sorted. I'm not smart enough. I also don't have any shares of those companies. But, you know, that's a separate conversation. I can't solve that. What I can start thinking about is, okay, if that's what I'm operating in, how do I deal with that? I can't deal with all that. What I can do if I'm taking a view to resiliency is being very careful about how I use AI. For example, you know, if I'm thinking taking a longer view, being more flexible about model choices, that's going to help me because I've got the opportunity to use open-weight models from different vendors.

[1:34:33](https://realalpha.app/v/a0sZV0qIbI0/?t=5673) I mean, it's even just basic things like OpenAI and Anthropic are pretty terrible when it comes to availability of their core models from their services, which is why everyone I know also will use like, they'll use Google or Amazon or Microsoft as either their primary place they go to those models or their fallbacks, they have better uptimes and things. so there's all that stuff we've got to deal with at that level there's also the conversation about non-determinism and charity pulled me up on this a bit and i said the thing is that you know we're going from deterministic software to non-determinism you know that's a challenge for us we don't know how things work and then she said to me our distributed systems were never deterministic and now they're really not deterministic and of course she's right because when we take our distributed system and we add the people in beyond the rabbits right and the fires and the people we always had a degree of non-determinism we're just amping that up a bit so I think that's a continuation so for me I think it's a confusing landscape it's not good or bad I think at the micro level there's some really great things that we can do when you say micro level

[1:35:32](https://realalpha.app/v/a0sZV0qIbI0/?t=5732) that's the tactical things that we can do, right? I think really what I mean by that is I'm taking the macroeconomic policy situation out of it I'm saying that as a developer there's things that we can make use of there's some good stuff in there that we can make use of but I also think there's some hedging we need to do longer term if you're building AI into your product there's some simple hedging things so being multi-vendor being multi-model for example breaking rather than having a single agent breaking that down into more workflow models therefore you can take bits of your workflow and realize actually this can now be swapped out for a bit of deterministic code that i write that could run more efficiently i think these are sensible things that you can do we can't fix this we can at least deal with our world and i think there's some sensible things that we can do in that space what are the things that we know that we do not know about ai i think the tech world in general is quite naive about ai and fundamentally misunderstands what an LLM is let's be real like why did the LLM and delete my database.

[1:36:33](https://realalpha.app/v/a0sZV0qIbI0/?t=5793) Well, because it has no concept of causality. That's what it comes down to. It has no concept of causality. There's a glass here. If I push that glass onto the floor, you'll be working out as a carpet down there. If I ask you what's going to happen, you'll say the glass is going to be fine. If I push it onto that floor, you're looking at it saying it's a hard floor, that might break. You're carrying out a bunch of calculations in your head. You've got an idea about the physical properties of the universe. You've got a sense if I push the glass, this is going to happen. LLMs don't do any of that.

[1:37:02](https://realalpha.app/v/a0sZV0qIbI0/?t=5822) They have no concept that if I do A, B happens. Well, there's a push for world models, but these LLMs are not world models. They're not world models. And world models have been around for a long time. They arguably predate LLMs. They can do stuff like that. So they could make decisions like if you had the appropriate model and the appropriate inputs, they can at least get to the point of, if I do X, then Y happens, and I've been told not to do Y. This is why all the guardrails around LLMs are really not long-term going to be the right solution. And so I think we expect LLMs to do more than they can actually do because they seem so smart.

[1:37:36](https://realalpha.app/v/a0sZV0qIbI0/?t=5856) And so I think that's the problem and that leads us to overestimate their capabilities a bit too much, I think. Or maybe over rely on them without knowing and we might have some incidents later. Absolutely. And I think we're knowing where and when to kind of to use those things. And I think what we don't know right now is where should I be having, and again, this is wider, where should I have the LLM do it and where should I just write some deterministic code there's a lot to be said for just having your agent call a script and you know that script works rather than having it implement the script in its magical brain for you well there's something to be said that it seems both labs both leading labs Antropic and OpenAI have realized that coding is so important so oftentimes when you ask the LLM to do something it will start to generate code because it writes a deterministic program because that part will be deterministic and it's very interesting when you ask it it will often just pump out a Python or TypeScript or whatever especially when it has to do with compare this or that and they have trained these models to like default to coding I'm not sure how this came but it seems to be working

[1:38:48](https://realalpha.app/v/a0sZV0qIbI0/?t=5928) to some extent. It's also because it's very tractable, right? They are there to generate plausible code they're there to generate plausible words right? And in the context of code they've generated some plausible code that we can now validate does it execute and so that's a really nice tractable aspect of it and there are some places where it works really really well but there are other areas where it's terrible like when I write my book I use very little AI at all Well you didn't use it for the writing you used it for research I used it for the research but in the context of the research I used notebook.lm basically but in that context it's plausible but then I just go and click all the links it gives me.

[1:39:28](https://realalpha.app/v/a0sZV0qIbI0/?t=5968) And I say, was that there or not? I am checking the work. It's done way more work than I could have done going through all those papers. And God knows there's only so many NIST papers you can read through, right? But in that context, I feel completely fine and able to do that. In other settings, you're getting now this problem called cognitive surrender, which is where you're using AI to write documents that you're never going to read. That's not really around a problem with the LLM technology. That's the problem with us. Can we talk about this cognitive surrender and cognitive depth? Yeah, cognitive depth is a kind of term that's been around for a while.

[1:40:08](https://realalpha.app/v/a0sZV0qIbI0/?t=6008) And that sort of explains the erosion in our ability to think critically and to reason that can occur when we're using AI tools. And there's been a bunch of research into this that's shown, there's been some studies that's shown that people's ability to think critically is impacted the more they use chatbots and things. And I think we've sort of seen other examples. that margaret and story's got a great um article about this and she cited some some of the research around it as well and that sort of explaining that i mean her her thing is you know she's talking we talk about technical debt building up We have to be careful that our use of AI needs that cognitive debt. We need to have a shared mental model of what this system is supposed to do, thinking about it narrowly through the lens of a program that we're building. And if our use of AI, as an example, we all go off in different directions, that shared review breaks down, that becomes a debt cognitively. Cognitive surrender is a different thing, which is like, oh, yeah, it's fine. It's basically LGTM, right?

[1:41:08](https://realalpha.app/v/a0sZV0qIbI0/?t=6068) yeah but for whatever the ai tells me yeah lgtm was typical looks good to me approving large pull requests where you just couldn't be bothered or you try to look at it and for whatever reason you didn't want to go through or it came from someone who you trusted i worked in the google tool team on all that stuff right and so lgtm was literally a song with pattern match on and takes that as an approval yeah so you saw lgtm that person's approved right and it was just that was where i think that may even have been where the acronym originally came from i'm not sure i I think it came from Google, yeah.

[1:41:37](https://realalpha.app/v/a0sZV0qIbI0/?t=6097) Yeah, but it is this idea that, and it's become shorthand for, I didn't really look at it. Yeah. And I think that's, that's that cognitive surrender thing is coming out in lots of ways. You know, we're getting AI to write documents and no one's going to read. And we've got AI that's reading documents that weren't written by other people. And so the cognitive surrender piece is really that the humans, it comes back to the human being in the loop. There's very subtle differences in those workflows and to the kinds of differences it changes. Like there's a big difference. Choredoctro talks about it.

[1:42:11](https://realalpha.app/v/a0sZV0qIbI0/?t=6131) It's a big difference. Like if you're, say, a cancer, an oncologist, or a cancer specialist, there's a big difference to you as an oncologist working and an LLM doing sort of detection of some of the scans that you're looking at going, oh, you should look over there, by the way, you might have missed that. That's actually quite useful, right? Versus the LLM-powered AI going, here's all the scans I've looked through. Here's the ones I need you to sign off. Right, the last one, the second one, right, takes the expert out of the loop and makes them an approver. And often in that context, they've got rid of a bunch of oncologists.

[1:42:42](https://realalpha.app/v/a0sZV0qIbI0/?t=6162) You've got one person in the funnel that's going to lead into issues, right? The other model is we are making people better. I think that's to come back to the original idea of AI or some of the pitch, right, was it was going to free us from drudgery. Just like the Industrial Revolution was going to free us from drudgery. But like, it would elevate us. We'd have less toil. We can focus more on critical thinking and smarts. And so much of our current use of AI is not freeing us up from critical thinking it's causing more context switching it's causing less time for thinking people are working longer hours we've got studies that show this now that's not necessarily ai's fault it's just how we're using it it's like we need to readdress that a little bit can we talk about complexity uh and ai maybe adding it i'm going to quote you from about it from a few months back you wrote i worry ai could just become an exercise in doubling down on current complexity rather than stripping things back to simplify, at least in the platform space.

[1:43:39](https://realalpha.app/v/a0sZV0qIbI0/?t=6219) Yeah, I can't remember the exact context in which we had that conversation. But I mean, the platform space was, I mean, the platform space is kind of interesting, right? Because that was an attempt to make things simpler for developers because Kubernetes became popular and it's not developer friendly. That's not what it's designed for, right? But most developers never have to touch it. No. I mean, well, if you have a platform, if you don't have a platform, yeah, yeah. There's a platform team's problem, right? And that's why they get paid that will they get paid. And so I think there was this idea that I was sort of hoping that there would be a bit of a complexity collapse around that space.

[1:44:10](https://realalpha.app/v/a0sZV0qIbI0/?t=6250) I had this hope for things like WSGI, for example, simplifying down those programming models a little bit. And I think there was starting to be a bit of a conversation starting to be had about some of that stuff going on. What then happens, of course, is AI has come out and everyone's like, I've got to AI all the things. and so rather than thinking about what we need and trying to strip that complexity back we've now just got another piece that requires us to still have all the old complexity of adding new complexity on top and somebody's got to look after all that stuff yeah but I think it goes back to a little bit of like we seem have more work with ai and probably it doesn't help that it can add more complexity especially when we're not being clear of what we want we're not being critical of the output when we have cognitive depth or cognitive surrender especially not with cognitive center you know just right so it these things might be amplifying the fact that it's just more work more complexity right yeah and i think there's also that connection through to what the ai is doing comes full circle a little bit which is the idea of potentially not looking at the code isn't to say that you don't care about what the system is that you're building. Here's to say that you've

[1:45:11](https://realalpha.app/v/a0sZV0qIbI0/?t=6311) got a better way of understanding what you're building. So one of the concerns is if I'm using AI to create code, this is going to create awful loads of debt and a complicated system. No one's going to understand. Well, we can't let that happen. We still need to remain connected to the system that we're building, which is what I'm a big fan of like modularizing system. Whether or not you put those modules in different computers, I don't actually care. Getting AI to work within the modules having the humans think carefully about what those modules are and the connections between them let the ai go hog wild inside those boundaries that are easy to change the gaps between them that's where the human beings spends to think about the mental mold how things fits and slots together um that feels a very sane way for us to balance our time and our energies appropriately so do i understand correctly that you're saying that it's probably sensible approach is have the architecture in your head know how your system works know how the boxes work know where there's ai inside it maybe it's generating code maybe it's running your incidence response in in isolated ways and then spend your time talking with other people

[1:46:15](https://realalpha.app/v/a0sZV0qIbI0/?t=6375) in the business on your team with your customers because you're you know as you said systems like software is is people's ideas connected and you have things in in your head or you write it down But now you're using it as an AI as a tool to enable you to maybe take on larger chunks of the business and maybe make better decisions because maybe you have more time to, as an engineer, understand more on the business, on what is working, what is important, those kind of things. Yeah. And also to make the structure on the model system a bit more explicit as well. I mean, that's one thing a good modular structure does.

[1:46:49](https://realalpha.app/v/a0sZV0qIbI0/?t=6409) I mean, this is why Shopify have been so successful keeping their thing as a monolith, right? because they spend a lot of time building their monolithic application as a modular domain-driven architecture, right? Because it makes the structure easier to understand. You can zoom out and see how those things fit together. But also in the short term, while we're having these debates about are we going full software factory or not, we don't have to make a one-size-fits-all approach. We can say, look, this is our architecture, be it a modular monolithic or a microservice architecture, it doesn't really matter.

[1:47:18](https://realalpha.app/v/a0sZV0qIbI0/?t=6438) **Sam Newman:** And over here, this area here is where we're trying a full software factory approach, where we don't look at the code anymore, but we specify the interface.

[1:47:25](https://realalpha.app/v/a0sZV0qIbI0/?t=6445) We have verification around that. We know what good looks like for that module, right? We've got functional tests, tests that look at, say, some of the operational requirements as well. These areas over here, we're still grappling. These are really key and really important to us. We're not ready to give up on these yet because we don't have the trust level yet. We don't want to take that risk just yet. And so over here, we're going to work with the AI more of a collaborative way while we work together. and we're still going to be intimately involved with the code because we're not ready to make that step here.

[1:47:54](https://realalpha.app/v/a0sZV0qIbI0/?t=6474) But if we approach our whole system with one big black box, then we're forced into making one or either decision. I don't think that's healthy. Do I understand that you're saying that you think that the software factory, the dark factory, you're giving it a spec or the AI either building it or operating it, that you see that as viable? There are some companies I know that are already all in on this. Not everyone should be doing it whatsoever. I think if that is our future, if that is our future, and I think it's a lot of ifs there. The question is about how you go about adopting and trying. So what I'm trying to do is find ways in which we can lower the barrier to entry to try these ideas out in a safe way.

[1:48:29](https://realalpha.app/v/a0sZV0qIbI0/?t=6509) And like low-risk environments and maybe simpler domains, those kind of things, right? But also like a lot of dark factories don't create finished products, like real world. Beyond the fact that real-world dark factories, there aren't many of them, most of them create components. They don't create the finished product. So in the same way, if you think about a module being a piece of the overarching system, well, let's have a factory around these bits here. And actually looking at it, like if we had to rewrite that from scratch, it might take us, like with the collaborative way with AI, it might take us a few weeks to have to rewrite that if we had to.

[1:49:04](https://realalpha.app/v/a0sZV0qIbI0/?t=6544) So actually we're quite relaxed about leaving that to go as is. and it's been working fine. It's a module around which you've got great test coverage already, for example, where it's not on the critical path from a latency point of view, or it's a service where we've got really good observability data and really well-defined SLOs and we've got good steady state, where we can start running it as a factory now and seeing what's happening in production. We can have a look at the SLOs. We maybe add some special SLOs around it. I'm hearing correctly that you're saying that as a professional, as someone who wants to be up to date with the new techniques that we can use, it's probably, if you have the opportunity to start to build a software factory, a somewhat autonomous place in a component, in something low risk, it's probably worth trying it out to see how it works, to see what you learn, to see if it even works or where it breaks down.

[1:49:52](https://realalpha.app/v/a0sZV0qIbI0/?t=6592) But do it in a way where you're minimizing the last radius. It's a little bit like when, you know, when microservices came out, the concept, you didn't start by moving your biggest thing, you started to build a small service that didn't really matter all that much. And you were okay to learn from it when it goes down and it wasn't on the half path for the business. Yeah, I think the thing to start off with is getting your head around spec. So looking into spectrum development, whether that's Kiro or TESL or SpecKit, whatever that is, I mean, they're all slightly different. Have a look at Brigitte's article on that as a good on-ramp to get ahead of it.

[1:50:22](https://realalpha.app/v/a0sZV0qIbI0/?t=6622) Start off by playing around with that because that's the stepping stone. That's like, you have to define what good looks like as an input to your factory. Yeah. Start with a spec. Good look input and also for the output. Yes. And then it's like, how are you verify? How are you going to go about with verifying the output from the factory. Have a think about that. And, you know, like, not just in terms of the kind of normal sort of behavioral aspects of it, but I agree with Kevin Haney on this. He said he hates non-functional requirements because if a functional, if something is non-functional, it means it doesn't work.

[1:50:52](https://realalpha.app/v/a0sZV0qIbI0/?t=6652) So he breaks the world down into like development requirements, operational requirements, and sort of business requirements. So I think it's a nice way of doing that. So along those three axes, how do I verify that the software being created by this module is it matches my developer requirements, so for, say, maintainability. My operational requirements, latency, uptime. And my business requirement, is it working? Feature's working. So as long as you've got a way of validating your software around that, and if you don't know what the good looks like for those three things, guess what? This isn't for you.

[1:51:23](https://realalpha.app/v/a0sZV0qIbI0/?t=6683) But you can still do specs, by the way. But you can't do a factory. But you can do specs, and that's, you're edging and your way there. And I think it might not work. There may well be some blind alleys. This could be model-driven development all over again, which we do not have time to get into because I get very angry about it. But it could be that. But I have a hope it might actually work this time, unlike MDM. And then as closing, I think a lot of what we talked about is it's important to hold the architecture in your head, to think about the architecture, to think how to modularize now for engineers who want to get better at this kind of high-level thinking, strategic thinking, architectural thinking, outside of reading your book, which I think brings a lot of really good ideas on architecture as well, and not just really insistent.

[1:52:00](https://realalpha.app/v/a0sZV0qIbI0/?t=6720) But outside of that, what would your recommendation be for a tech professional, for an engineer? I'd like to get better at architecting systems to know what good looks like. I think there's a few books I can point people at. I think the Software Architecture Fundamentals by Neil Ford and Mark Richards is a good read. Just to be clear, they're friends of mine so i'm not unbiased in recommending it i would say around the modularity vlad kolonov's book on balanced coupling is fantastic I mean, his book on DDD is also very good. But that balance coupling book is really great. He's also developed some skills in Claw to take some of those ideas.

[1:52:36](https://realalpha.app/v/a0sZV0qIbI0/?t=6756) So definitely, definitely take a look at those. And I think if you're looking at things architecture and you're thinking in terms of modules, for me, I don't agree with everything in Mark and Neil's book. There's lots of great stuff in there. But for me, it actually all starts, I sort of mentioned earlier that writing the second mission of building microservices was really all about smuggling in, getting people thinking about this thing called information hiding. It's a very hard idea for the 1970s. It still comes back there to me. Modules are still the whole thing for me. So I would read Vlad's book.

[1:53:00](https://realalpha.app/v/a0sZV0qIbI0/?t=6780) And if you want to go read the original Parnas papers from 1971, 1972, they're still worth reading. But those would be good jumping off points, I would say. You can still, I think the nice thing about thinking in terms of modules is even within an existing code base, you can start to modularize it in some small ways. You can start to think about boundaries, you can think about clear separation, about using encapsulation as a way of information hiding. And I guess it's fair to say, like, look, if you have an idea on how you can make your existing code is a bit more modular, you have zero excuse not to do it.

[1:53:31](https://realalpha.app/v/a0sZV0qIbI0/?t=6811) I mean, we don't trust agents fully, but this is a textbook example of like, if you can say, here's my goal, refactor this, like, if it would have taken by hand X amount of time, it will be faster. So you should be empowered to at least experiment with these, right? Especially if you've got a decent test suite. And if not, start with that. To start with that, if you've got a statically-type language, you don't even need to, just a good old-fashioned IDE does an amazing job, right? Dynamically-type language now don't have the excuse, especially if it's a modern one that's well understood by the NLM.

[1:54:00](https://realalpha.app/v/a0sZV0qIbI0/?t=6840) So if you're using, you know, Python or Ruby, it's so much better now than it used to be for refraction as code bases. Absolutely. You need to get a test suite in around that. But yeah, you can start modularizing, and that's about building. And that's also a little bit, coming back again, to taking, we don't want the architecture only in your head, right? We want the code to sort of represent that mental model because we communicate through the code and maybe in the future we'll be communicating through the specs. And when you make those things more explicit, then I think that helps everyone stay on the same page.

[1:54:33](https://realalpha.app/v/a0sZV0qIbI0/?t=6873) There's George Fairbanks wrote a book, I've forgotten the name of the book now, but in it he has a pattern called an architecturally evident coding style and that we should code in such a way that it clearly communicates the architecture of the system. And I think our programming languages are quite bad at having a good concept of modules in general. So I think we have to go a bit above and beyond ourselves. But we could do more to make the architecture of our systems that little bit more explicit. This is also why I spend time production, because especially if your modular structure ends up being a process structure, in other words, it's process boundaries, I can go look at the networks to find out my architecture.

[1:55:10](https://realalpha.app/v/a0sZV0qIbI0/?t=6910) I shouldn't have to, but at least, you know, I know production is truth. It's like football is life, production is truth. So where can people get your book? You can go and order it now. If you can, go and buy it from a local bookshop. That's always a great idea. It's also going to be available for people on the O'Reilly platform in sort of digital form. So you can go and read it as part. If you're a subscriber at O'Reilly, you can get it there as well. But lots of people love having the physical copy. And we have these in the show notes below. So check them out to get the book directly. And also, you've been doing some videos, right?

[1:55:36](https://realalpha.app/v/a0sZV0qIbI0/?t=6936) Yeah, well, I've been doing some stuff on Dave Farley's Modern Software Engineering channel. it's a kind of a good excuse to do some sort of semi-ranty you know monologues to video and have some fun chats so yeah go for the modern software engineering channel on youtube and you can find videos from me and dave farley and kevin hennie's there we've got stuff from kent trisha g emily borch dan north is there as well i'm pretty sure i've forgotten somebody else there's almost a couple of people there as well but we try and put videos out once a week and it's a bit of fun place And we're also looking at that one.

[1:56:08](https://realalpha.app/v/a0sZV0qIbI0/?t=6968) Yeah. And if people would want to work with you, where can they find you? How can they find you? What kind of stuff can they get help from you for? I do like internal talks with people, like internal events. I do like customized training courses and a whole variety of things around resilient systems and security and microservices. I also do... a lot of consulting for clients, helping them around sort of re-architecting their systems and stuff like that. If you know more about that, actually go to my website, samnewman.io, and you can contact me there. You can also find me on LinkedIn. But if you come straight to the website, use email.

[1:56:39](https://realalpha.app/v/a0sZV0qIbI0/?t=6999) I'm sort of a bit old-fashioned like that, and I work with clients all over the world. So if I'm able to help, yeah, head over to samnewman.io. My contact details are there. Well, Sam, thanks again. This was great. Thank you. Thanks very much to Sam for this conversation. I really like Sam's three rules of distributed systems. One, it takes time. Two, sometimes the thing you want to talk to isn't there. Three, resource pools are not infinite. Sam said how most of the outages happen because of this last one. Resource pools not being infinite and services are getting saturated. But I was chuckling when he was talking about rabbits doing true networking cables between office buildings.

[1:57:15](https://realalpha.app/v/a0sZV0qIbI0/?t=7035) Then again, a few weeks ago, with thousands of flights stranded on the east coast of the US, it was because workers accidentally cut a telecom cable in New Jersey used by the FAA. Another food for thought from Sam is how failure should be handled differently depending on the type of business. An e-commerce shop might decide to show you the item when the inventory service is down. Worst case, after you order and pay, they just refund you because we're like, oh, we don't have the item. Basically, failing open is fine in this case. But on a concert ticketing website, you don't want to sell a ticket that might or might not be there. And so failing close is the right call to make. Because again, as we discussed in the episode, if you sell the ticket, people might book flights, they might get upset, you might lose them as customers.

[1:57:55](https://realalpha.app/v/a0sZV0qIbI0/?t=7075) Finally, I appreciated how level-headed, perhaps even cautious Sam is about AI. He's got no doubts that AI is very useful at the micro level, basically tactical at things that we can already improve. But he is worried about the economics of the model providers. His suggestion is pretty pragmatic. Hedge your vendors and your models. Be multi-vendor and multi-tool and wherever you can and swap non-deterministic AI agent workflows to deterministic ones. Basically, have LLMs generate deterministic code, which I find very, very refreshing thinking. Check the show notes below for the story about scaling Uber in the early days with Uber's first CTO, Twan Palm, that we discussed, and it's an awesome story.

[1:58:33](https://realalpha.app/v/a0sZV0qIbI0/?t=7113) And for more, the pragmatic engineering deep ties on resilient systems. If you enjoyed this show, do subscribe to your favorite podcast player. And thank you very much if you recommend the podcast to your friends or your colleagues. Thanks, and I'll see you in the next one.
