Point-to-Point Messaging Architecture - The Reactive Endgame

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
thanks for for sticking around with us so you haven't missed the end of the session this morning I'm Stefan Maldini and lead of project reactor at pivotal and I'm Ryland Degnan I'm a CTO at net if I so yeah thanks for coming to this session super excited to be here with Stefan to talk about the reactive endgame our socket and how we envision the future of systems architectures so communication in the cloud is a challenge this is a quote from a recent CMC F conference the network is the unsolved problem of the cloud and open source we need the network to be a first-class citizen of a cloud system so enterprises today are in this transition state from this relatively constrained environment of the data center and sort of well well understood networking model to this wild west of the cloud and it's becoming increasingly apparent that old approaches to networking no longer work in this in this new world and I've experienced this firsthand so prior to metafile I was on the Netflix edge platform team where if you imagine Netflix is a sort of giant hourglass with you know a hundred million users and hundreds of different device types funneling traffic and then fanning out to hundreds upon hundreds of micro services within the backend the system that I operated and owned was sort of in the very center of that hourglass so I've pretty much been first-hand witness to every sort of different ways that distributed systems can go wrong can fail when you get configuration wrong when you get paged at 4:00 a.m. and have to go in to sort of rescue the system from failure and that sort of leads into this this next quote from the same conference a standard approach is needed to sort of connect and communicate all the different pieces in the distributed applications that we that we build today and that idea was sort of the genesis of our socket within Netflix and then in collaboration with Facebook and pivotal this idea that you can define a standard to solve these sort of common problems across your architecture so our socket is an open source application layer network protocol as I said it was developed in collaboration with some of sort of the vanguards of moving to the cloud and from experience sort of everything that can go wrong when you build distributed systems so our socket simplifies communication by providing this common unified API across all different interactions so as you know Steve pointed out in the in the keynote just now our socket is transport agnostic so it gives you a common layer upon upon which to build applications that's underneath which you can switch outs or the transport layer and without making any code changes and more than that our socket was built for modern cloud applications so on top of being transport agnostic our socket provides solutions for these common problems that you encounter again and again when you're building distributed systems so things like session resumption your connection drops had used to resume the state of what was going on fragmentation reassembly so why should he use a different network protocol to transfer gigabytes large files or a tiny you know chunks of JSON and then things like predictive load balancing so that the client engineer doesn't have to solve the same problems again and again so so what characterizes a modern cloud application well as DuPont Estefan did a good job pointing out I think there's sort of three things it's distributed heterogeneous and interactive so gone are the days when we built these sort of monolithic fad web servers and have a thin client this just sort of makes a request reply and consumes the response today's model is much more interactive and it's also much more heterogeneous so it doesn't just exist as this client-server model compute is distributed throughout the entire network of the application and across many different types of clients platforms and languages so some modern applications have to be aware of the differences between things like browsers phones gaming consoles set-top boxes and then all the sort of different back-end infrastructure and topologies that you might want to take advantage of so one way to screw visualize this is this three dimensional axis of complexity which is represent sort of this explosion and complexity that's taken place to them within the last several years one axis being is deployment topology is where your application is deployed and how another being this set of platforms and frameworks that we interact with and the third being the set of protocols and interaction models that have extended far beyond we've read the request reply model of HTTP and now includes the bi-directional streaming interactions so with that I'll hand it over to us to find a talk more yeah so especially we know at people told that the multi-cloud story is a thing we we see more and more hybrid use of different cloud platforms because some cloud platform would provide feature a and B and the other one is going to provide service a and and B different ones you will choose you know according to your business use cases and also we know the story of hybrid cloud between the private deployments and on-premise and also the deployment on public cloud as well so the boundary between you know where your applications see it actually is getting more and more blur so that's technically a challenge and you know we have 10,000 solution networking solution to deal with this this problem there is also the explosion of orchestration platform so a platform a and B as your humanities etc they're going to they're going to do something that will be different and will be on a different set of instances as well they will be separated by a network boundary network boundaries too and it's it's and something complex also on the framework side because you will have you know part of you your entreprise using javascript hopefully a large part of the enterprise using spring because there are same people and some crazy people will use C++ but you know in this world we still have we still have to connect together we still need HTTP in some aspect is pretty nice in giving you know kind of well-defined protocol so we know what to expect from HTTP is just very limited in what it gives you and we have built everything on top of that that's another problem so if we use all of this platform for instance now if you take a step back and see again look at the picture of what kind of interaction we have today okay we have you know classic application from spring for instance having you know HTTP HTTP to requires so request reply typically the most most of the time that's what people are dealing with right now and maybe also driven by the fact that people only use HTTP as well then you have devices and you know IOT and all this kind of use cases devices connecting directly to your back-end so you might use function spring cloud dataflow and sprinkled stream to ingest data from different sources than HTTP so that's another cool thing you know we know already in spring that there is not only HTTP there are author model you wanted to deal with and you will use that for kind of a different interaction you will stream data here and then you have also you know new devices you know games and and you know console engine in that in that case that will interact with back-end servers and you know in that case if it's a game like a physic game engine that will be C++ and the interaction will happen over network with maybe something like your PC and you have this and our PC interaction model then where are you very contract Riven generate stubs and you know you don't really care about you know thinking about how the client interact especially when you're in the game development you you really want to focus on game engine for instance I'm not really on how things communicate over network so there's this kind of interactions and then you know it can go even very crazy between a desktop and mobile application think about facebook chat for instance you are on your phone and you're communicating with friends on the desktop you know slacking at work and they do that in real time transparently they're also you know phone and communicating with console because you know they played the same game it's becoming more and more thing like fortnight for instance and they communicating as well like in a peer-to-peer fashion it's kind of messy and I think that's where you know we we come to we've also get can we really do something about that yeah I think on the face of it this really does present a challenge all the different things that that we want to accomplish in a modern distributed application and it's important to think that there's there's different things you could try to do about it and some will be more successful than others there are some that I would argue that you really can't do anything about and one of them is this deployment topology so you could try to restrict the complexity of that access by imposing some sort of uniformity of infrastructure say you know as a company we're gonna deploy everything to Google App Engine all of our code is going to be written in Python we're gonna use these set of approved libraries and everything will be great I would say that almost guarantees you're gonna have to completely rewrite your application within you know several years as many companies have found out so there's a cost of trying to employ them you impose uniformity of topology and there's also sort of things that you can't do anything about it if you're deploying to a mobile phone you're using their platform you're deploying to like a web application you sort of constrained already and if you try to do I mean you could try to do things like run all of your code within sort of kubernetes or containerize everything but there's going to be cases where that's not possible like a legacy data center application that relies on certain properties the data center or against a web application or a mobile application if you try to put say like a sidecar and everything they're there deployment topologies where that is not possible and so any real solution to this problem needs to span all deployment topologies I think another thing we can't do anything about and really don't want to is this proliferation of development frameworks this is something kind of and Netflix most of the platform was was Java but there was a growing number of people who wanted to write node backends for their web applications for very good reasons and if you tried to sort of impose again a uniformity of development frameworks you're missing out on a lot of the promise of the cloud what you really want is to be open to new technologies and allow developers to choose the right tools for their job the good thing is there is a small and strophe night set of these interaction models which is the third axis of complexity and that is small enough that we can sort of try to impose some sort of standard on top of which we can greatly simplify the way our applications are written and again that is sort of the origin of the our socket story yep and you know without getting too much into details now it's time to see some kind of contract how it looks like in you know in the closer fashion we have a nice contract as you can see if you familiar with project reactor you can see the types or normally you should be familiar to you the contract defines clearly for interactions you know this morning we presented this for interactions that's exactly the contract at least in Java how it looks like and every every language is by every language bindings like C++ and JavaScript they all will have you know the similar contract implementing you know given the language capacities capabilities so here it's cool we on the Java side we can use reactor so I also get Java the also cat project on on Java deployed on maven you can actually use it directly use depends on own reactor to provide you this experience it's actually you know the dissolution we find arrogant you solve a lot of problems as this morning we mentioned a few of them I think one particular I liked you alight is the program of you know you on your iPhone or Android device crossing crossing the road especially in the US I find you have a very spotty connection and you lose your connection while you were chatting and then your phone reconnect again to a different cell door for instance or Wi-Fi and you get the connection again and having this capacity to get this capability of having a session ID basically that will automatically be retransferred over the network and you know give again the ability to the backend to not recreate all the state for a given client but just do with the Delta but because they know this is the same session that disconnected and reconnect this is what Steve this morning mentioned and what saved a lot of cost running costs to to Facebook for instance and that's pretty and that's pretty cool I think it's you know another interesting thing is we don't really care about what applications are deployed and really a that that's what we're going to demo just after you have to see to believe I don't sell often this kind of world and I don't like silver bullets but I've been really surprised by the the flexibility of the protocol it's basically level seven if you think about layer of protocols so it's a framing thing and you walked on top of anything so anything you can connect use to connect and establish communication data transfer TCP UDP as we've seen this morning WebSocket we're thinking about more it could be even a message broker like Kafka we don't really have assumptions on how these data payloads and headers and metadata are going to be exchanged they just have to respect a certain behavior that all the driver all the house or get driver are going to implement so in terms of Java again if you implement if you start using also get it will look like that basically there are multiple transport history or transport layer you can use as an option that's the TCP one it's using the same factory but you pass this this transport directly in the factory you can see the use of block obviously for some simplicity reason in this slide you'll see I will use this to get a reference to also get remember also get is the contract with the four into action defined so directly what I can do with this for the defined interaction I can just choose one of them the request reply interaction pass the payload which I need to build and do something and when you know it's complete successfully complete I can interact with a callback in the classic reactive style I have obviously masked the the part where I pass data to the constructor of day for payload because it's just something you don't want to see it's but basically by buffer creation and in terms of its using Neddie by birth so it's pretty efficient it's pulling by birth but you really don't want to see it and what you think about that is oh my god it's it's basically very low level you don't want to deal with bytes you just want to to use it and you know it's it's pretty scary but you can use it it's pretty low level on purpose because it gives the ability for everyone to build something on top in the abstraction the coop fraction is isolated and do one thing and one thing well doesn't try to do more then we have side projects but projects were built on top of it you know if you want to reduce the complexity of using such thing you might investigate also cat RPC which is the first increment implementation using in that case protobuf to be contract driven and you know not deal with all this mess like byte buffer creation but deal with message you pass you know standard starter messages you pass around and basically when you start using also cat or PC the code is basically you know much simpler you but you instantiate the service generated by protobuf and you have great product plugins and maven do you call the method generate ID the contract here you know record and it's generating directly react or code so the return type of record is really going to be flux and you pass like in that case you will passes a scanner object a request and as a result you get a flux a stream of record which is a in translating Java effects of record the cool thing about this RP thing is it's not only about Java it's about all the stuff so yeah I'm obviously I'm hiding you know the also cat paw we just created that a bit earlier that doesn't change you still need to create and also get reference it's just the interaction that is simplified here but the cool thing about that is you can generate JavaScript code as well which is pretty awesome it's not only working on no GS you know it's also working on a browser which is cool you don't need anything you can just use that as a dependency in your browser and instead of using WebSocket to interact with your back-end service you just use the generated code by also cat here and that's replacing basically what you deal you did directly you know manually with WebSocket for instance and that's basically similar to experience also to what you have in Java you have requests you pass directly to record another return type we have a companion object named flowable it used to be another name but we use right now this one because it's a simplified version of what we do with react or we think about doing a reactor called GS version as well but right now it's something you can like in react or subscribe to you know do map and and in this kind of interaction you have in influx API so pretty similar you do that in browser or not yes I emphasize on that point because if I think about for instance GL PC the RPC doesn't do that on a browser it does a it does do that on or not GS but you can do that with simply with the browser for instance unless you start tweaking around things and there are projects right now in in the pipe but some might still say it's too low-level again and basically you have still hidden the configuration of also ket and you still have to do that so if it's too low level is there something we can do about about that what kind of level is next then after that yeah so if we flip back a couple slides I think the complexity that's hidden here is the creation of this our socket and you think about what that entails it still involves sort of some kind of service discovery mechanism where I need to know which IP addresses I can associate with this service I need some way to go and fetch them and then load balance across them and that's a lot of complexity to for the developer to keep continually manage but I identify so that we create as the next generation of infrastructure to sort of put this complexity onto the network layer and this is where I think our socket gets really cool and this is why this gets the heart of why our socket is a protocol and not just a library because what it allows you to do is take this standard protocol and put the complexity onto your network instead of your application and that's immensely powerful as you know a company in the 80s discovered they could make a TCP router and sort of offload all this complexity that company is cisco so this idea of sort of offload and complexity onto the network using a standard protocol is really immensely powerful and so what we've built in edify with Proteus is sort of directly analogous to a tcp router but instead of routing to IP addresses to machines on your network what you care about as a sort of modern application developer is services so Proteus does easy routing to services and devices so nowhere when your application code do you ever need to worry about an IP address and then in addition it's got all the built-in advantages of our socket so you get flow control it also overflows things like load balancing to the network layer so nowhere in your application do you need to load balance to a bunch of servers you just send the request to the network to this virtualized connection and allow the network to discover the best path to that service and so what this allows you to do is essentially get rid of all of the complexity from your client-side code so instead of creating your own our socket you can just add an annotation in spring inject a service to the client that you want to talk to and it will create a virtual our socket to this this group spring one demo records in this case and as that serve it has machines that offer that service come and go from your network it will automatically adjust load balancing to give you the best path to that service so if this is truly all code is gone I think it's completely application driven you could call that I feel happy spring boots so that's cool for the developers like sorry let's dig down a little bit and see what is actually going on under the covers there so Proteus works you do deploy it much like a tcpi out of this very little configuration you deploy it into your network a sort of self discover and cluster or these nodes with within the this broker cluster and then into that cluster you can connect things like web browsers or or mobile phones and immediately sort of without even any back-end presence whatsoever these devices can start to talk to one another this is sort of the peer-to-peer model and the broker is sequestered together and exchange information about who's connected where in the network so very much like you know TCP routing you don't need to know the entire state of the network in order to send the message it would be silly if the internet worked by every node on the internet you need to know the IP address of any other thing on the Internet right it's designed to scale so it can't work that way and then on top of that you can sort of start to connect in your micro services so you might have a micro service written in C++ the next year you might decide to rewrite that in node you can just swap it out under the covers with absolutely no changes anywhere else and then in addition these services can call out to clients or what would previously have been called a clients or a web browser so a web browser in this model can function exactly like a back-end service can offer its own API that can get called from your data center and it does more than just services so into this network you can insert things like an open tracing back-end so every Proteus client is automatically instrumented to start dumping open tracing information but because of flow control nothing actually flows through the network until there's a back-end in within the network that's capable of ingesting and and handling that traffic likewise with the metrics back-end so you can just start up a Prometheus server connected into this network of services and instantly it starts dumping metrics information that you could then go back and analyze and and like I said unlike sort of an infrastructural or you know something as standard trying to standardize your develop loin topology Proteus is designed to be almost configuration free so it is very much equivalent to just installing a tcp router and making it part of your network and unlike sort of something like sto which has dozens of moving parts i think like in excess of 30 maybe last time I checked there's only one moving part to this and that's the broker and you can you can run the broker just by running a docker container and you could put it in kubernetes or you can put it in your data center or bare-metal it's very flexible in terms of where you actually deploy it and beyond that there's sort of this Proteus PCF service is coming soon so shortly even that small amount of configuration will be gone and you'll be able to deploy this just simply by clicking a button and PCF yeah CF push basically and the binding very cool so we are going to do a lot of Devo or all demos with the time we have left and this demo is a simple can of tournament use case so you will see Marvel superheroes fighting each other or basically virtually fighting each other with the way we're going to do that is we have four microservices well yeah for including the client because there is no real back-end application everyone is a kind of a back-end and one is going to be tournament deciding calling depending on the record and and ranking so coding record which is a 2d BC based micro service pullings putting records of superheroes from database and giving that back to tournament then for each of each pair of super arrows back we're going to call a ranking service which is going to choose between two who's winning and right now the Java one implementation is deciding to do so by selecting the one with the most superhero stories super stories so Superman has a lot of stories for instance if make him fight with I don't know no sleep a road not one known I don't even have one in mine right now yeah maybe magneto for instance or even this one anyway one superior what not very well known I have seen one called Capitan America Chavez I did not even know this one existed raise your hand if you know this one but it's actually a superhero and and yes so Superman would win in the ranking service and go back to tournament and then give this information back to a client you know getting access to this tournament and in fact you know tournament walk this way you have you know this pairwise fight was the most stories and then we have the winner so it's run to and then we have the final the final winner out of these two semi final winners which is the round one so that's basically the the big principle of this demo and let's just try to cheat to do it right now I'm going to switch to IntelliJ so let me zoom a bit and stop things so interestingly I really I have the my I can zoom down I have my four application I'd only she can really see them well they are all terminated right now brutally terminated as you can see but they are that there are the four applications mapping with the what I've just shown you and another interesting cool thing about this kind of Proteus based architecture is there is no older preferred order I need you have to start this application I can stall any of them in any order I want basically information are going to flow so let's look at the client because that's a simple simplistic one if I look at the client it's a simple simple spring boot application and it has injected this generated the RPC protocol generated client which is tournament service client so you can see it's really generated it's like yeah generated code love it but you know if you know gee obviously you know this kind of code anyway you don't need to deal with that you can just inject it like it's not a wired dependency and this is a client runner so starting with the application I'm going to build a request for my tournament service and start a tournament and in this case I'm just going to do tournament forever so in that request a tournament will have 40 challenges and they will fight each other and at the end I shall have a super winner to get the super winner remember it's a flex I have all these nice API including to to rub in trouble which is a blocking way to consume flex but I don't really kind a client so I can't I can just do that and start this client and there is nothing else started right now so just telling the client and I shall have at some point when label I shall have at some point things you know print in this blogger info here so I'm just doing that you know when the ground is the the first one that means it's a final run so I'm going to print the winner it's connecting to my local Earth which I've started so remember I'm going to actually do it again because it's a quite fun to start kind of mesh here I just need to do that which is one docker instance with a java application based on spring and reactor actually nary and stalling and it's going to be like the the broker thing where everything is connecting to there's nothing else no other tricks so I'm starting that and I'm restoring the client I just stopped so starting again it's correct or it's worth knowing there's no code in here to block and wait until the services are available so it's trying to send this information but there is no back-end services that have been deployed yet the clients are completely disconnected from the back-end services so normally if you're doing this with HTTP you'd start getting errors again and against as an endless stream of errors but it's simply way for that service to now be available mm-hmm right now by default it's using TCP so this connection and I stablished directly with TCP I could have used something else and we see something else now let's start the backend service so the first one I'm starting is the record service the one connected to the back-end database with Spring data and JDBC and our two DBC support so how it looks like well you've seen a bit of code this morning but it's just like that we use a non-blocking Postgres sequel driver via RT DBC we generate the query we want to do when we call this method classic spring data code and then you know we return the Flex instead of returning a list because we're going to stream the result back and when we are ready remember now the protocol is going to send back pressure from the very end the client to you know the very upstream component so if the client is slow remember this morning the small requests going on on the on the Jag Ram and then the data flowing back to to the client that's basically the same thing the client will say ok I'm slow I'm printing things I may be doing a thread sleep in my client Runner so the the request generated and propagated across network are going to come in a very slow rate and this is going to stream data from the database in a slow rate giving more space for maybe a faster client and you know it's about being smart and schedule things reward things that are faster to go to consume data so your server is mostly all the time available it's not impacted by a slow client really this lets you do crazy things like you don't have to define a paging API for your database or you can just return a flux the consumer because back pressure is propagated all throughout the chain can just request more records as they're able to consume them for instance in a web application as the user Scrolls down the page you can just say hey give me two more give me 10 more give me 15 more and that message will propagate all the way to the database at which point it will just stream the records so the cool thing is we now implement also the generated contract by protobuf so it's contract we've and all these thing so again recognize this kind of code it's not that ugly but still you know it's a it's generated stuff and again it's generating react react on code so pretty cool for that and that's you know a receiver side so it's an interface classic like in Java PC you implement it and you implement the methods here I'm going to stream record given a record request to do so first I'm going to retrieve from the repository the total number of super eros in my database I'm going to catch that result so it's not actually doing that in my constructor it's going to that to do that one time and then cache the result that's why in the record method I do total and then I log and I transform this total given the count into a list of 40 streamed superheroes I give that with the offset given the total obviously and you know how many result I want to stream so I'm doing that then I'm at recall from the database so classic spring data thing as well I have a component an entity I will save into database and I have a to a builder to build the recall for GRP see a sorry Joe PC protobuf and that's it in this record I will have basically the information I need to to have to transfer over the network and put above you know sterilized everything for you so I just do that here I transform this record the entities from database to protobuf record and I stream that back and that's it pretty much it I had even a simpler version here but every time it was getting only to first 40 superheroes so it was a bit boring that's why I added this count this total to randomly select someone in this total what to start the offset basically so that's the service streaming record so Eros and now let's see the ranking the ranking service is super simple so every time it's a want one class fee basically it's not very complicated if ranking and that's the ranking service even simpler so again protobuf implementation contract driven I implement a rank method and this one will have to do to choose between two superheroes and you see the comparator here is simply compare given the story count how many times you've seen Superman in in the Marvel comic for instance and the winner is sent back as a ranking response and now you see it's a mono that's interaction is what we've seen has request reply that's mostly what you know user tend to use because they are not used to streaming interaction modes so pretty simple again every time the properties will look like the same it's using local lost my doctor in mesh I just thought it and the last one is the aggregator micro service the default tournament service which is a bit more subtle because it does it does generate these fights and you know basically do this what you've seen here but in reactive so it has called these two services and one depending on the other I'm calling the the record service here in my tournament tournament method again put above contract and implemented implement recall service streamed record from a remote database service and then generate the tournament so for each pair of record which is basically what I do in round here each pair of record I'm going to create to call the ranking service and generate the stuff here the ranking result interestingly the ranking will see the reason for for that soon but the ranking has a timeout here and you'll see why but you don't necessarily need to use timeout it's Israel you just called the ranking service and it gets a result back so let's start all of them I still have the client waiting for anything happening I think the details of this code aren't important but what a actor allows you to do which is really cool is construct this whole chain of like fluxes up front before anything has actually flowed through the system so before it's rich we retrieved a single database record sort of wired up all the the tournament's such that the round winners each compete against the next round winner as that happens once up front and then traffic is able to flow through that very efficiently yep remember I left a repeat so basically I'm stopping the scrolling here because it's going to it's going to do that in in loop but you can see the round going back to the client in the for each loop and after each round we get closer to the round one the final round and we have the winner at the very end so basically given the story counts and random selection of superior from the database we give back if I can do that here I'm floating actually the application so if I can stop it if I have control back I will be able to see one of these superheroes actually I'm printing so much things with the repeat that I'm think I killed IntelliJ but the interesting thing is while it's running or trying to stop is I also have in the record application the one connected to my database I also have it's done I also have an interesting thing which is support for micro meta added and let's look at the build cradle quickly for the record and so you can see the the dependency I use in my record micro service I use auto DBC and spring data the latest very latest one you know fresh out from the oven then we use reactor core it is release version and an update for needy but more importantly is I use prometheus actuator and Webb flux to distribute these primitive statistics you know the actuator and point so that means if I go to or was nearly nearly actually exporting the the end but if I go to actuate or slash primitive use I'm connected to promotive stats from this application and also CAD Java is lucky to implement you know matrix using micrometer so spring boot see that takes the same registry or actually the registry is propagated to also get and the stat you know are using micrometer to be distributed then so if you have something nice like Ravana which you're just quickly seen I started that already and you do your nice dashboard dashboard you know it's pretty simple we have a script template to do this kind of thing you will have already you know for something as new has also get already kind of visibility on what's going on and you can see the head the heat map you know it's all kind of primitives statistics and and and language use so it's a bit boring to see the query but if you look at this one basically it's the kind of matrix you know query you will write in your graph an instance to display this kind of thing all of that to say there is a very interesting matrix report already of label I would encourage you to you'll have a look at that and you know it's a it's pretty awesome so I'm going to actually change one thing so you see here I I use this localhost instance and we've seen we called use something else we called use a remote broker for instance are pre deployed broker somewhere in the cloud something that you can yourself so if we go back to the slides one thing I'd like you to do is just simply going to this URL ring one that knee defied or io from your iPhone or from your computer if you have one right now it should look like you should look like this so pretty blunt you know that's you know I will not clearly JavaScript developers or UI developers but you shall see that waiting for ranking requests and that's pretty much it so we're now gonna do what they say never to do which is a live demo over a hotel network with audience participation yeah oh no actually I'm on the spring one platform but we'll see maybe it's as crowded as the guest I supposed to you actually the hotel guest network so what's happening here is using the exact same protolith we've generated the JavaScript code which is served on this web page and now running on each web browser that visits this page and it's now going to replace the sort of programmatic comparator that was implemented in Java so we'll kill that service and not run that at all and allow that service that can be completely fulfilled by web browsers so changing all my property yet so now I'm connecting to a remote one just shaking I need to obviously you've stalled my application and just to save my memory because my poor laptop is actually asking forgiveness like I have freed ocassi matrices and for Java applications and you know it's crazy I'm just going to shut down the local predation stance at least I don't need it anymore so let's start again and this time we will register to a remote endpoint change the repeat oh yeah the repeat - sorry come on Trina client we're not sorry so remember it was flood flooding the back end because I specifically said just to the back end here like if I die I don't even have a backup it's going to repeat as as fast as it can I'm just going to remove that for the next one cause the comparator directly and this service this back and service that was doing the simple comparison I don't want it too busy service I want to be the audience to actually do the comparison so you are going to be the service we're doing the reverse automation of jobs you are going to be the job now and not a computer program so I'm going to remove that from the list of the connected micro services and you are going to all be micro services so that's Tom I'm starting a tournament so randomly because I asked for 40 results 40 everyone will have not everyone sorry at least 20 people will see the result coming to its a device or laptop because I'm asking 40 results and you have to do if I'm one lucky one of them oh it's already done I know you haven't started sorry alright so I'm not sure I'm going to be one of the lucky 21 but all right so I see some people are already replying here like doing the selection so there was a fight between two superheroes and Gamera won this one another one called interestingly gateway no idea what this guy is but anyway Garrick it's my turn so out of the everyone connected to the audience 20 are invited to choose between this - - Shapiro I was doing the wrong service you are the ranks of is comparing to superheroes and basically if you're not selecting in time and that's why we have added this nice code here if you are not selected in time selecting in time the innate secant these two superheroes you are consider it a slow ranked service so we're going to generate an exception with a timeout here and we try again because you're too slow so someone else in the audience is going to be selected to actually a true superheroes so there's funny things using exactly the same load balancing algorithm is would go to sort of a Java micro service so it's observing the latency that everybody is able to perform this task at so if you actually click faster you'll get more queries because it's trying to optimize to hit the best back-end service which in this case is a front end so enough people have clicked and thank you for that it's a I know it was difficult but enough people have clicked and that means a winner has been chosen the application has stopped and I don't even know who this guy is click on the URL yeah let's see who's this guy it is oh no it's not we're just kicking our character I'm even even Marvel that come doesn't know who this guy is what is it supposed to look like what what is the most popular super mega reporter is a fictional character that appears in comics book okay blah blah blah blah blah okay super very generic description bye my love thank you so much I don't know why this guy as one but he has one and yeah you have selected it usually what happens is people I was just like yeah yeah click click click oh there's something to click it doesn't even matter what you're clicking but the important thing is you've seen an example of how powerful you can be when you really use the capacities the capabilities of a network protocol like there was nothing like you didn't even know my height my IP here I have free micro-services you connected to something on the cloud you have interacted with me as back-end servers and that's pretty crazy I mean nothing is doing that right now basically you have just yeah become became like back-end services and so it's worth thinking about the number of things that just went on there with with so little code so there's a broker running in the cloud from Stefan's laptop he started three micro services connected into that nobody knows the IP address of his laptop everybody connected in from their browser again your browser doesn't have an IP address it's not reachable in the other way then over back over the same persistent connection that it's using to connect to the broker so then from his laptop he's running the tournament service that's going up to the cloud load balancing back to his laptop to hit the database going back to the cloud going to everybody's browser to do the comparison and then streaming back to his laptop the results of each service to drive the next round of the tournament all right so another mind-blowing aspect especially provided by the client the Potteries client and estada is another notation you can use so another way to select things right now we have injected a client a generated client that will pick maximum of 20 person to do this fight you've seen and then out of these twenty ten times ten times more and then five more etcetera etcetera so in that case I'm going to actually ask the reply form one person everyone is going to receive this everyone will see this question I'm going to ask all of you from my laptop and you will see this question on your phone and you will have to answer this question and only one person will be randomly selected to actually be the winner the the guy who the folk who answer this this question so and again this implemented the network-level so just by changing an annotation from sort of group which is a load balanced behavior to broadcast a different header gets attached to the our socket payload and as it flows to the router it understands that means I should broadcast to everybody who's currently offering this instead of just a single person who is the superheroes I can actually see it I may be too late or someone has replied I know yeah I remember something oh yeah rendered tournament why sorry restarting Oh my conditions closed oh yeah so that basically what you shall see so one of you everyone can reply basically and you should see you should select who's winning in this fight obviously I'm clicking there but no pressure but I will be waiting for everyone to know actually not waiting for everyone if I'm correct because it's the first one who replies in this case it's a request reply so it'll behave as the first to reply yeah if you do a sort of request stream then you can get different behavior where you broadcast the message and then merge the stream of responses that you get for everybody so this is it should be walking but it is not right now getting the response back because I think it's gel you know communicating through network through the auto network and yeah there are still things connecting and getting basically this question I'm not sure if we ever going to have actually the answer so that's the kind of possibility you have you know asking question like like that randomly - you know because the network boundary is removed you can do this kind of crazy crazy stuff I like the fact that there is a support for I want to stop the service I like the fact there is a support for spring already that soon in the development process one thing I didn't I didn't show I just want to come connect back to my local laptop fine I replaced that by local local Austin and we starting the to service commenting that oh and you haven't started the service actually starting the Doka image that will handle all of this stuff and and what I want to do a command this command Rena I don't need it anymore go back to him and command so the original demonstration we have and do again the repeat so kill my machine basically and everything he studied oh yeah I also need the ranking so again you know what we automate the job we get Java back-end doing the ranking now and doing a client application run so yay yes so a lot of lot of data a lot of stuff going on now the docker image comes with an interesting prototype of monitoring console here and you will see something you have seen already maybe in the past traffic also I find it call so I needed to have a and to give a note to that thing you will find a traffic to you know the for microservices flowing in so right now if I'm correct this role this is that Rick's visceral library doesn't really support bi-directional connection and so you only see things going in one way it's not really it doesn't do it the other way basically but you shall see sometimes the other direction going on for simplification reason we only see one direction yeah because the Netflix architecture is essentially a single entry point which is the internet visuals are written assuming that there's a single entry point we're working on a fork of it that understands the concept of bi-directional communication so you can have complex graphs of microservices and still render this mm-hmm they say my tournament is actually getting data from multiple luxury that's the opposite that's client pushing to my tournament so you can basically drill down to every service pretty cool but also you have beside the traffic you have access to a lot of information you know just real time you can sort of see every server that's connected in that offers these various services and you can also go ahead and configure sort of access keys per service yeah I've just seen every time you know application properties oh yeah right I'm going to just do a shutdown and what you shouldn't do at home but I'm going to force application to fail everyone just to stop sending data and yes cool yeah so what you see every time in my application properties we've come up with key and token so that what they need in the Proteus broker to identify you I've disabled something you shouldn't do at home obviously SSL just because you don't want to deal with the the shitty certificate issue that you have to trust cetera from the browser perspective it doesn't actually support that in chrome if you if you don't do that so if you see this key you know you actually see that in my folder demo it's really cool easy to setup because you actually see that directly past a sadhaka argument so you all of these things you can pass directly in the new documents and yes so I think that is pretty much it for today I think we are ready to take questions yeah so all this code is available in the github repo that stephan pointed out and you're welcome to play around with the broker if you go to trial modify calm we can spin up a trial broker for you or you can run it yourself as a docker container it's available on docker hub you should be able to recreate this demo all right so just one thing before I ask questions from you please endorse me on LinkedIn for animation on keynote animation you know I've spent a lot of my life learning this skill it's it's pretty cool I'm proud of me and I'm going to shut up now so any questions of our question question all right sorry your produce has support to transfer transform into rxjs and it's relatively easy to do to other ones so I would also add that on your repository so question was have we got something with like reactive angularjs something like that I guess of UGS it's not yeah it's not opinionated so we have demos using react this one uses nothing I think jQuery jQuery and neck my script six but there is a demo on your repository on your organization with react if maybe there is one we funk a lot but mostly for show the chat demo you have is based on react and you know we you can use anything basically yep yeah yes that is kind of X you can build this kind of experience you know with a reactive client or rich client you can you can build this kind of thing in my opinion so the question again was the do we have like a direct support for UI rich client UI libraries like UJ s or react.js or angularjs and I mean at all level we don't deal directly with that but it's pretty easy to integrate there is a demo if you go on neck if I organization chat demo its call or something like that based on react yes so that's one example I think it's pretty easy to imagine a demo with angularjs from that or you know I've huge yes yeah the types that are exposed from JavaScript are facebook's sort of equivalent implementation of reactive types or the equivalent of reactor and those just generate events that you can consume and feed into whatever framework they're using and yeah let's yeah there's an example like yeah check out the chat demo which is essentially a back endless chat application which uses peer-to-peer communication between browsers and it's built on react that's an example to plug in to react on notify yeah so you see in my package a package JSON I don't use anything that but I could have added something if I wanted to I just use this JavaScript dependency if I look at my app GS and I usually don't want to do that all the way I feel sick but you know for you I'm going to do it and basically if we start the very beginning what you have to do this is a classic script so you do some import you have the JavaScript generated by protobuf and you generate the JavaScript client so service also CAD PV and service PV it's generated stuff by photograph once you import this thing you just have to decline photos the equivalent of application properties in spring boot you create it and like what you've seen basically you pass the produce instance there is no injection here but so you pass it directly by reference to ranking service server so you really are server in terms of interaction what we know in terms of client-server interaction so you as a JavaScript client can do that and I pass this that means in ACMA script I'm implementing Endel sorry rank rank method so it's like equivalent in Java of doing our at override rank and you know overriding and implementing this and single is a type Facebook came up with they've came up they came up actually with reactive stream JavaScript they bought it reactive stream from Java to JavaScript and they invite us to override so they have rxjs bridge we have a prototype of reactor called GS in the pipe as well so basically then you can use a flux in JavaScript or or observable from rx yes another question maybe yes yeah I personally haven't used graph QL but if you want to take that question Steve so to repeat what the question was and Steve answer was the question was can we go into more detail about a graph QL my answer was I'm a noob and Steve answer was there is an implementation in C++ to do that so if you go in I guess also get C++ you will see how it looks like in C++ and then I think it's 1/5 know what just a super special fermentation you should see that in the also get organization on github Apollo does not support the live query functionality that Steve mentioned in the keynote we're working on a clients that are on our roadmap to attend edified first-class support for graph QL including the live query stuff so you could just automatically compose that together yeah that gives you this subscription behavior for a graph QL yeah another question is yeah there was one sorry yeah what's actually going on there is that clients connect to a seed broker and from there they're using the same discovery mechanism that they use that the broker uses to find other services to find out their broker so you can define a number of brokers that you want to connect to for Java for instance you can have redundant connections to a broker and if one broker fails it will automatically redirect traffic to another broker so there's an issue there is an initial load balancing that happens from the client side to a small number of brokers and then if you do is sort of a rolling deploy you'll get notifications of the new sort of broker cluster that's available and a lot of matically switch traffic over which makes yeah correct so there is a redundancy at the client side and also it makes me think that it's not magically removing all the distributed system complexity you have with a client you know we have a still a kind of big responsibility as a client to do some stuff but much less than HTTP because we have the benefit of using connected currently connecting and keep kept alive connection we have a status flowing over the same connect open connection it's a known like an HTTP where you have a disconnected experience when you request something and you get a response you don't know if the next request is going to to actually work on know if the server the back end is actually failing at least with a TCP or WebSocket connection when it's failing you immediately know that it's failing like in an even driven way you you already know basically you you cannot connect to the server anymore you're switching so it's removing a bit of if not a lot of complexity from this perspective as well the the load balancing can go a long way so you can deploy new versions of the service in parallel with others and the load balancer will automatically figure out which is the best experience for your user there are cases where you might want to deploy new functionality new business logic that actually degrades you know the latency that people experience so I think there's still there's still very much a place for things like you know spinnaker and canary deployments where you want to just analyze the traffic that's going to a new cluster before actually switching over but it does make a certain subset of those use cases extremely simple mm-hmm I think we we are a bit over time ten minutes and everyone is getting hungry and hungry I guess so thanks for sticking with us thanks for understanding my French accent again and thanks writing for being with me as well if you have any question of line we will stick around you're just fine us and they ever stand as well I think in the community hub so visit the datafile guys thank you [Applause] you
Info
Channel: SpringDeveloper
Views: 3,996
Rating: 5 out of 5
Keywords: Web Development (Interest), spring, pivotal, Web Application (Industry) Web Application Framework (Software Genre), Java (Programming Language), Spring Framework, Software Developer (Project Role), Java (Software), Weblogic, IBM WebSphere Application Server (Software), IBM WebSphere (Software), WildFly (Software), JBoss (Venture Funded Company), reactive programming, reactive streams, webflux, webflux.fn, flux, mono, netty
Id: vY26K0gEfio
Channel Id: undefined
Length: 68min 27sec (4107 seconds)
Published: Wed Oct 03 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.