Moving Fast At Scale
Randy Shoup · Reversim Summit 2017 transcripts · Markdown
Machine transcript. It can contain errors. Click a time to play the video from that point.
> WARNING chunk 4 [31:56-42:35]: repeated lines (loop?): 1 line(s) repeated 3+ times, e.g. 'does it make sense?' x5
00:10 Uh, cool. So, I'm Randy Shoup. Uh, I'm going to talk to you about moving fast at scale. Um, I want to tell you a little bit about my background because that informs a bunch of the lessons that I'm going to hopefully impart. Uh, if nothing else, I hope you'll have some things to think about. So, uh, right now, um, uh, as Shlomi said, I'm the VP of Engineering of a company in the United States called Stitchfix. I will tell you more about that in a moment. But generally, we use technology and data science to revolutionize clothing retail. Uh, before that, I was a sort of roving CTO as a service, my friends used to say. I spent about a year and a half helping companies do what we're going to talk about today, which is move fast at scale. Be more like Google, more like Amazon, more like Netflix. Uh, earlier in my career, I was at Google. Um, I ran engineering for Google App Engine, which is Google's platform as a service, about 3 million different applications worldwide run on App Engine including Snapchat and Pokemon Go and a bunch of other things.
01:18 Uh, and then earlier in my career I spent a I spent about six and a half years at eBay, uh, as the chief engineer and I helped uh, evolve eBay through a bunch of uh, generations of eBay search engine infrastructure. Uh, so a little bit about Stitchfix. Stitchfix is an online clothing retailer, and um, we sort of do things in reverse. Uh, so rather than coming to a physical store or a virtual store, what if you had and shop for yourself? What if you had an expert to do it for you? So, instead what you do is you fill out a very detailed profile about yourself. So maybe 60 or 70 questions, it might take you 15 or 20 minutes. We'll ask things like your size, your height, your weight, your age, your occupation, whether you're a parent. Uh, do you like uh, plaids? Do you like stripes? What kind of colors do you like? Um, do you like to flaunt your arms? Do you like to hide your hips? All the kinds of things that if there's somebody in your life that knows how to choose clothes for you, what does that person know about you, right? And those are the questions that we ask.
02:46 So then a uh, we have a hand-selected box of five items that arrives for you in the mail. Um, they are hand-selected for you by one of 3,500 human stylists. You try them on at home, you keep the ones that you like and pay for those, and then you return the other ones for free. So that is our business model from the client perspective. What does this have to do with technology, Randy? Uh, well, it turns out that there's a ton of engineering and data science that goes behind that whole process. So, in particular, we look at every piece of inventory in our collection, times every single client every day, and we compute what's called a predicted probability of purchase. What is the conditional probability that if we send Randy this shirt, that he will keep it, right? So, it might be 65% chance for this shirt, uh, 47% chance for these pants, 52% chance for these shoes. Does it make sense?
03:54 And that that score is is the ranking function for a a search engine essentially where the human stylist, those 3,500 stylists are looking through uh uh looking through finding the things for me. Uh, so that's the other angle. So, the machine computes those scores of those personalized recommendations, and then there is a human curation step of these stylists who actually end up deciding the five things that go in your box. Does it make sense? Cool. It's pretty fun. Okay. Uh, and and again, as I mentioned, there's a ton of analytics and data science that go on goes on behind here. So, one really interesting fact is I think we are unique in the world in that we have a near one-to-one ratio between engineering and data science. So, we have over 100 engineers in the uh in the engineering group that I work in, and then we have 80, 80 data scientists. So, as far as I'm aware, at our scale, that is unique in the world. Uh, certainly it's unique in retail and in uh e-commerce because we know all those companies. Uh, great. So, what do we do with 80 data scientists? Well, it turns out that if you are smart, it really pays. So, we actually apply data science to every aspect of our business. We use data science to decide what clothes to buy, in what quantities, and what size breakdowns, when should they arrive, what warehouses should we store them in.
05:08 Uh, we use it for inventory management. Um, there is a traveling salesman problem when somebody is going around and picking those five items in a box, right? Traveling salesman problem. So, we have to have a solution for that or at least a heuristic. Um, we do the same thing for styling recommendations. Again, those personalized recommendations that I talk about. And then we do other uh, more standard things like demand prediction. So, since we are a physical business, we physically take possession of the clothes, we physically store them in warehouses, and we physically ship them to people. If we guess wrong, if if we have 2X the number the the traffic to our site, 2X the number of customers, that's not wonderful. That's a disaster, right? Because that would mean that half of our customers we couldn't serve well. Does that make sense?
06:17 Yeah. Okay. Uh, and then again, the model here is humans and machines uh, augmenting each other and helping each other out. So, use the machines for what the machines do best, the humans for what the humans do best. But, one thing that I've learned in working at eBay, at Google, at Stitchfix, and other companies earlier in my career, uh, is what I want to talk about today, which is faster is actually better. So, there is a belief, incorrect one, that if I go fast, I will uh, break things. Uh, and uh, what we will talk about today is you can actually go fast and have things be more stable, um, and more reliable uh, than when you were slow.
07:34 There are two aspects of going fast, which we're going we're going to talk about. The first is the ability to go fast. So if you're driving your car, that's the accelerator, right? The other angle is your willingness to go fast. In other words, not using the brake. Does it make sense? You need both the accelerator and not using the brake in order to go fast down the road. To translate that, that mean that is a combination of capability on the one side and the lack of fear on the other. Does it make sense?
08:44 Okay. Uh, great. So I want to talk about some high-performing organizations uh, and how they uh, do this kind of stuff. And then I'll give some very specific examples uh, going forward. So, the maybe people are familiar with the State of DevOps report from Puppet Labs, hopefully a little bit. Yeah. So every year Puppet Labs does what they call the State of DevOps. They interview, I think, tens of thousands of companies all around the world and try to learn what is unique about the high-performing organizations versus the lower ones. And so, by contrast, between the high-performing organizations and the low-performing ones, high-performing organizations are doing multiple deploys a day, where a low-performing organization might be only doing one deploy a week or a month.
10:04 Uh, in a high-performing organization, the time between when a developer commits code to when it is deployed in production is less than an hour, whereas in other places it might be a day or as much as a week. Uh, the high-performing organizations also are more stable, right? They recover from failure in less than one hour, rather than something like a day. And their change failure rate, in other words, the uh, percentage of time that they deploy something that has to be rolled back, is near zero up to maybe 15% versus, you know, nearly a third or a half for the lower performing organizations.
11:15 So, what's really interesting here is those two first bullets are speed, right? And the second two bullets are stability. Does it make sense? These are not This is not a trade-off. Um, and uh, what is wonderful is that this also has an impact on the business of these organizations. So, the high-performing organizations versus the lower ones, hey, they're two and a half times more likely to uh, two and a half times more likely to meet or exceed their business goals in terms of profitability, market share, productivity, etc.
12:30 So, is there a trade-off between speed and stability? Absolutely not. Um, faster is actually better. So, I want to spend the rest of this talk talking about how to do it, right? So, first, I want to talk about how to organize your company, or organize your engineering organization for speed. Next, I want to talk about what to build, and in particular, even more importantly, what not to build.
13:30 I want to talk about when to build it, I want to talk about how to build it, and finally, I want to talk about delivering and operating uh, the things that you build. Okay, let's talk about organizing for speed. Excellent. Okay, has anybody heard of Conway's law? Wow, everybody, basically. Okay, well, if you had not heard about it until now, um, Mel Conway in 1968 made this observation about uh, about software uh, engineering.
14:38 He said that the architecture of a software project reflects the organizational structure uh, of the team that produced it. Or more precisely, that the software that the architecture reflects the communication paths within that organization. So, Mel Conway meant this as a descriptive uh, law. He was describing what he saw, but it turns out we can actually use this in an informative way. We can use this to our advantage. So, if we want, for example, a modular system that allows individual pieces to move fast and independently from the other, that actually requires a modular organization.
16:03 Does that make sense? So, that if I have a large organization, such as a Google or an Amazon or a Netflix, that is built out of small independent units, those individual units can move very fast, and will build modular uh, modular architecture. Whereas, by contrast, if I have a very organization built of large teams that are highly interdependent, uh, I'm going to end up building something that's more like a monolith.
17:03 So, what's wonderful is that we can again, we can use this to our advantage, and we can actually engineer the system we want by engineering the the organization. So, that's a bit counter-intuitive, but it means that if you change your organization in the way we're about to uh about to talk about, that actually can help change your software architecture in a good direction. So, what do I mean? The the words I like to use are small service teams.
18:13 So, this is again the Google model, the Amazon model, the Netflix model. So, the idea is that we have a full-stack team, so all the um uh all the skills and uh uh and abilities that you need to do your job, and uh that the teams are small. So, people may be familiar with the Jeff Bezos quote about a team should be uh a two-pizza team, which means that a team should be no larger than can be fed by two large pizzas. So, the wonderful corollary uh that my Amazon friends have told me is that that actually means you can't have too many young people because they eat too much pizza.
19:35 Have to have the older guys with gray hair or no hair like I do. Uh, anyway, so and the other the other thing you want is that you want these small uh teams with well-defined areas of responsibility that are directly aligned with the business, right? Directly aligned with some goal of the business or some uh aspect of customer success. So, a clear, well-defined area of responsibility, typically one of those teams will build a single service or application, or maybe a set of related services or applications.
20:47 And also, uh because the teams uh last for a long time, uh the people in those teams develop uh a deep understanding of the particular domain. Uh, and when you grow the team, as we have done at Stitchfix, uh we the growth is through um cellular mitosis. Do you guys remember high school or uh biology in secondary school?
21:51 So, there's one cell, then it divides into two, then two cells divide into four, etc. Does the metaphor make sense? Yeah. That's how you grow these teams. So at Stitch Fix when I joined a year and a half ago, we had 25 engineers. Now we are four times larger with 100 engineers. And there are the same top level teams, but there are just more smaller teams underneath. Does that make sense? The computational idea is that we're growing as a tree. Yeah? We're growing from the leaf uh from the root of the tree down uh down to the leaves. Okay? Um and uh ideally, if you draw those team boundaries correctly, in my estimation, most of the project work ought to be able to be done within one team's boundary. Does that make sense? Like you try to draw those team boundaries in such a way that maybe 80% uh of the work is done within the team boundary and maybe something like 20% are, you know, cross-functional uh uh cross-functional projects that go across the individual teams. Okay. I want to talk about when this was not done well. So when I first joined eBay in 2004, they had this idea of train seats. So the idea was, um, every uh there was a uh top-down waterfall process uh where somebody would propose an idea, then there would be an engineer that would scope it. In other words, would estimate the amount of work that would go into it. And the unit of estimation was a train seat. In other words, one engineer times two weeks of work. Uh unfortunately, the the person who did that estimation had a, you know, had a design in his or her mind, right? They obviously had some design because that's how they estimated it. But that person didn't do the implementation. Does it make sense? So the designer didn't implement, the implementers didn't design. Um and that led to an incredibly dysfunctional engineering culture. So engineers were essentially treated as cogs, so there were like 1,000 engineers and it'd be like, okay, I need a little bit of HTML, I need a little bit of database, I need a little bit of JavaScript and I'll form this team, you know, for maybe six or eight weeks and then I'll disband them again. Um so that was pretty unpleasant. It was there was very little regard for people's skills or interests. Um there was no pride of ownership, right? Nobody owned any particular part of the code for, you know, longer than a month. So you can imagine that there wasn't a lot of um care given to long-term ownership and technical debt. Does that make sense? Yeah, it was pretty much a disaster. Um I I will happily tell you that eBay has reformed itself and it's not like this anymore, but it wasn't very it wasn't great. Uh okay. So, that's a little bit about organizing for speed. Now I'd like to talk about what to build and particularly what not to build. So, uh Mary and Tom Poppendick who wrote the fantastic uh Agile uh people, um they wrote the book Lean Software Development, which I I highly recommend. Um their observation, which I think is quite true, is the biggest waste in software development is building the wrong thing. So, how can we avoid building the wrong thing? If there is one thing you take away from this uh presentation, uh I want you to go home with this, uh or back to work with this. When somebody from the business or product or whoever's asking you as an engineer to do a thing, they say, "Please add this button to the website." Your response will be this question. What problem are you trying to solve? Does it make sense? Because maybe the solution to the problem is add the button. That's fine. But better for you to use your engineer mind and help the business person or the product person think through the problem they're actually trying to solve, because it's possible that that you might solve be able to solve it in a different way. So if you spend that additional 10 minutes, 15 minutes, maybe an hour, really stating the problem in a very clear way, you're almost halfway to solving it, right? So this guy um used to run research for General Motors, you know, at the time the big the largest um uh automobile manufacturer in the United States and earlier in this in last century, largest in the world, not anymore. Um but a problem well stated is a problem half solved. So what problem are you trying to solve? What you're trying to do is get you and the business person to focus on what is actually important for the business. And like I said, it is very likely, it is not entirely unlikely, let's say it that way, that the problem might well be solved by no technology at all. And your job here is not to type into your editor, your job is to help solve business problems. Sometimes that involves typing, but other times that involves thinking through the problem and using your engineer brain and your methodical approach to problem solving and helping the business person or the product person think it through. So sometimes it might be redefine the problem completely, sometimes it might be change the business process, sometimes it might be, you know what, some in the future I'm going to build you an application to do the thing that you want, but right now let's just implement it manually to see how it might go. Does this make sense? Yeah, this is exactly how we work at Stitch Fix, by the way. So, the business people start to laugh, you know, as soon as they come to us and we start to, you know, what problem are like they'll finish our sentence, right? What problem are you trying to solve? And then they go, oh, and we have this conversation. Um so the next so that's now we have defined the problem and now we have an idea that maybe, you know, it's going to involve some typing. Maybe the solution actually involves some software. Well, do you have to build it or maybe you could buy it? And the wonderful thing about being in 2017 is there are a ton of stuff to buy or even for free. So, as you can see from me, I've been in the industry for a long time. I started the at the industry in 1990. Uh and you know, at that time there was basically no open source, there was certainly no cloud, there were certainly very few software services if any. Uh and so the wonderful thing about being in 2017 is we have all those things. So, I strongly recommend, if you are not already, using cloud infrastructure. Why? Because buying essentially renting, you know, infrastructure from Amazon or Google or Microsoft or, you know, uh Joyent or something like that is going to give you faster, cheaper, and better infrastructure than you could ever do yourself. Stitch Fix has no physical infrastructure anywhere in the world, except for our laptops, and then we have some Wi-Fi uh network equipment at the warehouses. That's it. No racks. We will never we do not and never will ever have a piece of physical physical infrastructure anywhere in the world. Why? Because we don't have to. Um I would strongly uh recommend that you prefer open source. I loved yesterday uh all the uh hearing all the great stories about um how wonderful the open source community, how vibrant it is here in Israel. Um there's a ton of great open source uh stuff, right? Uh right? So, Kubernetes and Docker and Istio if you're going to do um you know, container management, uh for databases, you know, mySQL and Postgres, and Redis and uh Elastic Search. Uh we use most of these at Stitch Fix. If you're doing machine learning, like all the all the models are out there uh in any of a in any of a number of different languages, Python, Java, R, etc. And usually, this is the wonderful thing about 2017, is usually this open source software is better than the software you might pay for.
23:14 So, um I'm going to be, you know, a little bit non uh politically correct. It sucks to be a software vendor in 2017, right? I do not want to pay for software. I will, however, pay for a service, right? So if you're going to build a service and uh provide to me software that way and allow, you know, you operate it for me and I just use it through an API, that is awesome and I will completely do it.
24:23 So Stitch Fix uses over 50 third-party services to do all these different things that, you know, we don't want to do ourselves. So, everything from logging to monitoring, to alerting, to project management, to bug tracking, to uh billing, to fraud detection, on and on and on and on uh times 50. And what's great is that allow that allows us not to have to build infrastructure or not to have to build things that are not in our core competency.
25:47 Rather, we can use our, you know, uh scarce resources and you know, smart brains to focus on the things that actually matter for our business and let every that other people worry about everything else. Does this make sense? Great. So I like to quip, soon it will be just as common to run your own data center as it is to run your own electric power uh electrical power generation.
27:03 And sometimes people do that, right? Like if you're Google, you do run your own electric power generation, but most other people don't. The other thing I want to talk about in terms of building uh building the right thing is experimental discipline, right? So as I mentioned, we're pretty big into data and data science, so we do a ton of experimentation at Stitch Fix. Uh, this is how science works, by the way, guys. You state your hypothesis, then you run an actual test, right? So there is a control group and maybe one or more treatment groups, A/B test, you run them in parallel, you look at how the A group is doing versus the B group, and then you can make some determinations about whether the difference between A and B is statistically significant.
28:33 In order to do that, you need to obsessively log and measure all the behavior of the behavior of the system, behavior of the users, etc. Listen to the data, right? So as humans, we love to make theories about things and we put patterns together even where patterns don't exist. Um, but the wonderful thing about data is that it blows past all that, right? So data is far more important, far more powerful than any hope, than any intuition.
29:40 Uh, and what's wonderful about having all the data is that you can then develop insights for the next experiment that you might want to build. So, there is a combination here of art and science. So, the art part, the place where the humans are really good, is thinking about the experiment, right? Designing the experiment, thinking carefully about the hypothesis we're trying to test, thinking carefully about what experiment would uh most minimally and most clearly demonstrate one way or another whether that that hypothesis is true, evaluating the uh the results of the experiment is not art, that's science.
30:59 Does it make sense? So, now as we like to say in the US, rinse and repeat, right? So, do the same so you made experiment one, now you have learned some things, maybe you leave some things on the site or maybe it wasn't successful, then you do experiment two, experiment three, experiment four, etc., right? This is a journey, not a single step. Does it make sense? Great. Okay. I want to give a wonderful example from eBay. So in the years 2010 to 2011, sort of the last year that I was at eBay, I was involved in two wonderfully successful projects that had directly had to do with experimentation. So the first was introducing the concept of machine learned ranking. So people are probably familiar with a ranking function in a search engine, right? So if you use Google, there's the there's page rank which which orders the results for you according to some score, right? So it decide the ranking function decides what result goes in the first position, the 10th position, the hundredth position, etc. So at eBay, eBay had the similar thing and similar to Google, there was a whole industry of people that were trying to, you know, game the system and you know, get their results higher. So beforehand, we had a very small number of hand tuned factors. So there was a product manager at eBay, he was very smart, he came up with these ideas, or this you know, ranking function, it was sort of, I don't know, I'll take 20% of that and 30% of that and let's do a linear combination and that was the ranking function. And it actually took us a long time with a machine learned model to beat it. But once we beat it, we were able to blow past it. Our goal though with this work was not to use a couple of hand tune factors, but to use literally hundreds or thousands of factors to help determine the rank of the results. So we did, of course, incremental experimentation. So we developed a bunch of predictive models, what was the conditional probability of once people went to query a page, what was the conditional probability that they would then view an item? Once they viewed an item, what was then the conditional probability that they might purchase the item or bid on it? Hundreds of parallel AB tests going on for a year, a full year of steady incremental improvements. So no one improvement made a huge difference to be honest, but you know, we would be very happy if we made a 0.01% improvement in one of these metrics. But at the end of the year, here was the result. This work alone generated a 2% increase in the overall revenue of the entire company of eBay. So at the time that was $60 billion of revenue. eBay takes about a 10% cut, so that is $120 million US dollars every year. Another thing that we did was we improved the speed of the search results pages. So our goal here was to reduce the user experience latency, right? So people know how to hopefully make faster websites. eBay at the time in 2010 was, you know, learning how to do that. Um, and again there was an iterative process. So we would make improvements to the CDN, to the JavaScript, to the order of things on the page, etc. We would implement some potential improvement. We would release it to the site in an AB tested manner, and we would monitor the metrics. We would monitor the performance, we would monitor the user behavior, etc. And again, in same as with the machine learn ranking work, this generated another 2% increase in the overall revenue of the company. So again, another $120 million US dollars every year. So if you put those two things together, these two threads of experimentation generated about $240 or $250 million. That was a good day's work. Good year's work. Lots of people were involved, but, you know, not as many as you might think. Uh, that was pretty great. Okay. So that's about what to build and what not to build. Let's talk about when to build a thing. So when to build is all about prioritization. So, uh, raise your hand if you have too little work for your team and people are sitting around, you know, uh, surfing the web. Raise your hand if instead you have way more work for your team than they could possibly do. Yeah, more hands went up, but let the let the record show that more hands went up in the second and no hands went up in the first. Yeah. We always in our industry have more work than we to do than we have time or people to do it. And so there is an opportunity cost, right? We choose to do thing X, but there is an opportunity cost because we are implicitly or explicitly choosing not to do Y. Does it make sense? Every decision, whether we are aware of it or not, is a trade-off between the thing that we choose to do and the infinite number of things that we chose not to do. So how are we going to make these decisions? Well, it's it should be pretty obvious, although I would say that unfortunately not a lot of decision making is done in this way. But it should be done this way. You should think about the return on investment. In other words, what is the impact of the thing you're going to do? What is the effort is going to take it is it is going to take to do it? That is your priority full stop. Uh, and what is wonderful about this, or maybe interesting from an engineering perspective, is this is not a technical decision, right? This is a business decision. So we think, you know, it's a business decision to decide what is, you know, uh, what is the impact? Uh, and it's a technical decision to, you know, talk about what the effort is and involved there. Um, so obviously we want to think about we want to think about the priority of the things that we're going to do and that will just that will help us decide when to do things and in what order. So the other thing that I would like to say with my teams is this little quip. Fewer things more done. What do I mean by that? I mean maximize the so I have some priorities, right? So we've decided what the priorities are. So I first maximize the resources that I'm going to put against priority one. Yeah? So I have, I don't know, five people and maybe three people would be able to be productive, you know, doing priority one. Now I have two people left. Now I'm going to put those two people against priority two. If priority two can take two people or more, now I'm done. So, uh, that should be how we all do prioritization, but unfortunately what I see, even sometimes at Stitch Fix, but certainly in other places that I've worked is the is the situation where I have five people on the team and I'm going to do five projects in parallel. Does have you ever is that anybody's experience? Yeah, most of the room. Yeah. So that's not great. Why? Because there is a priority one. There is a priority two, right? And so if it would be possible to achieve priority one faster by adding one more person or another more another person, you should totally do that. That is what the priority means. So, this idea that with five people I should do five projects or 10 projects, like it just makes no sense. Uh, and I completely admit that I have done this in the past, I have committed this sin, um, but now I have learned and I am trying to reform. Uh, so the other angle here is if you do fewer things and you get them more done, you deliver more often. Does that make sense what I'm saying? There are fewer, you know, there are more people working on priority one and priority two, so I deliver them sooner than I otherwise would, and so I can get those that value delivered to my customers earlier. And by delivering value faster, that actually, um, anybody who is familiar with finance at all will tell you that there is a time value of money. A uh 100 shekels today is worth more than 100 shekels a year from now. So the time there is a time value of money. There is a time value of benefit that we get in uh for the features that we build. So if we can build uh and release something earlier to our customers, we will benefit. And so the idea is of course, once you solve problem one, problem two gets a promotion. Does that make sense? Do number one, you're all gone, that one's gone, now problem two becomes problem one and go from there. Okay, so that's about when to build things and prioritization. Now let's talk about how to build them. So I think I cannot do a conversation uh or a conference talk in 2017 without mentioning microservices. Um, that is a thing that we actually do. I've been doing it for many years, although we didn't have this word at Google, Amazon, Netflix, all those places, you know, practice this uh this method of development. Um, so microservices are single purpose. They have a simple, well-defined interface. They are modular and composable. And then the critical thing for moving fast is that they are independently deployable. Um, and if you look at some of these uh some of these criteria that they're single purpose, there's a simple well-defined interface. Does that sound at all similar to the small teams that I was talking about earlier? Please nod, because yes, it was very similar to the idea of the of the small teams. So the small teams maps very directly on a microservices approach to your architecture. Um, so I want to talk a little bit about how large-scale um companies that you probably have all heard of have gone from a monolithic approach into microservices. So eBay, depending on how you count, is on its fifth complete rewrite of its infrastructure. So it famously started in 1995 as a weekend project, a three-day weekend project by uh Pierre Midyar, who was the original founder. He wrote it in Pearl. Uh, he um it could it could handle about 40,000 items. Every item was its own file, there was no database. It lived, um I keep wanting to say it lived on his laptop, but I'm pretty sure he didn't have a laptop, like it lived on his, you know, tower with a 486 or whatever, like, you know, this was 1995. Uh, so then the next iteration was a monolithic C++ application, which uh at its worst grew to 3.4 million lines of code in a single DLL. Uh, eBay was hitting compiler limits on the number of methods per class, which is 16k. Yeah. You think you have a monolith. Ha. That's a monolith, baby. Uh, so the next iteration after that, the version 3 was a rewrite in Java, um and it would you couldn't really call it microservices, but it was maybe many applications, right? So there was instead of one monster application that was all of eBay, there was a separate Java application for the selling uh pages, for the buying pages, for the search pages, etc. Times about 220 different uh applications. Uh, some were large, some were small, etc. And now it's fair to characterize eBay as a polyglot set of microservices. Twitter has gone through a similar evolution. So it's pretty much on its third generation of its architecture. It started famously as a monolithic Rails application, which at Twitter they called the Monorail. Uh, they broke out the front end into JavaScript, the back end into services mostly mostly written in Scala, and now it's fair to characterize Twitter as a polyglot set of microservices. Amazon has gone through a similar evolution. Uh, so, uh, they're not so clean on their architectural generations, but Amazon was originally a monolithic Pearl and C++ application, which was code-named Obidos, OBIDOS. So if you ever use Amazon even today, you will find that in some product details pages there will be Obidos in the URL, and that still refers to that old monolithic application from many years ago. So the wonderful and crazy thing that Jeff Bezos, the Amazon CEO did, was in 2000, he realized that Amazon needed to break up its monolith and become more service-oriented. So it's hard to remember given how successful Amazon is today, but it's hard to remember that in 2000 to 2005, they were not doing very well as a business to be honest. And Wall Street was telling Jeff Bezos, hey, you need to start making some money. And he says, hold on, I'm making everything service-oriented. And he, you know, brilliant as was, still is. Um that was his discipline. And he said, you know what, I know that if we spend the time these five years to build out services, uh we're going to be a successful business. And look what happened to Amazon, right? He was he was absolutely correct.
32:10 So, uh they broke up that monolithic application into services, mostly at the time, you know, early written in Java and Scala and now it's fair to characterize Amazon as a polyglot set of microservices. So, what can we learn from this? We can learn that no one starts with microservices and that is absolutely true. If you are a five-person startup, please do not do microservices. That is not the right uh model uh for lots of reasons which I'm happy to talk about later. But past a certain scale, every company, every successful company that continues to move fast has reinvented this concept that we now call microservices. Or as I like to say, if you don't end up regretting your early technology choices, you're probably over-engineered. There may have been, let's let's do a thought experiment, a Gedanken experiment. Uh let's um uh let's imagine that there was an eBay competitor in 1995 where instead of building a monolith and getting customers and figuring out what they needed, instead they built a distributed system, right? There is a reason why we have never heard of that company.
33:13 Let's imagine there was an Amazon competitor that again started, built a distributed system from the get-go, instead of, again, building a monolith but delighting their early customers and, you know, finding more and expanding from books into other things. Again, there is a reason why we have never heard of that company. So it's important to think about what the right uh scale you are, but at large scale, you're going to have to do something uh uh to keep your people productive and microservices uh tends to be the answer. Okay. Uh so now I want to again, we're talking about how to build things and I want to talk about quality discipline. So to me, we talk about prioritization, right? So often we have this list of features where, okay, these are priority one, these are priority two, etc. I like to think of quality and reliability as what I call priority zero features. So, um if we don't have high quality, if the if the system isn't up, it doesn't matter how pretty the UI is, it doesn't matter how feature-rich uh the application is. Uh and what that means for my development teams is that developers are responsible for all aspects of the development process, right?
34:13 The same developers are responsible for building the features, for ensuring the quality of those features, for ensuring the performance of those features, for ensuring the reliability of those features, and for ensuring the manageability and operability of those features. Um, so what we do at Stitchfix, and I hope you do too, I'll try to convince you if you do not, is what's called test-driven development. Uh I actually don't care whether you do the tests first or tests last, but I do care about this. You are not done with your feature until you have written your tests. Tests will help you to go faster. Why? Because tests have your back, right? The test, you know, tests are like the other guy in the army that, you know, is is there to make sure that you're okay. You never go out on patrol by yourself, right? You always go out in pairs or more. There's a reason for that. Test-driven development is the same way. Whoops. Um, it allows us actually to move faster, not slower. So, even though we are making an investment in writing the tests up front, that investment pays off almost immediately in greater development velocity now and in the future.
35:14 Tests make better code because it allows it gives us the confidence to potentially break things and it gives us the courage to refactor the code uh mercilessly as we go along. Tests also make better systems because it allows us to find uh bugs earlier in the in the development process and it allows us to fail faster. So, Microsoft did a wonderful study of uh what amount what the what developers actually do every day. And it's quite enlightening. So, it turns out that most developers spend about 75% of their time reading existing code. They spend about 20% of their time modifying existing code and they spend only about 5% of their time writing new code. So, as you can imagine, test-driven development helps both of these things. Yeah? So, the fact that I have written tests about all the existing code means that I can write the new code uh blithely. Like, I don't even have to worry about it. I can go as fast as I need to and if uh and the tests will put on the brakes uh for me.
36:16 Does this make sense? Cool. Okay. Has anybody ever heard this? Randy, we don't have time to do it right. Anybody? Yeah, most of the room. Cool. Here's what I say. Do you have time to do it twice? That's the choice. Right? You can do it right the first time for some value of right, which we'll talk about, or you can do it twice. That is a choice. This is counter-intuitive. The more constrained you are in time and resources, the more important it is to build it right the first time. Why? Because if I'm taking this next step, I don't want to have to worry about, you know, this thing collapsing behind me. Does it make sense? Like, I only have five people in my little startup. So, I need to make sure that every step I take is moving forward, rather than I take one step forward and two steps back. Does it conceptually make sense? Okay. Uh, so build it right enough the first time.
37:16 So what I am not saying, well, okay, I again, this is back to fewer things more done. So build one great thing rather than two not so great things. Um, so I do not mean to build the perfect thing, right? So there is always an 80/20 rule about building the 80% of the functionality with the 20% of the effort and getting that going and, you know, getting it out to customers and getting feedback. So what I am not saying is building the absolute perfect system or absolute perfect feature before you release anything. But what I am saying is the stuff that you release should be solid. Does it make sense? Like I might have some edge cases, but it needs to be it needs to be solid. Um, and we do this at Stitchfix and the wonderful uh result is actually what you'd hope for, which is that we basically don't have a bug tracking system. So we absolutely have bugs, um, but we don't have a long list of a thousand, you know, priority three and priority four bugs that we know we're never going to fix. Basically, we have we have tested enough upfront that when we find a bug, we just fix it. Yeah?
38:16 We find a bug, we write a test that demonstrates the bug, it verifies the fix, we uh deploy the fix out to customers, all done. So it means that we are, you know, when when we have new issues that arise from customers, um, we are able to, you know, deal with them right away. Um, and what is wonderful is that our product backlog, like we have a backlog of things that we want to do, but that backlog is not a list of all these half implemented features that we did, you know, terribly before. Instead, it's new features that we want to build and also technical debt that we have accrued, but we have accrued uh intentionally. Does it make sense? Like, oh, we should go back and, you know, fix the 20% of that thing. Does it make sense? It is so wonderful. I cannot describe to you how wonderful it is to live in a world where this is true. Um, and test-driven development is what what does it. Okay, I want to talk a little bit about continuous integration. So, the critical thing here is that when we are building things, we are making small, incremental changes. Uh, large changes are risky. So, a risk, the risk of a code change is actually non-linear in the size of the change, right?
39:19 So, if I have a 10-line code change, it's not, you know, twice as um uh twice as risky to do 20-line code change. It's like four times as risky or eight times as risky. So, it's more of a geometric or an exponential relationship than linear. Um and uh I'm uh don't have a lot of time, but there's a wonderful place in my own life. When I first went to Google, um I um I didn't do this. So, my first submit, I joined Google, I was going to be the director and run the whole engineering group. Um, there was a good recommendation from my boss that I'd be an individual contributor at first, so that was wonderful. I got to build a service, uh and then when I made my first, you know, submission, it was uh 1,200 lines of code. Uh, that was pretty awful. Uh, it actually took a guy, you know, the person who was reviewing that code, it took him two days to review my code. Um, he didn't complain, he was very nice. Uh, he did work for me. Uh, but uh that didn't have anything to do with it. Um, and it actually ended up growing to 1,800 lines. So, I learned my lesson.
40:19 So, what I should have done was break up that 1,200 line thing into, you know, much smaller units and had them be uh independently deployable. So, uh there is a vicious cycle of technical debt. If you do this, we don't have time to do it right. This is where you end up, right? We don't have time to do it right. We do something quick and dirty. We accrew technical debt. Now, we have so much technical debt, we have no time to do it right. Quick and dirty. Does it make sense? Round and round and round in a vicious cycle. Where you want to be is a virtuous cycle of investment, right? You want to do some you want to do testing. It means you have a solid foundation under your feet. It means you have confidence to move forward with conviction, uh, and with courage, and then you can get faster and better, and you just, you know, that you know you have more resources to test and round and round and round in a in a great way. So, I'll go briefly through the last section, which is delivering and operating. Uh, so the key idea here is the DevOps model of you build it, you run it. So, that is uh so continuous delivery is the idea here. So, elements of that are that you want to have a repeatable deployment pipeline, so you are deploying things all the time to uh production.
41:23 So, again, multiple deployes a day for those high-performing organizations. Uh, at Stitchfix, most applications are built are deployed multiple times a day. And again, just like building things with small commits, that leads to more solid systems because we're able to make small changes that we understand, they're easy to roll out, they're easy to roll back. Uh, I want to talk a little bit briefly about observability. So, you want to have a small a strong practice of sort of detailed end-to-end monitoring of your production systems. Uh, that'll gives you the ability, those that team that, you know, operates the software, the ability to detect and alert on issues anywhere in the system. Um, and then obviously, you want to have sufficient monitoring to be able to do remote runtime diagnosis. If you ever have to SSH into a machine, your monitoring has failed. I have a few more ideas for you, but maybe we can talk about that over coffee in the break. So, I hope this was helpful. Um, again, I want you to leave you with, there are lots of ways, lots of these techniques will help you to figure out what to build, when to build it, how to build it.
42:25 Um, and uh, if you are able to be faster, you will actually also be better. Toda.
← Digital Culture/Clutter · Build a High-Performance Microservices Architecture with NATS.io & Golang →