Right now, there is a chaos monkey running through AWS, knocking over Netflix servers.
But don't be alarmed. It's all part of the plan.
This is Talk Python to Me with Ray Rapoport, recorded Wednesday, June 10th, 2015.
Welcome to Talk Python to Me, a weekly podcast on Python, the language,
the libraries, the ecosystem, and the personalities.
This is your host, Michael Kennedy.
Follow me on Twitter where I'm @mkennedy.
Keep up with the show and listen to past episodes at talkpythontimmy.com
and follow us on Twitter where we're at Talk Python.
This episode, we'll be talking to Roy Rapoport about Python at Netflix.
This episode is brought to you by Codeship and Hired.
Thank them for supporting the show on Twitter via at Codeship and at Hired underscore HQ.
The topic of this show is Python and cloud computing at Netflix.
A while ago, I had the amazing opportunity to teach a Python training course
to some of the developers in data science there.
I want to give a quick shout out to my past students.
Thanks for listening, guys.
Netflix is an amazing place.
And after the show with Roy, I'm even more convinced of this.
You're going to love this interview.
And with that, let me introduce Roy.
Roy Rapoport is currently managing the Insight Engineering Organization at Netflix,
where they write the powerful telemetry platform and graphics,
alerting, and analytics systems on top of it that allow Netflix to have complete real-time
visibility into its operations and systems in the cloud, on customer devices,
and anywhere else Netflix operates.
Roy, welcome to the show.
Oh, thank you so much.
I'm happy to be here.
I'm really beside myself with excitement to talk to you about some of the stuff that you guys are doing at Netflix.
So thanks so much.
I think when people think about software projects and deployment and managing large software at scale,
there's almost no other company that comes to mind doing the kinds of things that you're doing at Netflix.
I mean, there's a few, Google, and maybe someone else.
I'm not sure.
But what you guys are doing is really, I think, pushing the limits of what you can do with software in the cloud these days.
So I'm really excited to talk about that.
Yeah.
I actually love talking about this stuff, too.
So it works.
That's great.
So since this is listened to all over the world, I know Netflix is, like, absolutely a household name in America.
But maybe you could just say really briefly for folks who maybe don't know what Netflix is, what you guys do.
Oh, sure.
I think we're becoming, to some degree, a household name in a bunch of other countries as well.
We now serve somewhere between, I think, 45 and 50 countries or thereabouts.
In the world.
And we are a subscription video streaming service.
So the idea is you pay us a relatively small amount of money.
In the U.S., I think it's about $8.99 a month.
And you get unlimited access to a pretty wide catalog of TV shows and movies.
And, you know, you watch about as much of that as you want in any given month.
That's fantastic.
Yeah.
You just pay $8.
And basically all movies and TV shows are not all of them.
Almost all the ones that matter are yours to just watch on demand.
It's great.
You know, at my house, I have three kids.
And about six or seven years ago, we just decided television ads constantly being on television, not really helpful.
We have 600 channels.
Two of them are good.
And we just literally canceled our cable and said, look, we're going with Netflix and, you know, a few other things here and there like YouTube and so on.
And it's made an actual real difference in my kids' lives.
I think, you know, you go and ask them, what do you want for Christmas?
They're like, I'm not really sure.
I don't know.
I mean, they're just not overwhelmed with, like, all these ads and commercials.
And I think Netflix is really a positive force.
No, thank you.
And thanks, by the way, for paying my salary.
Yeah.
I'm happy to do my very small part.
So speaking of salary, what do they pay for at Netflix?
Oh, boy.
So my job at Netflix is manager of Insight Engineering.
Insight Engineering at Netflix is a software development group responsible for building real-time operational insight systems.
So originally we thought of it as monitoring, but really the goal is to help people figure out what's going on and what they should do about it.
And in the best cases, actually automate that sort of process of analysis, discovery, decision, and then application.
That's cool.
So who would you consider, like, your internal client?
If you will, like, are you helping the developers?
Are you helping DevOps?
Are you helping, like, the business folks that decide, hey, we're working with this big data and we're trying to figure out what the next data-driven movie we're going to create is?
Or what are you working with there?
Who, rather?
Good question.
Well, it's worth noting that we don't really have DevOps people.
We have developers.
And every developer at Netflix both writes code, tests code, and then deploys it into production is responsible for it working well.
And at 2 o'clock in the morning, if it doesn't work well, that developer wakes up to deal with it.
So every developer at Netflix is our customer.
Now, the interesting thing that ended up happening was, while we're focused on real-time and operational domain, so we don't typically actually work to serve the business people who want longer-term insight and sort of big data queries.
All of our data ends up being stored in Hive and ends up being really useful for a whole bunch of that sort of strategic view analysis that we hadn't originally expected it to be useful for.
Oh, that's excellent.
And I know Hive is related to Hadoop.
Is Hive kind of like the front end to your Hadoop cluster?
Yeah, pretty much.
Yeah, that's the simple uninitiated version.
Awesome.
So I've been watching you guys for a while, you know, just from a software, excuse me, architecture perspective.
And I think that's what you're doing is really interesting.
But could you speak to a little bit of, like, the scale of how you guys are using the cloud?
What cloud are you using?
That kind of stuff.
Sure.
So Netflix is for the control plane.
So in other words, when your device talks to us to figure out what movies it could watch and lets you browse our catalog,
it talks to a whole bunch of systems in the AWS Amazon Web Services cloud.
I think the last official public number that we've disclosed is that we run more than 50,000 servers in the AWS cloud across several production regions.
When you actually stream the movie, that stream happens that comes, sorry, when you actually stream the movie, that actually comes from our in-house content distribution network.
We call this the Open Connect Network.
And so we've actually deployed content caches in a whole bunch of different internet peering points and, in some cases, in large ISPs to minimize the bandwidth that they need to dedicate for Netflix.
So, yeah.
So that's the number of servers in the cloud.
And I'm not sure.
We have thousands of Open Connect servers, but I'm not exactly sure about the number.
Right.
Okay.
Yeah.
You guys have kind of been at the center of the whole net neutrality thing as well because it's so critical to get that bandwidth to so many places, right?
Yes, net neutrality is something that's near and dear to Netflix's heart.
I'm sure you paid a little attention to it, at least as an organization.
Yes.
That's really cool.
I heard some really interesting statistics about how much bandwidth as a percentage of the internet you guys represent.
Do you know that number?
Can you speak to it?
I think the last Open Numbers that's – was it Widevine who reported this?
The last numbers that I heard were something on the order of 33% of internet traffic, theoretically.
Yeah.
That's amazing.
I mean, just stop and think about that.
There's millions of websites, and you guys represent a third of all bandwidth.
That's amazing.
But like I said, you're more or less becoming the new television for the world, right?
And actually, I'm sorry.
That was Sandvine.
And in November, they said we had topped 35%.
Wow.
Yeah.
So all this stuff you're talking about, scaling and CDNs and all this extra work is really needed.
Yeah.
It's interesting how much doing things well ends up working well for you at very large scale.
And how your ability to sort of take shortcuts that probably would be a pretty sane approach using a smaller scale ends up sort of not being very much the right approach when you're looking at our scale.
We end up being a lot more, I think, allergic to technical debt than we would be if we were a lot smaller.
So I can certainly see the more maintainable and sort of understandable the code is because it has to be, you know, at such a scale that you can't have these little hidden problems that people don't understand or don't want to go fix because you have to fix it, right?
I can see how Python would really help in that space because it's a simpler language.
It's easy to understand.
It has these great libraries.
What role does that play?
Well, I think this is where we get into potentially issues of sort of personal preferences almost.
I have some strong opinions about Python.
It's quite literally my favorite language.
It's been my favorite language since I started working in Python in, oh gosh, 04 or thereabouts, like 2004.
So about, you know, 10, 11 years.
I think there's a whole bunch of other people at Netflix who do great work with other languages, many of them JVM languages, whether it's Java, Clojure, or Scala.
And, of course, we also do a bunch of work with JavaScript.
I have been privileged to see some really wonderfully written Python code.
I've been privileged to see some really nicely written Java code.
And I think we've all, frankly, seen some pretty terrible code irrespective of the language.
CodeShip is a hosted, continuous delivery service focused on speed, security, and customizability.
You can set up continuous integration in a matter of seconds and automatically deploy when your tests have passed.
CodeShip supports your GitHub and Bitbucket projects.
You can get started with CodeShip's free plan today.
Should you decide to go with a premium plan, Talk Python listeners can save 20% off any plan for the next three months by using the code TALKPYTHON.
All caps, no spaces.
Check them out at CodeShip.com and tell them thanks for sponsoring the show on Twitter where they're at CodeShip.
Yeah, you can write bad code anywhere, can't you?
Yes.
The only thing that Python really saves you from is bad indentation, I suppose.
Yeah.
It won't run.
If you have bad indentation, it just won't run.
Fantastic.
So when I originally reached out to you, that's because you were a co-author on a really amazing blog post, just very humbly entitled Python at Netflix.
And I'll put that as a link in the show notes so everyone can go check it out.
But you kind of went through all the different uses of Python that you guys have throughout this great cloud system that you guys have built.
You said that you use something called BOTO, B-O-T-O, and that's super central.
And, of course, that's the AWS Python SDK, right?
So what parts of BOTO are, like, super important?
What's a really common thing that you guys do with AWS across developers?
Oh, boy, howdy.
Everything, huh?
So for those of your listeners who don't know, BOTO is a Python interface to the AWS API.
It was written by a guy named Mitch Garnott, who eventually actually ended up working for AWS for a while.
And we use BOTO pretty much across the board, both to talk to various services like SQS and S3,
but also, frankly, to get a bunch of information out of EC2 and almost any other part of AWS.
It is the way for Python developers to talk to AWS.
I'm not actually familiar with any other option that you might have.
Sure.
How much auto-scaling do you guys do, like, for evenings in the U.S.?
I'm just trying to get a sense of, like, how many machines are coming online, going offline.
What's that like?
Well, I'll give you a perspective.
I think we've shown some public graphs that show that the traffic we get at trough,
in other words, the lowest part of our day, which is somewhere between about 1 a.m. and 5 a.m.,
is either somewhere between a third and a half of the traffic we get at peak times in the day.
So that means that if you've got application servers running in clusters that are, let's say, 1,000 servers at trough,
they could be up to 2,000 or 3,000 servers at peak.
Not all of our systems auto-scale, of course.
It doesn't always make sense, depending on the kind of traffic load you've got.
But we bring up thousands of servers every day to deal with traffic.
And then when traffic goes away, those servers go away as well, which is why the typical sort of half-life of an AWS instance for us is measured in the two- to three-day range.
That's amazing.
So after two or three days, it's likely that it was the one selected when you sort of downgraded your size for that trough.
Yeah.
Now, there are, of course, a bunch of systems like our Cassandra systems that are more stateful.
And that means that they don't auto-scale and they have a much easier time if we don't randomly sort of recycle their instances.
But our front-end systems, the systems that deal with direct customer traffic, are stateless.
And there's a whole bunch of them that come up all the time and a whole bunch of them that go away all the time.
Yeah.
That makes sense.
Can you talk a little bit about the architecture?
Is this something you know about?
Are you using lots of microservices?
Are you using containers?
Can you speak to any of that?
I can.
So we have not yet started looking.
Well, we have not yet started deploying containers across our environment.
We use a baked AMI approach to deal with microservice deployments.
We are a classic microservice, service-oriented architecture environment without a centralized service bus.
Last I looked, and unfortunately, I'm not VPN right now, so I can't confirm the number.
We had more than about 1,200 or so services in our production environment.
Wow.
1,200 distinct services, not instances of the servers running those services, right?
Exactly, yes.
So obviously, some of those services might have thousands of instances running.
Some of those services may only have two or three instances running.
How do you guys manage, like, hey, there's this functionality that exists, so as this other service, don't go write your own, and just sort of keep people knowledgeable in discovering these things at that scale?
Yeah, so that's an interesting question.
It comes down to a company culture.
We try to be as agile with a lowercase a as possible and decentralized as possible, which means we don't want to sort of shunt people through some sort of centralized approval or, you know, information distribution system.
And that means that, in fact, it is a little harder to make sure that if you need to get something done, that you'll know if anybody else has done it.
We count on a lot of informal communication between teams.
We count on the fact that we're all geographically co-located.
So every engineer at Netflix working on our cloud ecosystem is either working in the building I work in or the building to my left or the building to my right.
Right.
Is that Los Gatos, California?
Yeah, yeah.
And then we basically try to make it so if you know that you need something, ideally and hopefully before you start building it, you might at least know who else to ask who might know whether or not somebody else has already built it.
And sometimes we will just have duplication.
And, you know, we tend to hire people who are reasonable enough about this kind of stuff that they're not going to become overly invested in their own solution rather than the right solution.
So when we find duplication, then the people who own the duplicating code or function can sit together and figure out, well, what do we want to do with this now?
Right. Try to narrow it down to just one, maybe bring the features everybody needed into that one service, right?
Potentially, or have a better understanding of why you need two.
So I think, because I've been in a bunch of these conversations, when that happens, really the goal is to either understand why you should have two, and that will help you clarify what these two things do differently from each other.
Or decide, no, that doesn't really make sense, so we'll just have one.
That makes a lot of sense, and it seems like a wonderful place to work if you can just go out and have a lot of freedom and it's not very top-down.
That's great.
Yeah, and actually, I mean, that ends up being really relevant to this whole conversation about Python, because when I started using Python in the engineering side of the house at Netflix, at the time there wasn't really a lot of appetite for Python in engineering.
I think it felt like I was the first one proposing to build production services with Python.
And my boss, frankly, really didn't like this.
I think my boss would have much preferred that I spend the two or three months to learn Java, because we had basically everything else writing in Java.
And we had a whole bunch of infrastructure libraries making it really easy for Java developers to run in the Netflix cloud ecosystem.
And, you know, every week or two, I'd be sitting down with my boss, giving him an update on how my project was going.
And maybe about every other one of those conversations, he'd say, so you really think Python's the right way to do this?
And I'd say, yes, yes, yes.
And, you know, because of the way we tend to think about where the engineering decisions need to be made at Netflix, namely in engineers, he let me sort of run with it and gave me all the rope I needed to, in this case, validate that that was a good idea.
It's really cool when you can bring a new idea and actually show, hey, this is not a bad idea and see how it works.
And I think one of the best ways to prove that is not to have a meeting, but to just build something that works and say, look what I did.
Look how great this is and how easy this is.
And we can do more of this.
And I think, you know, in programming, a lot of times the best way to show something works is to just do it and look back on it, you know?
Yeah, the best way to show something works is to show something works.
Yeah, show something working, right?
Exactly.
One of the things that seems like you guys are really into is open source at Netflix.
You've got a lot of cool stuff you're doing.
You seem to be open sourcing these libraries.
Can you talk about some of the more popular ones?
Sure.
I think we've gotten a lot of interest out of the RxJava work that we're actually doing, which, of course, is not so much Python.
But our data science side, which is a big fan of Python, has open sourced a bunch of work using Python.
One thing that we haven't yet open source that we've talked about and we'd like to open source as soon as possible, actually, is something that my team has been doing over the last year or so, which is a RESTful service to do anomaly and outlier detection.
And that RESTful service uses a whole bunch of scikit-learn and Panda algorithms to help us drive automated operational decisions.
My real-time analytics engineers are big fans of Python in that space.
One of them is, in fact, speaking about it right now.
Wow.
Where's that?
Kukon, New York.
Okay.
Fantastic.
Yeah.
We've got another tutorial coming up in PyData in Seattle.
So we'd love to actually share all of that code with the community as soon as we will have some time to breathe and get that done.
Wow.
Amazing.
So you guys are using scikit-learn and machine learning to monitor some of these cloud instances and services.
Yeah, but not just cloud instances and services, right?
Cloud services and instances, to some degree, are the smallest domain of data that we have.
It's, to some degree, the most public and visible one.
But if you think about it, we have millions of pieces of content, right?
You know, millions of TV shows and movies.
And each of them is encoded into a whole bunch of different formats and a bunch of different bit rates.
We can't set some sort of artificial static thresholds for what it looks like for any one of them to be successful.
So you have to really learn in production what the expected sort of viewing rate for any one of these pieces of content, if you want to be able to notice when one of them is sort of going wrong.
Same thing about devices.
You know, there are millions of devices spread across thousands of device families, thousands of device models.
So we can't monitor any one of them sort of manually.
We have to sort of deduce what the right behavior is in real time so we can notice when one of them starts going wrong.
That's really cool.
Just the scale is so big that trying to individually test them all, you probably, by the time you got through the whole list, you'd have to start back at the beginning because they all have new versions and new settings and so on, right?
So just build a system that watches it, huh?
Yeah, exactly.
And can deduce correctness from, you know, the historical patterns.
I wonder how many organizations are actually applying machine learning to the monitoring of their software.
And this thing you're going to open source?
Yeah, we'd like to.
Will it have a name?
Well, yes.
Everything has a name.
Yeah.
Sorry, do you know the name that you're planning to give it so people would know and to look for it?
This episode is brought to you by Hired.
Hired is a two-sided, curated marketplace that connects the world's knowledge workers to the best opportunities.
Each offer you receive has salary and equity presented right up front, and you can view the offers to accept or reject them before you even talk to the company.
Typically, candidates receive five or more offers in just the first week, and there are no obligations ever.
Sounds pretty awesome, doesn't it?
Well, did I mention there's a signing bonus?
Everyone who accepts a job from Hired gets a $2,000 signing bonus.
And as Talk Python listeners, it gets way sweeter.
Use the link Hired.com slash Talk Python to me, and Hired will double the signing bonus to $4,000.
Opportunities knocking.
Visit Hired.com slash Talk Python to me and answer the call.
You know, there's a time-honored tradition at Netflix that if you're a developer working on a product,
you get to name that product when we open source it.
And I haven't actually asked the developers whether or not they've picked a name for the open source product.
We have an internal name for it, which is Kepler, but I'm not sure that it'll end up being the public name for it.
Okay.
Wow.
Excellent.
So you have some other things that are kind of related.
One of the things I read about when you wrote your blog was that you have a large number of alerts that get sent for various reasons.
And you have this whole central alert gateway thing that's written in Python.
Well, yes and no.
So this is actually, this is perhaps maybe the bad news from a Python perspective.
When I came over to engineering in 2011, I wrote a bunch of really useful stuff.
One of them was the central alert gateway.
Another thing was Holler Monkey and Security Monkey.
The interesting thing that's happened over time is back in 2013, I became a manager, which means I pretty much get paid not to code.
Exactly.
And so some of the stuff that I wrote that we haven't publicly talked about ended up not being kind of a bust.
You know, one of the things that we try to do is we take a bunch of bets, we try to minimize the cost of the bets, and some of them will go great, some of them will not go great, and we'll just kill them quickly.
Yeah, but the key to be successful is experimenting, right?
Yeah, exactly.
So the central alert gateway was highly successful.
Incredibly useful.
It is at the core of knowing that something's gone wrong in our environment, and we have a long-term commitment to it.
However, it turned out that after doing maybe about two years of sort of organic iterative development on it, it really needed a refresh.
And it also needed ownership by software developers who were being paid to be software developers.
And so it ended up moving over to my team formally, and the developer who's responsible for it ended up reimplementing it in Scala.
Okay.
So the CAG these days is no longer Python-based.
I think I still, in my spare time, still maintain a client in Python, so you can talk to the CAG directly.
But the same thing, frankly, happened with SecurityMonkey and HowlerMonkey as they moved into other groups.
Those other groups made their own decisions as to how to keep them organized.
I think maybe to some degree you could argue that this is a nice example of how, personally, I was able to use Python to very rapidly iterate over what needed to be done.
And then once it reached a stable point, then, I mean, frankly, I don't know that the language mattered all that much.
And the developer who preferred to use Scala ended up re-implementing it in Scala.
Sure.
And that's part of that developer freedom that you guys talked about, which we can come back to again.
I think it's easy to, well, it could be easy to look at this and go, oh, well, they tried it in Python and it failed.
But I think that's exactly the wrong message to take from it.
Like you were saying, it's almost the success of Python is this thing came into existence.
It was written well and quickly.
And then it's evolved since then.
But, you know, the reason it's here is because it was easy to do this in Python to get started.
Yeah.
And again, it wasn't like the company made a decision that it wasn't going to be in Python, frankly, because the company doesn't make those sort of decisions.
The company made a decision that it was really worth investing in and having as a prime sort of first class member of our ecosystem.
And then the company knows that developers make the best sort of the best decisions when it comes to this sort of like engineering and implementation kind of decision.
And so we didn't really have an investment in having it be in any in any given language.
And the developer who ended up doing it decided to do it in the language that she was most comfortable with.
Right.
And that makes sense as well.
You don't want to force somebody to write a language they're not familiar with and you're not going to end up with this good of a product.
So one of the things I think Netflix is really known for, besides the 35% bandwidth story and, you know, huge AWS usage and things like that, is data driven sort of decisions and that type of stuff.
Yes, especially and I would say mostly for our public product.
So can you talk a little bit about how you guys are using data science there, maybe some of the tools like IPython or things like that if you're using them?
Sure.
We're big fans of IPython.
And boy, howdy, can I tell you, I think it was two years ago that I did PyCon.
Yeah, I think it was PyCon 2013 when I discovered the IPython notebook.
But I feel like my life's never been the same since then because that thing is just glorious.
Yeah, it really is amazing.
Yeah.
And in fact, we use an IPython notebook now as the format for our take-home tech assignment for candidates for the real-time analytics group under me.
But that's neither here nor there.
So largely, when you look at data science driving product decisions, we're big fans of A-B tests.
And should I define A-B tests or is that relative?
Yeah, sure.
Go ahead.
Not everyone's sort of front-end customer-facing folks, maybe.
Yeah, so basically, if you think about it, you know, you've got a bunch of customers who use your product and you're thinking about whether or not a given feature might be useful.
And first of all, you've got to define what useful means.
What is it that you're trying to actually change?
You need to have a good enough understanding of your product that you can basically tie everything into some sort of key performance indicator, KPI.
And then you actually implement the feature and you subject part of your customer population to a test where some people see the original behavior, some people see the new behavior, and you see whether or not there's a difference in the KPI between those two groups.
Now, I'm massively simplifying this because in our environment, for example, any given A-B test might have upwards of a dozen or so different potential functions or, sorry, different test cells.
And, of course, we don't just run one A-B test.
I could be subject to, I think the last time I looked as a Netflix customer, I was randomly allocated to something like either 12 or 15 or so different A-B tests.
So, that's really cool.
How might those show up?
Would that be like what's in the recommendations or maybe other parts of the UI?
Yeah, it can be a whole bunch of different things.
So, you know, it can come down to, for example, what image do we show you for a given movie?
So, for example, if you look at Orange is the New Black, there's a little, you know, picture that we show you for the Orange is the New Black movie.
Well, does one picture actually get people to want to watch that more than another picture?
One easy way to look at it is to, you know, basically divide your customers into a bunch of different groups and show each of them a different picture and then actually see if one of those pictures ended up resulting in more click-through rates, right?
So, that's a relatively trivial, small difference.
You can look at bigger things, like, for example, at what order do we show you recommendations?
What language we may use?
And in some cases, complete overhauls of the UI.
So, I saw an article recently that suggested that sometime in June, we're going to completely overhaul the computer-based UI to make it sort of much sort of niftier and, you know, prettier.
And that's a complete overhaul that obviously would have been tested on a small group first to see if it actually causes people to engage with us more or less.
Right.
And you only choose the ones that make them engage with you more, of course.
Well, ideally, or at least, you know, assuming that that's the KPI that we wanted to actually affect, right?
So, again, this all comes down to what am I actually trying to accomplish with this particular feature?
Sure.
I saw, I think it was an article in Wired, and I'll put the link in the show notes, that some of the guys, it was from a Hadoop conference.
They were looking at the different things you can change in A-B test, and they were actually looking at the color spectrum of the image and comparing those across other movies that may be more popular or less popular.
And it sounds like there's a lot of dimensions that you guys look at.
Oh, my gosh, yes.
But the beautiful thing is, if you've already built essentially the infrastructure to do A-B tests relatively cheaply, then that means that you open the door to doing a lot more experimentation.
And you don't need to necessarily have a conjecture that you're going to significantly move the needle.
So, it's all about cost-benefit analysis, right?
And if you think about it, if it costs you a lot to try a test, then, boy howdy, you've got to conjecture that that test is really going to change some KPI significantly.
But if implementing A-B tests is relatively inexpensive and can be thought of as almost free, then you can be a lot more experimental than you would be otherwise.
Which is why, by the way, for example, the group responsible for building our A-B test infrastructure is not called the A-B test group.
They're called the experimentation platform group.
Because this is really how you enable cheap and easy experimentation.
Yeah, and you have so many users that you get very easily statistically significant data, right?
Yeah.
That does make it easier.
Very, very cool.
One of the things that I heard that really intrigued me about the architecture and things you guys do is this thing called the Chaos Monkey.
And it's been around for a while, but can you talk about that?
Sure.
Chaos Monkey is a relatively proven concept.
We started doing this as we went into the cloud maybe about four years ago or thereabouts.
And the idea is that given that servers will die, you know, this is a fact.
This is true in every environment I've ever seen, whether you're in the cloud or not.
Your servers will die.
And trying to avoid it or deny it does not lead to, you know, happiness or more robust systems.
So let's try to actually make sure that our systems are resilient to server death.
And so we built this small component that we ended up calling Chaos Monkey that goes around every day and kills one of your servers for every application group that we have.
So we talked about those 1,200.
And this is in production, right?
Oh, yeah.
That's the only, that's, I would argue, the most useful way to have Chaos Monkey run.
Amazing.
Okay.
Keep going.
Sorry.
Yeah.
So basically, you know, if you think about those 1,200 applications running in production, we kill at least one server out of each of these applications because they're running on multiple servers every day to make sure that we don't have a problem when that happens.
So when people start building their service, they have to, from the very beginning, plan for the fact that these machines are going to die, which is reality, right?
But it's really neat that you've put this system together to test it.
And that's pretty leading edge, I think.
But what I think really takes it to the next level is you leave it running in production.
That's amazing.
Yeah.
And, you know, the interesting thing is it feels leading edge when you're outside of this environment and it feels leading edge when you start doing it.
But, you know, off the top of my head, I don't think Chaos Monkey has actually exposed a problem for us in the last, I want to say, three years.
And that's perfect, right?
Because that's exactly what it's there for.
And it's a verification that despite the fact that we kill thousands of instances every day as part of Chaos Monkey, we've gotten to the point where it's pretty much normal for us that we can lose a server without any noticeable impact.
Yeah.
That's excellent.
I mean, you really need to make sure the service doesn't go down.
And I can't remember the last time that Netflix wasn't available and it was your fault.
You may remember.
Yes.
So one of the fun parts about being involved in every major incident postmortem at Netflix is that I do, in fact, get to be aware of every glitch in the system and every significant outage.
It's worth noting that, thankfully for us, the definition of significant outage is probably bigger than for our customers.
Sorry, it's actually smaller than for our customers.
We tend to think of problems being significant below the level at which they would likely be noticeable to most of our customers.
Right.
Exactly.
Maybe these machines are using too much CPU or the latency is too high or something like that.
Is that a possibility?
Not so much because we tend to think about production impact purely based on whether or not customers are impacted.
The threshold for us, for example, for major production incidents is whether or not 10% or more of our customers are impacted.
That's a really big deal for us.
It happens not that often, but it still happens every once in a while.
But it does mean that, for example, if 10% of our customers are impacted, the good news is that 90% of them aren't.
Yeah, sure.
It's just 10% is really high.
Yeah.
And it's been a really long time.
And in fact, I can't exactly remember off the top of my head when we've seen 100% service impact.
When that graph of actual current usage of Netflix goes to zero.
So I can see how you build your systems and your services so they can take this.
But you're built on multiple data centers spanning AWS cloud availability zones and all that kind of stuff.
So you also need to be able to deal with if AWS goes down.
Yes, in theory, we need to be able to do that.
And I think we've built a pretty good environment because of that.
So, for example, in the US, we run out of two major regions in AWS, US West 2 and US East 1.
And we can fail over between those two regions so we can evacuate a region.
And we do that, I think, basically right now, at least once a month or thereabouts to validate that all that mechanism still works.
The good news is that, frankly, AWS, to the best of my recollection, hasn't had a significant regional outage in a reasonably long time.
Now, you know, watch them have one right now because of that.
Watch what you say.
No, of course.
I agree.
They are absolutely rock solid.
And, you know, I think they're the best place in the world to be, including your own data center, right?
Because those things go down, too.
And then that's your problem.
Yeah, I've been there before.
I've spent most of my life in data centers.
But, you know, going back to Chaos Monkey for a second, there's a point that's worth making, which is we didn't so much build Chaos Monkey because AWS wasn't reliable enough.
We built Chaos Monkey because AWS was too reliable.
What I mean by that is if AWS was causing us to lose machines, for example, on a daily basis, then they would have already given us the requirement that, you know, we needed to be resilient to that.
Everybody running in our environment would have known that they need to build that way because they would have lost machines just by the natural sort of unreliability of AWS.
But AWS's reliability, even down to the machine level, is actually high enough that we needed to simulate machine failures because we wanted it to happen at the rate we wanted it to happen.
Right.
It almost never happens.
So how do you prepare for it?
Right.
Exactly.
It's amazing.
So you guys built a tool that's related to Chaos Monkey called Chaos Gorilla.
Yes, exactly.
We've sort of taken the Simian Army motif and we've run with it.
So we actually have Chaos Monkey, Chaos Gorilla, and Chaos Kong.
Believe it or not, Chaos Monkey is about simulating a single machine failure, as I mentioned.
Chaos Gorilla was something we built to allow us to evacuate availability zones within a region.
So should we briefly talk about regions versus availability zones within AWS?
Yeah, absolutely.
Sure.
So an Amazon region is a geographical location that actually can contain multiple availability zones.
An availability zone can be thought of as, let's say, for example, a data center.
And a region might contain several data centers that are pretty close to each other.
And so we wanted to be able to tolerate a single machine failure or a single availability zone failure within a region.
And then we built Chaos Kong to be able to tolerate the loss of a region.
Lately, I think we found that we've gotten good enough at evacuating regions that if a single AZ within a given region is going to fail,
we would probably prioritize just leaving that region temporarily rather than trying to rebalance within that region.
So we practice regional evacuation and regional rebalancing pretty regularly, at least once a month with no adverse effects.
And every time we don't so much look at whether or not we've impacted our customers anymore because we really don't,
but rather how quickly were we able to affect an impact-free evacuation.
That's really amazing that you guys built that.
That's great.
So keeping on the monkey theme, you guys also have Security Monkey and Howler Monkey.
Yeah.
Because everybody loves monkeys.
Yes.
So Security Monkey and Howler Monkey were both written by me.
Actually, I would say Howler Monkey was the first project I wrote when I moved over to engineering from IT at Netflix.
And at the time, we were trying to solve a problem where basically, you know, we have dozens of SSL certificates spread around different parts of our environment.
And when those certificates expire, as they are wont to do, you end up with a production event.
And so we built a system to automatically discover certificates and alert us when they're getting close to expiration.
That ended up being at the heart of Security Monkey.
And separately from that, what we were finding at the time was that we were growing at fast enough rates that we kept running into the limits imposed on us by Amazon.
Amazon, as a cloud environment, is infinitely scalable.
But they need to protect themselves.
So there are essentially logical limits to the resources you use.
For example, the number of autoscaling groups that you might be able to provision or the number of instances you might be able to provision.
At the time, we were increasing our footprint fast enough that we kept running into those limits.
And then we couldn't get any more until we asked them to increase them.
And traditionally, of course, that would happen on Friday at about 5 o'clock in the afternoon.
And that would spoil somebody's Friday evening.
And so we built something that allowed us to monitor our usage compared to limits.
And allowed us to alert ourselves when we get pretty close, around 80%, so we can talk to Amazon about increasing our thresholds.
You guys must have a special relationship with AWS.
Yeah, you know, we're big fans of AWS.
AWS seems to be big fans of us, and we talk a whole lot.
Yeah, I'm sure that you guys are actually a topic of conversation in their engineering group fairly often.
That's cool.
Nice.
So one of the phrases or quotes I saw from your blog post was you said something to the effect of,
we found a formal change control system didn't work well within our culture of freedom and responsibility.
That sounds really cool.
And so you created this thing called Kronos.
What's this culture of freedom and responsibility?
Netflix has done a lot of work to formally define the kind of culture it likes to have internally.
So we have a culture slide deck.
It's now publicly available on SlideShare.
You know, I think Googling for Netflix culture will find it within the first few links.
If you look at how we think we're going to be successful as a company, it's really about decentralizing and maximizing speed of innovation.
And if you want to maximize the speed of innovation, we believe that the best way to do that is to hire a bunch of people and to make it so innovation can happen to the lowest, most spread out parts of the organization without the need for coupling between somebody who wants to do something and a whole bunch of other people just for sort of approval.
Which means that we have a culture that emphasizes freedom, but also means that for that you get responsibility for your actions.
And examples of freedom mean, for example, that we don't have approvals on purchases.
And I'll say that again, because it can kind of sound a little crazy.
There are no actual approval processes for making a hardware purchase.
Yeah.
As another example, let's talk about expenses.
Netflix's expense policy is very robustly documented.
It is act in Netflix's best interests.
That sentence, there you go, is the entirety of our expense policy.
And what that ends up meaning in reality is that, for example, when I submit an expense, there's no approval for that expense.
It'll get automatically paid.
And then at the end of the month, my manager will get a list of expenses that were automatically paid within her or his organization.
Sure.
And long as you're behaving good for Netflix, it's all good, right?
If you take some client or somebody out to dinner and you think it's good for Netflix, then it's all right, huh?
Right.
Exactly.
So that also means that from an engineering perspective, engineers actually get to decide what's the right thing for Netflix, both in terms of how they solve problems and when, for example, they might push to production.
Now, it turned out that that ended up being wrong because as soon as I built a bunch of infrastructure libraries in Python for working in the cloud, I started getting a bunch of people contacting me informally and going, hey, I heard you have this thing that would allow me to do Python more easily.
So that turned out to have enabled, I think, a lot of other people in Netflix to use Python.
But from the change perspective, in a typical environment, and I've worked in a bunch of them, if a developer wants to do something in production, they have to submit a change control ticket, which will then end up getting approved by somebody.
It's not very consistent with our culture.
And having worked in a bunch of other organizations that do that, I don't think it's particularly useful anyway.
So we don't do that.
Right.
It makes people feel like they have control, but it doesn't really help that much.
Yeah.
I mean, I think what happens is basically the people who are kind of far away from that change end up having to approve it, but they don't actually know what that actually means.
It's not like they're actually being any more responsible for it.
And typically what happens is when a change ends up not having been the right thing, then the company will react by saying, well, now you need a director to approve this kind of change, or you need a VP to approve this kind of change.
Moving the locus of control over the decision further and further away from the people who are most qualified to make the decision.
Yeah, that's a really good point.
The more approval it needs, the less likely that person is able to actually understand what they're approving.
That's very interesting.
Yeah.
And the other thing is it actually takes away from your responsibility.
So if you're a developer and you want to deploy at five o'clock in the afternoon on a Friday, for example, which is kind of prime time for us, and generally speaking, to be perfectly honest, you know, I don't do that.
My team, generally speaking, doesn't do that unless we have a very good reason to.
Then if you can basically submit a change control ticket and say, well, you know, my boss or my director approved it, so it's okay.
It means you're not actually practicing a whole lot of responsible thinking as to whether or not this is a good idea right now.
So putting it entirely in your hands means you have complete freedom to do what you think is right, but also means you have the responsibility to make the best decision.
That's great.
I think a lot of the best engineers really and developers really, you know, value that freedom and responsibility.
So I think it's great.
Yeah, it's worked reasonably well for us.
Cool.
So Python 2 or Python 3, Netflix?
Right now, my impression is, and remember, we're not exactly a very standards-driven company.
There's no, you know, overall board that says this is how thou shalt use Python and Netflix.
My impression is that generally speaking, we seem to be using Python 2 across the board.
I don't know anybody using anything older than 2.7, thankfully.
And I suspect that in the next year, we'll see Python 3 increasing in its coverage.
Okay, great.
I also saw that you guys sponsored PyCon this year.
That's great.
Thanks for that.
Did you do any presentations or Netflix as a group do Python presentations?
Boy, how do you know?
I got to tell you, I don't know off the top of my head whether or not Netflix did any presentations.
This is the first year, I think, in about three years that I didn't attend PyCon, despite the fact that PyCon, I think, is one of my favorite conferences, only because Montreal was a little far to go for PyCon for me.
Yeah, well, you can go a little bit north next year.
Where is it next year?
It's in Portland, my hometown.
Oh, well, perfect.
I mean, I'm going to Portland next week, so I'm a big fan.
Excellent.
So I'll go look through some of the older ones, see if I can pull up something.
So you guys have a lot of developers and a lot of cool stuff going on.
Are you hiring people right now?
If people are listening, are there interesting areas that they should maybe think about?
Are we hiring people right now?
Maybe one day the answer to that will be no.
But I don't suspect that's going to happen anytime in the next few years.
We are very actively hiring people right now.
The only thing I wish is when I looked at jobs.netflix.com, there was some sort of counter that allowed me to see how many open positions there are.
But there's a whole bunch of them.
Excellent.
Okay, so jobs.netflix.com.
People can check that out if they're interested.
Very cool.
Yeah.
And I'll say this.
There's a bunch of jobs that might actually call for Python experience, a bunch of jobs that might not.
Two things I would say.
One, I know a whole bunch of areas within Netflix where Python is heavily used, both in terms of analytics.
So, for example, my real-time analytics group is big fans of Python.
But also in terms of sort of infrastructure management and development.
So, our Cassandra operations people are big fans of Python as well as some of our big data platform people.
And the other thing is that if you're not actually married to continuing to use Python, there's a whole bunch of other positions at Netflix that want great engineers irrespective of your language.
We've come to believe that hiring for the language is less valuable to us than hiring for the aptitude.
That's one of the things that I like about the way we think about hiring compared to a lot of other companies.
We tend to hire great engineers and then have them use the right language.
Excellent.
Yeah, so I'm sure a lot of people are excited to hear that.
That's cool.
A few questions I always ask on the way out the door is, first of all, what's your favorite editor?
So, right now, after many, many, many years, I have switched.
And I'm not sure if it's going to be a permanent switch, but I've switched to Atom from GitHub.
Oh, yeah.
Atom is pretty nice.
Yeah.
I tried Sublime for a while and it was okay, but it wasn't sticky.
I kept coming back to Vim every once in a while.
And then I haven't tried anything heavier than Sublime or Atom, like, you know, any of the sort of PyCharm or all of that stuff.
Exactly.
Okay, cool.
I know Sublime is very popular within Netflix from my exposure that I've had.
So, that's cool.
Yeah, Atom is nice.
It looks really good.
How about some cool package on PyPI that people should know about?
Well, I mean, technically, IPython Notebook is on PyPy, right?
It is, yeah.
And I would say, if there was one, well, actually, so for editing and for authoring and for experimentation, IPython Notebook beats everything else out there for me.
For actually getting work done, oh, boy, howdy, requests.
Yes.
Requests, requests, requests.
Yeah, requests is the most popular Python package, period.
It's been downloaded an insane amount of times.
And we had, on show six, we had Kenneth Wrights here to talk about it.
That was very cool.
Yeah, I mean, you know, at some point, I wonder why, you know, at some point, will it just go back, go into the core?
You know, actually, Kenneth talked about that.
He was at the language summit there at the last PyCon, and they talked a lot about that, specifically, will requests become part of the standard library?
And they decided no, because they would like to release changes to requests on a more high-speed pace than the actual Python itself.
So there was actually quite a bit of discussion.
I think that that was what their decision was.
But they said it's going to become the official recommended way to do HTTP within Python, like, instead of URL lib2 or things like that, within the documentation.
All right.
Very cool.
So that's definitely a popular one.
That's great.
Yeah, IPython and requests.
People should check those out.
That's great.
Roy, any final shout-out you want to give?
Anything you want to bring the listeners' attention to?
You know, Monitorama is happening in Portland next week.
Okay.
So anybody should check out the presentations coming out of them if they have any interest in monitoring or operational insight.
I'm going to be at the conference for the first time.
I'm very excited about that.
There's a whole bunch of really interesting people who are much smarter than me presenting and attending.
Check that out.
I can't think of anything else off the top of my head.
All right.
This has been such a great show.
I really enjoyed the conversation, and I learned a lot.
Thanks for being here, Roy.
It's been my pleasure.
Thanks, Michael.
Yeah.
Bye.
This has been another episode of Talk Python to Me.
Today's guest was Roy Rapoport, and this episode has been sponsored by CodeChip and Hired.
Thanks, guys, for supporting the show.
Check out CodeChip at CodeChip.com and thank them on Twitter via at CodeChip.
Don't forget the discount code for listeners.
It's easy.
Talk Python, all caps, no spaces.
Hired wants to help you find your next big thing.
Visit Hired.com slash Talk Python to me and get five or more offers with salary and equity presented right up front and a special listener signing bonus of $4,000.
Speaking of jobs, remember that Netflix is hiring.
If what you heard on this show sounds amazing and you're able to work from Los Gatos, California, check out jobs.netflix.com.
You can find the links from the show at talkpythoninv.com slash episodes slash show slash 16.
Also, be sure to subscribe to the show.
Open your favorite podcatcher and search for Python.
We should be right there at the top.
You'll also find the iTunes and direct RSS feeds in the footer of the website.
Our theme music is Developers, Developers, Developers by Corey Smith, who goes by Smix.
You can hear the entire song on our website.
This is your host, Michael Kennedy.
Thanks for listening.
Smix, take us out of here.
developers, developers, developers, developers, developers, developers, developers, developers.