Saturation: How Your Software Will Fail at Scale
Comments
Transcript
Machine-transcribed by YouTube. Expect errors in names, commands and version numbers.
So before I I get started, I need to make a disclaimer here that uh even though I work for Airbnb, this is uh just my opinion. These are my views. These are uh not not the views of my employer. Um all right. Uh so uh I suspect given
the crowd here, most people recognize this uh person. Uh if you don't, that's Leslie Lamport. Uh Turing award-winning computer scientist. uh you've most likely heard of them either because of TLA plus which is mentioned a few times which he developed or because of the Paxos distributed consensus algorithm if you're in distributed systems or latte if you've done pretty mathematics or um I think Philc's concurrent garbage collection is based on work by Jstra and Lamport um so very famous guy uh but what I want to talk about today with him is uh this talk he gave back in 2003 in
uh I don't know how to pronounce that Kyle Keel Germany at uh Christian Alrech University. uh and in this talk uh this is called the future of computing logic or biology and he basically saw a uh a
path forward for how we think about software systems right uh and so one path which she called logic it's really mathematics I'm going to use logic and mathematics interchangeably uh and so he says one way you can think about uh systems is you can think about them mathematically describe them mathematically so for example here's a way to describe the simple system mathematically imagine like a one-dimensional string that's like fixed at two locations, right? Minus 2, x= minus2, xals 2. Um, you start out by
sort of stretching it out into some shape. Here I just picked hyperbolic cosine, right? Uh, so it's stretched out like that initially. That's how it starts. And then there's some uh mathematical description of how the state of that string uh will change over time. Right? This is uh the one-dimensional wave equation. And if you have this uh mathematical description of your system, then you can reason about how that des how that system is going to change over time.
Uh and I think it's there's it's no coincidence that if you look at the structure of a TA plus specification or that was the the specification language that Lampport built, uh it looks kind of similar to the way you would describe a system with differential equations, right? um you specify your initial conditions. Conventionally you call that in it. It's a predicate that says the what are the allowed values of your state variables at the beginning. Uh and then you you specify another predicate which is called an action in TA+ which tells you how the systems state variables evolve over time. Right? And and that's how you describe systems in TA+.
All right. The other approach uh to thinking about systems is the biological approach to think about systems the way we think about biological systems which are extraordinarily complex systems uh which we humans really are not capable of understanding. Right? Uh and so we can understand aspects of biological systems. And here I I have a picture of uh this is a picture well really a drawing of the cellular structure of cork that Robert Hook did way back in the the 1600s. Right? Okay, so this this gives us some aspect of a biological system, but really this is nothing close to the you know mathematical description of a system.
And so here's what Lamport said uh during this talk. Uh he said when people who can't think logically design large systems, those systems become incomprehensible and we start thinking of them as biological systems. And since biological systems are too complex to understand, it seems perfectly natural that computer programs should be too complex to understand. We should not accept this. This means all of us computer professionals as well as those of us who just use computers. If we don't, then the future of computing will belong to biology, not logic. We will continue having to use computer programs that we don't understand and trying to coax them to do what we want. Instead of a sensible world of computing, we will live in a world of homeopathy and faith healing.
It's pretty harsh. Uh well uh so
unfortunately for uh Lesie Lamport uh I would say that uh the path uh we took is the biological path. I I think his his fears have come to pass and this is the way we deal with uh software today. Right. So so I'm an S sur. Uh anyone else an SR in the room? Ah, yeah, we have a few. Cool. Uh, excellent. Uh, and one of the things I do is incident response, right? So, I'm on the primary on call rotation when there's a high severity incident. Uh, I I get called in to help deal with that. Uh, and that means I spend a lot of time uh looking at software that breaks. Uh, and also I I just like I'm really into that as as I was alluding to. So, like in my spare time, I also spend time looking at how software breaks. Uh, I spend a lot of time thinking about this. Uh but really it's not software that breaks, right?
Like if you think of software like a computer program like source code, it doesn't do anything. It's an inert uh artifact, right? It's only like when it's running inside of a you know on hardware in a system and and that's sort of the things that are break, right? Like like a printout doesn't break, but it's only the system that's executing uh that break. So it's really systems that that I care about. uh and in particular the kinds of systems that we build today um these are complex adaptive systems and and I want you to think of them that way um because that's what biological systems are and because of that because the the systems that we build are complex adaptive systems they actually fail in ways that are similar to how biological systems fail. So it's not just like we get homeopathy and faith healing from biology. I think biologists would be a little insulted by by that framing of it. Uh but there are other ways we understand biology and we can get insights from that world. So for example your heart um there is a so this is sort of mixing math and biology here. Uh this is the uh Frank Stling law or Frank Stling curve and it describes a relationship between the volume of blood in your artery in your not your arteries your vent uh in your sorry uh your ventricles in your heart right when your heart relaxes when it goes into what's called d uh diastily uh it relaxes and
then blood flows into the ventricles um and that's the ventricular preload on the x- axis uh and then based on the volume of that blood when your heart pumps the volume of blood that gets pumped out um is proportional to that. That's the stroke volume, right? So the if your your heart wants to do more work uh then it will put more blood into those ventricles. And it's sort of there's a linear relationship up until a certain point, right? And then after a certain point, even if more blood is going is flowing into the ventricles in diastilly, you're not getting more work out of your heart, right? Your heart reaches some limit and then it can't do work anymore.
And so like our heart uh everything we
deal with all the systems we work with they have a limit
and when you hit that limit in your system um very bad things can happen sometimes and the term I'm going to use for that for uh when systems get to their limit
um and bad things potentially happen the word I'm going to use is saturation throughout the throughout the course of this talk and the reason I use the term saturation I mean we some people do use it in our industry you will see it sometimes in uh incident writeups you will see it if you follow Brendan Greg who's a performance engineer he will talk about uh diagnosing saturation in terms of performance issues um but the reason I'm using it here is because so I'm a fan of this research field called resilience engineering it's a sub field of safety science and they try to understand across a wide variety of fields like aviation and I know space flight and nuclear power uh all sorts of transportation all the safety world um how will how do systems sort of become resilient to maintain that resilience and they take a lot of inspiration from biological systems which are resilient right you're you're as a as an organism is a are a pretty resilient thing you can deal with a lot and and still keep going um and I'm in particular a fan of David Woods and uh I'm going to talk a lot about sort of the models that he he proposes and one of the things that he talks about a lot um in his work is the idea of saturation and that uh resilience requires managing the risk of saturation because saturation is the kind of thing that takes complex adaptive systems out.
Okay, so here's a dot and I want you to think of this dot as your system.
Now um by system I actually I don't even mean just the software and the the hardware but I mean the entire sociotechnical system uh and by sociote
techchnical I mean not just the software and hardware but I mean the the people that are involved in writing the software and you know validating it and deploying it and operating it as well as all the tools that they have to use to get to do their work right so all the you know deployment tools and test tools and ids and agents these days Right? Those are all part of the sociotechnical system. Now, so imagine your system, this just this dot uh is uh a point in some sort of like higher dimensional space. Okay? And then there's this um envelope around it. It's it's enclosed inside of a region. And Woods calls this region the competence envelope, right? And as long as your system stays within its competence envelope, then things are great. your system is healthy, your users are happy, everything is good.
Now, the problem is that there are stressors that your system is going to experience that are going to move it around inside of that envelope. So, for example, let's say there's a a spike in traffic that you get or maybe there's a uh transient network problem, right? So, there is a spike in traffic, but you're provisioned to handle it, so you're good. Maybe you have a, you know, transient networking issue, but you've got retries, so you're good. uh maybe someone introduces a bug but you actually catch it because you have a tool like antithesis or you know maybe you catch it in staging or you roll back quickly you've got or canaries or something all that stuff is great uh you're within your competence envelope you can deal with those things the problems happen u when your system moves so far uh out moves so far away that it
goes outside its competence envelope and in in Woods's framing that's what saturation is when a system is pushed uh outside of its competence envelope to the boundary of what it can handle. Right? [snorts] So this is sort of a very abstract way of thinking about about systems. It sort of applies across all different domains. But let's get a little more concrete about what saturates in our world and specifically in the world of software rather than in you know heartbeats. So, um, software is sort of this ethereal thing, right? It's mind stuff we talk about, but ultimately it's got to run on some kind of physical hardware, right? Uh, I used to have this sticker on my uh laptop, right? Like the cloud abstracts away a lot of compute stuff for us, but like somewhere probably in Northern Virginia, uh there is a data center where uh that that software is running.
Um, and so one thing that can saturate one physical thing is CPU. And now, you know, we live in a multi-core world, so we, you know, we get multiple cores in our chips. Uh, but if you want to run more tasks than you have cores, well, some of those are going to be stuck waiting in a runnable state until they get a chance to execute, right? And so when that happens, we say the uh the CPU saturates, right? And you're stuck waiting for your task to be able to run. And we saw I think in one of the lightning talks yesterday, someone from Jane Street was talking about how they made a performance change and that ended up leading to CPU saturation. They had 100% CPU and that sucks, right? Having to wait and you'll get timeouts and and your users will not be happy.
Uh since this is kind of a PL audience, I think what's uh most directly in on folks minds is uh memory. We just had a whole talk about memory safety. Uh I'm more concerned in the reliability space about running out of memory. Right. And uh Richard Hips was talking the other day uh about how Malo always uh succeeds in Linux. It will always give you back uh virtual memory. And it was hard for him to uh do testing to see get Malo to fail uh because of that. So he was concerned there. Uh my concern is not there with the Malo always succeeding. My concern is that the services that I care about uh run out of memory and then the the dreaded oom killer comes in and you know the colonel will randomly terminate one of the processes probably the one that took up all the memory. Uh and so you know we have metrics around this because this is not uncommon that we will run out of memory.
Uh garbage collection is kind of an interesting thing. So uh if you use a stop the world garbage collector uh like G1GC which is the the default in Java until pretty recently uh what happens is that garbage collection has this interesting property that it changes uh memory saturation to CPU saturation. So as you your process goes under memory pressure right the um what can happen is you have these stop the world phases where all the application threads get blocked waiting for the GC GC threads to to process through the phase so it can free up memory so that it can keep going right and so you end up with CPU saturation again um there's still uh discs right are still around even SSDs uh they're cheap you know you get a lot of storage these days but they're finite uh and you still see problems s with people, you know, uh, running out of disc space. I've seen it. Uh, one of my favorite examples here is when, uh, there was a service that started throwing errors. The errors were actually harmless. Didn't affect the customers at all, but the errors were logging full Java uh, stack traces and it it generated so much logs uh, that
the logs uh, filled up the device and that that ended up causing a problem for the system. Um, has anyone ever seen this error where actually they had plenty of space left on the device? Yeah. Uh, this was very confusing to me the first time I saw this. So, you can get this error even though you have plenty of storage. And the reason is that there's another limit in file systems uh at least on Linux, at least the ext file system, and that's the number of iodes. There's an iode uh data structure for each file uh you create. And there's a there's a fixed number based on when you create that file system. And if you use up all those iodes, if you create many many many small files, you can very confusingly get that error message. Um, and that is a fun lesson to learn here. I'm actually going to just grab water for a second.
Glad I have this.
All right. Um so that the the one last
physical uh resource I'll talk about uh this is a terrible drawing but I tried uh in uh Excaladra uh of a network card is um network bandwidth right that's the another physical um resource you have and uh it's not as common but you can saturate that right and once you once you run out of once you use up all the bandwidth either on your network interface card itself or in the network links between then you just can't push any more data through at that
So those are the the physical limits, but we also have a ton of virtual limits that we face. And the virtual limits are there for a good reason. Um they're there because they basically act as fail safes, right? In the same way that you have a circuit breaker that will stop the current from flowing in your house um well below what you you know the wire can handle. Um is because if you didn't have that circuit breaker here, you could have a fire, right? like you could uh if there's too much current flows um your house could burn down. So we deliberately engineer systems to fail earlier where the consequence is lower than if we let it go all the way to the physical limit right uh which on the one hand is comforting but on the other hand if you're a victim of you know hitting a virtual limit that's maybe not so comforting.
Um so you will see various places where we use pool pulled resources. Part of that is for performance because like to acquire a new resource like spin up a new thread say or a new connection to a database uh takes some time and it's nice to be able to have sort of a cache of them but also like once that pool runs out if you need another thread to run a task or if you need another you know database connection to make a call to the database you're out of luck. you're stuck waiting uh for the the
resource to be returned to the pool.
Uh bounded cues. Uh so um we can make
cues that are unbounded. It's probably even easier, but you really want to make your cues bounded as much as you can for the the reason where you want to fail safe, right? Um, but if you have a bounded queue and that Q is full and you try to encue something to it, you're either going to be blocked waiting for someone to pull something off that queue or you're going to get an error back depending on the, you know, how that Q is implemented. And uh, these things are are all over the place, right? In distributed systems. There are there are cues in places you probably didn't even know existed. Uh just sort of a random example. If you wanted to know the size of the queue for the incoming TCP connections on your Linux machine, you can use uh CIS control. On this one happened to have 4,96.
And then there are some limits that are not within your system itself, but are
part of another system that you depend on. Right? So you're calling into something else and there's a limit there. Um and that limit is going to impact you. And the the primary example at least that I can think of are rate limits, right? Anyone ever get a 429 error back? Yeah. Uh you have saturated that that uh sort of connection that the amount of requests that you have. You don't know if like you've hit some physical limit, but your service provider has said, "Hey, I'm not going to take any more requests from you. You're hitting me too hard." Right? And I've seen many incidents that involve 429s.
Uh so let's look at some real incidents that have happened and and people have written about publicly, right? Uh the first one happened a few months ago. This happened to Blue Sky. Uh and the the thing they ran out of that saturated was ephemeral ports, right? And I thought this was really interesting. So if you look at the error message on the bottom, right, like uh bind address already in use. Now if I see that my initial assumption is hey I tried to listen on a port like port 443 or something and something else was already listening on that port right and so that's why I'm not able to bind to it but that's not what happened here uh it's not the it's not the server side port so in TCP uh when you make a TCP connection from the from the client to the server the client also needs a port and so uh what happens typically is that the operating system will just randomly assign you an ephemeral port right so if you specify port zero like at bottom from the client which is 127320.1.
Uh it will pick a port for you. Uh but uh those ports are a finite resource and uh in this case um because the uh it's
sort of funny. It's not like there was a lot of traffic but the payload size and the individual requests were very very large 15 to 20,000 URLs. Um, and that
ended up spawning like a ton of Go routines and they saturated the connection and it the the real irony here is that that connection is to local host, right? That connection is to a process that's running on the same machine uh is memcache. Uh, and so there's there's a lot of great detail. I suggest I recommend going reading writing uh reading uh Jim Calabro's write up and it's really nice. I really appreciate when a company like publicly talks about the the details of their incident. Um, this is another one that happened to Slack. um a few years ago. This one was written by Laura Nolan, who uh who's no longer at Slack, but uh she does she did their best incident writeups. Uh and this was a kind of a complex one uh that involved a lot of saturation. I'll see if I can explain this here. So, this happened to Slack like I think on a Monday after a holiday, right? And so there was a like a large volume of traffic uh that went in through their web tier, hit their transit gateway and their transit gateway saturated. Um right and so it started to get overloaded and then that meant that the calls from the web tier to the transit gateway those threads got blocked waiting because the transit gateway got slow um and the web tier autoscaled on
CPU utilization and now when threads block they are not using CPU and so the web tier actually started to downscale uh because of that. Now, no no actually
um they also have another rule where they scale up quickly if there are too many threads, right? So, they have a they have uh they designed for that, right? So, what happened was um there were too many active threads and so they quickly scaled up the web tier uh autoscaling group. The problem was that quick scale up overloaded their provisioning service. So, there is a service that provisions new instances as they come up inside the autoscaling group. Um and that thing hit too many open files uh and it also hit some AWS quota right uh and so it could not provision uh the new ones that came up so new ones that came up couldn't take traffic and then they actually hit the limits of that web tier uh ASG that ASG hit it you know it's configured to a max size and so there was like four different kinds of saturation all going on at the same time in in this incident and once again I recommend reading the the write up it's really uh a lot of great detail on what happened there.
Uh the last one I want to talk about happened uh also fairly recently uh in
San Francisco uh which I thought was a really interesting failure mode. Uh so back in December, there's this big power failure in San Francisco. If you have been to San Francisco recently, you will see there are Whimos all over the place now. It is sort of Whimo Central. Uh and so when there was this power failure, the traffic lights went out, right? Uh now, uh when traffic lights go out, uh we treat them like four-way stops and Whimos treat them like four-way stops, but in some circumstances, Whimo will also do what they call a confirmation check um when this happens. They don't explain what that is. My assumption is that they are calling home and there's a human telly operator checking to see is this actually safe, but I don't know for sure.
But all I know is that they do confirmation checks in some cases uh when when uh a Whimo hits a um an
intersection where the lights are out, right? And they they got overwhelmed by those. So there was this huge backlog of confirmation checks they couldn't get through because there were all these lights that were out in San Francisco that affected all these Whimos. And so all these Whimos were just stopped at these intersections during this time, right? And that the funny thing is, of course, they had put that in for safety reasons, right? uh and what happened was it it caused an issue and they they wrote a blog post about it as well. This is all coming from the you know Whimo's official blog. All right. So uh those are some different kinds of saturation. I want to talk about the different ways that systems can can saturate.
So the the way we generally think about uh system saturating is there some sort of increase in load on the system. Right? That's the most common one. Uh sometimes uh often external traffic will do that. Uh sometimes it's what I would call bad external traffic. traffic. It's traffic we don't want. Uh, usually that's bots in some way. Maybe it's scrapers, maybe it's some automation that's gone gone crazy or just doesn't respect your site or whatever. Um, but also sometimes uh there's external traffic that I would call good that like you know you're getting more users or more usage of your service. Um, and so you sort of want that to happen but you can't handle the the load.
And I thought this was interesting. This is uh two tweets, one from an anthropic engineer and one from an open AI engineer about 3 days apart. Both of them talking about how they are faced with the risk of saturation that they have to make changes internally because they are getting overwhelmed by the increase in load on their system because of how successful these companies are being.
Now, uh if you have a sudden spike in load, we have like a cute name for that, right? In our industry, we call that a thundering herd. when all of a sudden uh you get a lot of traffic coming into you. Uh we also uh in a particular case we have a term retry storm. Anyone ever heard of that? Retry storms. Yeah. Yeah. Uh so you can imagine a service starts to get overloaded and it starts returning errors because of that and then all the clients retry or they may
be automated retries or sometimes manual. Have you ever as a user like I can't hit this site I'm going to keep trying over and over again. Yeah. You're a human retry storm, right? You you are making it worse. Uh and it's a very natural reaction. Uh there's a traffic amplification. I think some people call this fan span out, right? Where there's not that much traffic going into a particular service. And I I live in like microser land. Uh so uh you can imagine these as being two microservices in a in a larger microser architecture. Uh so some traffic is coming into service A and service A for whatever reason makes many many calls for each one to service B and that that overload service B. So it seems like you're okay from the outside, but you're actually overloading one of your internal services.
And then one of the mo most pernicious um uh saturation failure modes is when you have a resource leak. So it could be a memory leak or it could be a leak in any of your resource pools like thread pools or connection pools or whatever. Uh and I call this pernicious because uh as an S sur our most effective heristic at
bringing the service system back to healthy is to ask like what changed when we started to see impact right and the problem with resource leaks is that the time of change is not close in time to the time of impact if it's a slow leak right and so nothing happened at the time of impact other than you actually reached saturation you you ran out of resources that doesn't tell you that the leak happened you three months ago. Um
my favorite of this case is um you will sometimes see uh companies where the services have resource leaks but they deploy often enough that it masks that and then they have a um a lock like a deploy lock for safety. Uh and then what happens is that that that exposes those resource leaks you didn't even know were there. so that the the leaks might have been there months or years before, but you don't see it until the circumstances change and expose them. Sometimes uh someone will implement something that is functionally correct but eats up a lot more CPU or memory uh than you were expecting and then that actually takes out your service.
Uh this was a fun one from Cloudflare back in 2019 where uh one of their WAT rules had a had a particularly expensive reax which did a lot of backtracking which uh led to CPU uh saturation and
they think they were like 503ing on all their sites right uh and they have a lot of good detail about that theirs as well. So sometimes um you know companies often have some internal processes that are running in addition to like online traffic that's coming in and those internal batch ideally you have segregation between like your online and offline traffic but there's usually some nexus points and these internal batch jobs can knock you over and you sort of see well why did that happen at some specific period of time right um and because some new batch job started I've seen cases where someone does some sort of ad hoc query to a database uh and that that [laughter] right that that uh happens to take out the the system because it's so expensive. You didn't realize it was going to happen. I saw someone do this once with and it just happened to be the it wasn't the specific query itself, but they were using some like guey application that they were connecting to a Cassandra database and it did some really expensive uh query and it took the whole thing out. Uh and sometimes it's just plain misconfiguration, right?
Sometimes your limits are just set too low. Uh, and that's fine for a nominal, but when you hit peak, you don't realize until then that you, you know, you set your rate limits too low or whatever other limit you have. So my my claim here is that you can't actually avoid saturation. Like you are eventually my, you know, I will predict
that eventually within this year I would say you're going to have a an incident that involves saturation in some way. Um
and the reason I I I am so confident in saying that not just because I've seen many of these is one just because of the fundamental nature of reality right so we have a finite amount of resources available to us right which means you you never are going to have like infinite headroom um but but [snorts] more importantly and something that's actually come up several times I think in this conference is that we all face production pressure right we all face pressure from the business to deliver what is perceived as value to the business even if we are concerned that there are other things that we should worry about in terms of quality or we want to spend more more time daydreaming as as Maryanne mentioned right like production pressure takes away that time the thinking time uh and like we can try to push back on it but this is inevitable you are always going to face this you were never if you ask an engineer in any any field if you had much more time could you do a much better job they would all say yes like we we all face this and there's no way around it and so we have to just sort of navigate it as best we can.
And finally, there there are some limits out there that you just don't even know about um until you actually uh run into them. So, uh I made sort of this I like to make uh sort of jokey like suggested interview questions u and I made this one a few years ago and I thought it'd be a fun question to ask SRRES like tell me about a time when you learned about a limit only when your system hit it. Uh, right. Uh, and the reason I think this is a good question is because then I think they would get a good story out of them. I I don't know if I if I would be able to assess how good they are as SRRES, but I'm just looking for good stories. And I I got a lot of responses on on Twitter at the time, and I I actually started a um
uh Okay. Yeah. So, I actually started a uh a page uh on GitHub called Awesome Limits uh where I started collecting these uh because people kept telling me about different limits they had. Unfortunately, because of like the Twitter exodus, this is sort of link rotted. So, the original sources are not always around. Uh, but the point I'm trying to make here is that you're never going to be able to fully design your way out of this problem, right? It is always going to be a risk that you face.
So, going back to the the model that Woods had about the confidence envelope is that you can improve your designs and increase your envelope size. Right? Every time after an incident when we say this is never going to happen again, we're going to design our system so that we can handle that particular failure mode, you're expanding your competence envelope to deal with with uh more types of problems and that's good. But you can never expand it infinitely, right? There's always some limit to your system. And that's why people like me have to carry pagers, right? I mean, this this is the reality. I mean, I I I would love it if uh AI took my job. I'm like, "Take my job, please. [laughter] I don't want to be on call and get paid at two in the morning." Uh, but I just don't think it's gonna happen. Uh, because I think that for the foreseeable future, uh, humans are going to have to intervene, right? Because like there are things the systems can handle by themselves and auto recover and they do that. Uh, and but there are many cases where they don't and for that you've got to bring in the people uh, to help recover from the saturation.
Uh, and when that happens, right, when your system is in saturation, you're having an incident, you're throwing 503s or or you're just hanging or whatever, um, something about your system has to change, right? Like when an incident happens, when it gets mitigated, somebody did something almost all the time, right? Unless it's self-resolved. Sometimes it fixes itself and no one knows why. Those are scary cases. But in the majority of cases, uh, someone does something to bring the system back to healthy, right? And and so that's some change that the system is actually imposing on itself. And that's what the resilience engineering folks mean by resilience.
It's the ability of a system to change itself when it runs into a problem, when it hits a situation that it wasn't designed to handle. Right? So once again, going back to the the model, so once you hit saturation, what resilience is is the ability to extend the confidence envelope to make a a change to your system so that now your system is back within that confidence envelope again and is healthy. And this is why going back to David Woods in his paper uh he uses the term graceful extensibility to describe resilience because resilience is kind of an overloaded term. People use it to mean different things. He means it to to he uses it to mean does someone get paged?
Is it incident IO? [laughter] He uses it to mean the ability of a system to extend its confidence envelope when it hits the boundary. Uh that's that's what graceful extensibility is to him and that's what resilience is to him. Right? So to be resilient we need to be able to adapt to cases that we didn't think of in advance. Right? Because if we thought of in advance we would have designed them out and we would be able to automatically handle them. So we need to be able to handle situations that we did not think to design for. Right? And the the expression I I love the most about this is like to be resilient, we need to prepare to be surprised, right? That's the name of the game.
I did not realize how dry my mouth was going to get here. Okay, so how do we how do you do that? Right? And so we don't know exactly what we're going to need to do uh during an incident, but we know we're going to need to do something, right? And so what you want is optionality. And right, the more knobs you have available to you during an incident, the better positioned you are to be able to deal with it. Like you you don't want to have to build new tools on the fly. Like I would say the two worst times to write code are a
during an uh an interview [laughter] and b during an incident. And and these are both sort of like high consequence time pressure environments where like if
you do nothing, it's terrible. But if you do the wrong thing, it's also terrible and all eyes are on you, right? And so like this is not the time. Sometimes you have to write code. I've done it. But like you want to avoid it if you can, which means the more options you have at your fingertips when it happens, the better, right? So you want to be able to have a lot of stuff. This is probably like, you know, uh, motherhood and apple pie stuff. Everyone probably has this stuff, but you need to have like break glass so you can do like quick changes to production that you would not normally do. Um, you don't want to have to wait for a lot of validation stuff to push stuff through.
uh you want to be able to know how to do things like okay I need to to cycle all my pods right that's like basically restart all of my containers in a particular service quickly uh or I need to be able to quickly scale up uh a service right often like you know the autoscaling has hit the limit or whatever when you quick scale up get more resources get out of saturation quickly uh you need to be able to ideally you know do a quick roll back sometimes you can't do that to be able to do a quick roll fix forward right and if you have a a process that's designed to prevent bugs and there's lots of like gates you have to get through to get it out to production. That's going to suck during an incident unless you have a mechanism to be able to do that quickly. Uh which means you have to have thought in advance how am I going to be able to quickly roll things out because now you're balancing two different risks.
Uh dynamic configuration is great, right? Uh so feature flags are an example of this, right? So ideally, you know, if you're hitting some kind of virtual limit, if you can dynamically set that limit rather than having to like go and edit a config file and push it and all that, uh you're going to be able to to respond much quicker. So the more like feature flaggy dynamic config, uh knobs you have, the more things you can actually do. One particular example is a lot of a lot of systems are rulebased systems, right? So for example, rules that block certain kinds of traffic uh is one. And so you want to be able to quickly say like add a rule to block certain kind of traffic or maybe one of your rules is misbehaving and you want to be able to quickly remove that rule, right? Or you want to be able to block a certain query to a database. Uh you don't know where that query is coming from. Uh so the ability to to add and remove blocking rules quickly uh is is really useful during an instant.
But all these knobs uh they're only useful if you know that they're there and you know how to use them. Um because if not, then they're not going to do you any good. And so it doesn't just take the knobs, it it takes operational expertise. You need people who know what they are doing during the incident um to be resilient.
And operational expertise means that you need people in your in your organization that know the system, right? Um and in particular that the challenge there is that you can't hire for that, right? You can hire people who have general experience in the industry, you know, and they say, "Oh, yeah, you know, I've worked with these databases before. I've worked with JVM apps or, you know, I I know this, you know, there's a CDN here and there's an edge service and there's an API." Yeah. Yeah. But you don't know the details of the particular weirdnesses of the internal thing that you're dealing with, right? Uh so you can hire for sort of potential for this, but you really have to grow this expertise inside of your company.
There's no other way uh to get it on your particular system. And so there's two ways there's a I'll talk about two uh the two ways that I know of to get better at this to improve uh operational expertise. One of one of them is just to to respond to incidents right the the way you get better at dealing with incidents is dealing with incidents. Uh and I actually think that if you have not had any incidents for a long time that is a risk uh because you are losing those muscles that you need uh to be able to respond. And so that's actually D. So there's there's an optimal number of incidents and it's not zero.
Uh and so this is experiential learning, right? This is the learning we get by by doing and there's really no other way to get it besides that. But then there's another way to learn and that's to learn from the experience of other people at the company who are respon





