1 00:00:00,810 --> 00:00:06,000 All right my friends in this video we're going to try to answer a very simple question What is a micro 2 00:00:06,030 --> 00:00:07,080 service. 3 00:00:07,200 --> 00:00:12,270 To answer this question we're first going to do a quick review on how you are probably building servers 4 00:00:12,330 --> 00:00:13,360 right now. 5 00:00:13,380 --> 00:00:17,070 So right now you are probably familiar with a monolithic architecture. 6 00:00:17,070 --> 00:00:21,390 This is probably how your building servers right now in a monolithic server. 7 00:00:21,390 --> 00:00:27,210 We have all of our code needed to implement our application inside of one single code base and we deploy 8 00:00:27,210 --> 00:00:33,840 that code base as one discrete unit so we might imagine that with a monolithic server we have some requests 9 00:00:33,840 --> 00:00:39,420 coming from a user's browser or mobile device that will flow into our application and go through maybe 10 00:00:39,420 --> 00:00:45,580 some pre processing middleware then maybe it goes off to some router that router might then inspect 11 00:00:45,580 --> 00:00:50,430 the request and decide to send it off to some very specific feature to be further processed. 12 00:00:50,500 --> 00:00:55,360 So maybe in this case it goes off to feature a feature a might decide to read or write some data out 13 00:00:55,360 --> 00:01:01,000 of a database eventually formulate a response and then send a response back to whoever made the request 14 00:01:02,180 --> 00:01:07,860 so if we had to characterize a monolithic server we might say the following We might summarize it with 15 00:01:07,860 --> 00:01:09,040 this sentence right here. 16 00:01:09,210 --> 00:01:14,550 We would say that a model it contains all the routing all the middle where's all the business logic 17 00:01:14,550 --> 00:01:19,650 and all the database access code required to implement all features of our application. 18 00:01:20,370 --> 00:01:24,680 So that would characterize a monolith let's not take this diagram right here. 19 00:01:24,720 --> 00:01:29,920 We're going to make one or two changes to it and that will then summarize or characterize what micro 20 00:01:29,920 --> 00:01:31,230 services are all about. 21 00:01:31,580 --> 00:01:34,740 So here's how we would characterize micro services. 22 00:01:34,800 --> 00:01:40,620 We would say that a single micros service contains all of the routing all the middleware is all the 23 00:01:40,620 --> 00:01:46,090 business logic and database access required to implement one feature of our application. 24 00:01:46,170 --> 00:01:48,400 That is the big difference. 25 00:01:48,450 --> 00:01:53,280 So a monolith has all the code needed to implement every feature of our application. 26 00:01:53,430 --> 00:01:59,090 A micro service has all the code needed to implement just one feature. 27 00:01:59,300 --> 00:02:02,820 Let's take a look at this in a more visual format. 28 00:02:02,990 --> 00:02:03,230 All right. 29 00:02:03,260 --> 00:02:06,860 I know this diagram is a bit crazy but it's very similar to the one we were looking at just a moment 30 00:02:06,860 --> 00:02:07,900 ago. 31 00:02:07,910 --> 00:02:13,400 So with this micro service architecture we've now split off all these different features and wrap them 32 00:02:13,400 --> 00:02:17,060 up inside of their own little personalized services. 33 00:02:17,060 --> 00:02:22,810 The very important thing here to understand is that each of these services are entirely self-contained 34 00:02:23,390 --> 00:02:29,600 so service right here has all of the code required to make feature a work correctly. 35 00:02:29,600 --> 00:02:35,330 It has its own middleware it's got its own router and it even over here kind of surprisingly will have 36 00:02:35,330 --> 00:02:37,630 its own database as well. 37 00:02:37,670 --> 00:02:43,520 The nice thing about this approach is that if for some reason if every other feature or every other 38 00:02:43,520 --> 00:02:49,820 service inside application crashes or just mysteriously disappears a portion of our app is still going 39 00:02:49,820 --> 00:02:51,680 to work just fine. 40 00:02:51,730 --> 00:02:57,450 As service say is 100 percent standalone it doesn't necessarily require any other service to work correctly. 41 00:02:58,870 --> 00:02:59,130 All right. 42 00:02:59,380 --> 00:03:05,890 So that is a very basic kind of introduction to answering this question of what is a micro Service are 43 00:03:05,890 --> 00:03:11,440 working definition for right now is going to be that a micro service contains all of the code required 44 00:03:11,650 --> 00:03:14,740 to make one feature work correctly. 45 00:03:14,740 --> 00:03:18,460 Now that we've got a working definition we're going to take a quick pause right here and continue in 46 00:03:18,460 --> 00:03:19,020 just a moment.