Devreal

Reactive.community: Alexy Khrabrov interviews Ben Christensen

Reactive.community: Alexy Khrabrov interviews Ben Christensen

Recording: Reactive.community: Alexy Khrabrov interviews Ben Christensen

let me know what your prom sound good okay sounds good alright however only okay welcome everybody I'm Alexa crab Roe the organizer of reactive systems meet up it's a new meetup about everything explained in reactive manifest everything about observable so there's a whole like a system of reactive systems and today we have a vast bankers and soon he's a software engineer at Netflix a kiss greater forex Java and a lot of applications working with this we're happy to have you been thank you thank you for having me so so you are on h systems team at Atlas can you tell us a little bit about what the team is doing how the whole reactive stack came to be sure so the edge systems team in netflix is responsible for its the the layer of server-side systems that faces the internet so all the incoming traffic from devices from the user interfaces and clients that you play playback movies and TV shows on with netflix they come in through that layer and so it's the routing and public api s and the hosting of all the endpoints for all basically all the functionality for netflix so i'm involved in the architecture and platform and infrastructure of those teams started those systems there it's made up of a few different teams and also the operations of it okay and can it tell us a little bit for folks who don't know what they're active systems are and how networks became kind of a good use case for reactive systems sure so reactive systems in a more p in pure sense or ones that as their name implies react to data and events as they occur rather than imperative lee telling it what to do at any given point in time and in practice that there's a broad spectrum of what that means is you apply it the reason why it became interesting to us is a few years ago we were to optimize the performance in our systems we realize that we needed to adopt concurrency primarily for i 0 for concurrent execution of various different network requests to compose together the back-end systems in the primary driving factor for that is that we were trying to move our device traffic patterns to be more coarse grained so they would fetch more data all at once and we didn't want to make that I'll be sequential and increase the user latency and so while adopting while pursuing a more concurrent approach to implementing our web service endpoints we decided that asynchrony is where we needed to go and to do that we looked at how we could have an abstraction for composing those that wasn't just callbacks and that led us to the reactive model and over the years we've matured a lot in our thinking and our execution of that so how much of Netflix is now using your reactive stack it depends on if they if you talk about that as knowingly or unknowingly so unknowingly it's actually running all over the place because it's for example hysterics which is our fault tolerance layer bulk adding layer is now all implemented using the reactive patterns and that's used throughout the company but most of the the teams still don't actually program in a reactive manner most of the middle tier systems that they existed long before we chose to start adopting and the migration path from the imperative style to the reactive style is a non-trivial one and the majority of teams have not decided that it is worth their purse than making those changes however at the edge systems layer we if you were to split our code base in half into two horizontal layers the bottom half is still very much imperative and pull based because of for legacy reasons but then we layered everything on top is fully reactive solver ap is our reactive and then the next layer down of our the devices and clients they also the majority of them also use reactive patterns in JavaScript in how they interact with us through the web services okay okay so it's a multilingual kind of them yeah so we use the reactive patterns in Java groovy and JavaScript so I noticed you guys are basically you know very consistently improving our X Java like a system so we had them it up a couple years ago two subscales Rackspace and since then basically succeeded in kind of you know moving this technology through organization which is a no mean feat like network is a big company we know company is kind of not you know the commercials the gross I'm just very curious how did you manage right introduced this complex technology to kind of evangelize it get a lot of people use it what are kind of ingredients that the success of this like what are the some tricks you kind of what happens which enabled you to move this technology through the company well for one thing we never attempted to force it down anyone's throat and that's why even to this day it's not every team that's using it so the important factor is that we we applied it where we felt it was needed we demonstrated the success we were having and we talked about it and then other teams either said that's interesting but we don't really need to to adopt that or some other team said that's great and they start to adopt it all on their own and to make that so that it scaled we invested quite a bit in documentation and tutorials on such things in fact the very thing that made it a successful open source project is what helped us with the the team's internally who wanted to adopt it and use it because in effect we actually treated them the same as anyone else where here's the documentation eat here's how it works here's where the artifacts live and how you pull it into your code base mm-hmm and then the the other way is just internal training we spend a lot of time on making sure that we provided in the early days not so much any longer but in the early days we would have work like internal workshops and tutorials and sessions like that I remember you invested in documentation a lot yeah in the lead did you hire a technical writer yes we do this yeah in fact he we still have him so three years later he's still working with us and in fact if you're gonna do an open source projects the way to do it we commit code yes he comes through and fixes all of our bad english and finishes flushing it out and it makes a huge difference so you have a guitar poof bicycling for the technical rider to come in that's how it feels like yes yes so he's got commit privileges and so he just sweeps through takes care of the javadocs diagrams and the wiki pages on the website content this is great so this is I think this is awesome like this is an awesome tip that if you kind of invest in educational materials yes people are gonna people get not kind of yeah the coding of itself you can have great code but it's not accessible usable understandable if you don't have all that stuff it might as well not exist as far as most people are concerned how much of external teams do you see kind of picking this up and how many kind of question do you see from or non Netflix people implementing this tag actually far more external than internal it's especially been large in the android community mm-hmm so in the android community like there's a lot of very big brand names that the people would recognize who use it in their in their applications and just as you know as examples the github project we've had well over a hundred contributors who've committed code to it there's dozens of people who have written blog posts and spoken at conferences without any instigation from our Park mm-hmm it's got thousands of stars and so like all of that it then led a vibrant community on stackoverflow and on the mailing list github issues and all that stuff so it's actually become a pretty vibrant community so the local how do you manage to support all this all I say I ask for people's help because I'm only one person there's really so much I can do and so it's very community driven in answering each other's questions and so I weigh in when I when I can or when I see something bubble up and keep can becoming something that needs a little more attention but in general over the built in the the first year is very much me driving it a lot in the last year and a half ish it's very much community-driven now and in fact in the last six months far more of the commits the the code is coming from the community than it is from myself or anyone at Netflix I still check it out still by far the lead commits are you know on version 2.x which is happening David Carnac he basically just ported everything in like three weeks so on the 2x per inch he will far and away be the lead yes the main is still the production worthy one where we're working on version 2 and so if you flip over to that and take a look at its committer it's it's all david car dock we're going to check it up yeah well so i think my last question will be kind of this is a very interesting evolving area in obviously there is a lot of information so if somebody wants to kind of play with this right should we just head to our exam repository are there kind of starter projects they're like what's a good entry point for newbies school kind of want to check out the reactive systems so actually there is a project written by jophur Hussein who is actually the one who introduced me to reactive programming and it's done in JavaScript so it's very easy to get started with you can do it right in a browser and it's at the github com / reactive x / learn RX i believe and it basically is a walkthrough in progressing difficulty and it's a great way to step into it and it starts actually teaching you how to do function composition over iterable synchronously verbals and then starts to flip you into showing how and all of a sudden becomes a sink and into our duels of each other and so instead of trying to teach you both function composition in a sink running at the same time it starts with function composition get too used to things like map and flat map and stuff and then all of a sudden flips on unit shows you wait a second it's the exact same coding style except all son it just became a sink interesting so actually the that is a very good way of learning the concepts because the concepts that applied to any language you're in mm-hmm on the RX Java side we to show something a little bit more practical for people reactive lab I 0 points to a github repo where it's kind of demonstrates how we typically use our X job at Netflix which is incoming web services that compose multiple back end web services and it's something that you can actually launch on your laptop it's got like eight microservices running hmm and shows all the i/o between them and composition so reactive love do is a good one for the Java side and showing how it fits into more real-world use this is exciting so thank you very much for sharing this we are looking forward to a talk and we are looking forward to kind of following their their ex progress at Netflix thank you that's one you