Monday, May 23, 2022

Microservices Architecture | What is a Microservice | Microservices Vs Monolithic Architecture

Hello and welcome to a new video on youtube channel of in this video i'll talk about microservices architecture and i'll be primarily focusing on the beginners with a basic understanding of microservices architecture and i will be explaining the transition from conventional monolithic to .

Microservices architecture let's have a look at the concepts and the topics that we are going to cover in this video tutorial first of all we will see high level overview of microservices architecture where i will explain what exactly is microservices architecture .

And why we need microservices architecture then i will talk about a bit about conventional monolithic architecture we will have an overview of monolithic architecture and i will explain the basics associated with monolithic architecture and last but not .

Least we will talk about a comparison between a monolithic and microservices architecture and i will shed a light on some of the positivities and benefits associated with the microservice architecture that will set a ground for the reasons to choose microservice architecture compared to the typical monolithic .

Architecture please note that in this video i will not be going into the nitty gritties and much of the technicalities as i explained that i'm focusing mainly on the beginners who don't have much knowledge about the microservices architecture and .

By going through this video you should have fairly good knowledge at the end of this video about the basic concepts associated with microservices architecture so if we talk about microservices architecture and microservices in general and we have an overview of this basically microservices architecture is .

A collection of loosely coupled independently deployable fine-grained services what happens in case of microservices architecture is that we go at the micro level which means that based on the business capabilities and the business requirements we try to break the bigger picture .

Into the smaller pieces and we we want to make sure while we are constructing the micro services through microservices architecture that the services that we define and deploy those are loosely coupled and they are not too much .

Interdependent and then we we make sure that they are independently deployable so that's the beauty of microservices architecture that once you have uh separated your services and once you have drilled down and created separate deployable artifacts was .

Different micro services then you have an independence and you have convenience to deploy them independently without affecting much of the work related to the other services and they are fine brand services when we say these services the microservices are fine brand services this means that they .

Are at a high at a fine granular level and you don't have to consider them as a fat uh typical uh application rather those will be smaller applications most of the times it will be focusing on on some specific type of requirements and underneath in many cases you will be going with a .

Separate database and separate layers associated with those so in this way you make sure that the services that you define through microservices architecture are at the fine grained level and you have liberty and you have the independence to handle those services without .

Having any without having much of the dependencies between these services and as i stated in case of microservices architecture the services that we define and design they are based on the business capabilities so what happens is that when you have a business requirement .

Often you you come across a high level business requirement and when you drill it down and when you break it into the pieces you come across that you come across multiple sub requirements or sub services that you can make out of it so this is how you define uh your micro services based on the .

Business capabilities take an example of a shopping cart when in case of an e-commerce application or an e-commerce web service web application you have multiple business capabilities as part of that web application and in that case you have different .

Requirements and you have different functionalities like you have requirements for the user management for the user registration for user authentication for the product catalog for the product selection for the cart handling for the payments for the cancellations and so forth so on so forth .

So depending on the requirements you drill down and you decide that which of these services can be separated and in that way you come across with the micro services based on your full-fledged requirement and for individual requirements once you have designed your .

Micro services then you can plug and play those services and you can create composite services out of those microservices and you can fulfill your requirements by having maybe you can think of having an api gateway on top of those services and that other backend micro .

Services so depending on your requirements depending upon your scenarios you can decide how many micro services you need for a specific scenario and then you can you you have to ensure that the micro services that you are defining they are independently deployable .

And they are loosely coupled and they are fine-grained to a certain level now that we have talked about the basic overview of microservices we need to understand and we need to set ground that why we need my services so before we set a ground for the micro services .

And we convince ourselves that we need micro services we first need to look at the conventional monolithic architecture because you need to understand the problem and only then you need to come to the solution so we will first look at the monolithic architecture and then we will try to .

Find out what are the reasons and what are the scenarios and what are the complications that are associated with this conventional monolithic architecture which forces us or which convinces us to uh switch towards the microservices architecture .

So if we talk about monolithic architecture what exactly a monolithic architecture in case of monolithic architecture you have one box for all the tools this means that what happens is that you have a fat application with all the functionalities clubbed together so in typical .

Application you have a ui front-end layer you have business logic layer you have a data access layer and you have a back-end database which is persisting your data so you might have mbc architecture and you can have multiple tiers multiple .

Layers depending on your scenarios or your application requirement but in general what happens is that all of these layers they're clocked together in the form of a single application and depending on your programming language or whatever technologies you are using all of them .

Majorly in the same set of technologies being implemented for example uh no matter how many uh different modules are no matter how many different uh pages or front-end screens you have created typically what happens is that you .

Choose one of one particular front-end technology and you implement all of those same same goes for the business logic so behind the scene if you're using any of the plug-ins or if you're using any specific programming language normally what happens is that .

You build that you implement all of that business logic in the same programming language uh with a similar approach for example maybe you will be implementing everything with the uh with java with the java enterprise edition with gpa for the persistence and in the back .

End you will be having one of particular database maybe you have oracle database and maybe you have a sql database and what happens is that you you follow the same pattern for all of the modules or all of the components that you have for that application and once you have implemented that .

Application then if you have to deploy that what happens is that you create one deployable artifact in the form of a wire file or er file or whatever it is and then you deploy it and all of the application gets deployed so this is for a typical monolithic architecture where everything is clubbed together in .

The form of a single box of course when we deploy it we can do the horizontal scaling and even vertical scaling as well but what happens is that everything is considered as a single box or every in the entire application is deployed as a single unit let's talk about the problems with this .

Monolithic architecture and this once we understand these problems only then we will be convinced to go for another improved or enhanced or more modern architecture that is microservices architecture so the first problem that we see with this .

Monolithic architecture that i just explained is that you have a complex application and when we have a complex application it's always hard to change its scale so what happens is that as i explained that you have you create one big chat application and you club together everything you .

Select the technology you select the tools and then once you have implemented that complete solution and you have deployed it if you have to change it then there is a problem and the problem is that you need to make sure that whatever changes that you make they don't .

Impact or affect the other change other implementations or other functionalities that are part of your application and also the scalability becomes a major problem in this scenario what happens is that if you have to if you have multiple require multiple functionalities as part of your .

Application let's suppose one of the search functionality needs to be scaled up because you you observe that your customers are your clients are making too many searches but the problem is that the whole application is clubbed together so if you have to scale you have to .

Scale the entire application and not the single piece so in this case you will need more resources you will need even if you have to scale it horizontally or if you have to scale it vertically in either case you will need more resources and more complexities will be associated with .

This so this is one of the major problem that is associated with this conventional monolithic architecture the second problem that we foresee and we observe with this monolithic architecture is that the deployment is become deployment becomes another .

Complexity for you to consider and it's difficult to go with the continuous deployment and what happens is that since everything and all of the functionalities be it at the ui level at a business layer or the persistence layer or at any layer all of them are part of the same fat .

Application so if you have to deploy you have to deploy the whole you cannot go with the deployment of some specific set of features out of it and even if you go with the ci cd approach there are situations where you come across problems some of the things some of the .

Functionalities get broken because of some of the some of the dependencies that might not be understandable for you at the time when you are designing the application and you come up across that many hooks and many of the integrations between them .

Between the components within that flat application get affected just because you made some changes and deployed in some of the parts of your application so overall it becomes a problem and a mess when you are doing the deployments for this type of a monolithic architecture based .

Application the third problem that we see and observe for this monolithic architecture is the resistance to architectural and technology staff changes so basically when we are implementing an application or a solution based on the requirements that we have from the business .

We initially select some technologies and we select the tools and we we come across we come across the complete set of technology steps for example maybe you decide that you will go with the java for the for the implementation for the front end you will be using some .

Of the extensions and some of the ui plugins or modules and for the back end also you decide that you will be going with some specifics uh database for example you will be going with postcast postgres you will be going with oracle .

So what happens is that in the later stages once your application has is mature and it's deployed and it's running then you you find out some of the maybe you find some of the security issues maybe you find some of the performance issues ui related aesthetic related issues or anything .

That you need to improve or you need to change and you need to update your application to the latest trends and latest technologies that are available in the market then it becomes really difficult because you have to go back to scale one you have to reinvent the wheel .

You have to make changes to each and every part of the application because this is one application deployed as a single application you cannot make the changes at the individual level you have to make decisions and you have to make the changes for the entire application and with this type of monolithic .

Architecture based application it becomes difficult and you have a resistance from within your teams from within within your organizations because if something is running people consider it okay and they don't want to change it but of sometimes you have a need to change it but .

If you have a monolithic architecture then such changes and such type of architectural and technical technology stack level changes might have higher impacts and severe consequences as well if you did not do proper r d and you if proper testing is not done .

The next problem that we see with this monolithic architecture is that it has certain performance implications so what happens in this case is that you have a bigger database because you have a underneath database to which all of your layers of your big fat application are integrated and .

What happens is that no matter how much tuning you have done to the database you come across the performance implications in terms of deadlocks in terms of logs in terms of the slowness higher response time lower throughputs so all these type of problems come .

Across when with the time and with the growth of the data that is being handled by your application and not only at the database level but also at your business logic level and at the ui level also you might observe that you have certain glitches you have .

Certain uh performance and ui issues this is all because everything is clubbed together in the in the form of one application and it's always hard to tune it and improve when it's when everything is tightly coupled so based on the all the problems that we .

Have just come across and we have observed for the conventional monolithic architecture the solution and the answer to all the problem is to switch towards the micro services so micro services architecture that we will talk .

Now this is the solution uh to mitigate to avoid the problems that are associated with this monolithic architecture so let's talk about some of the salient features and the pros that are associated with microservices architecture which force us are which convince us to .

Uh switch from the monolithic to the microservices architecture the first thing is the functions separation what happens in case of microservices architecture is that as i explained before that based on your business capabilities you define your microservices and what .

Happens is that you don't put everything in a single box depending on your requirements you decide that which of these services can be separated and considered as individual piece so in that way you define multiple microservices and those are revolving around certain .

Business capabilities like if you have a certain hr system within hr system you will have a separate micro services dealing with the employees data separate services for payroll separate service micro services for handling uh the transition of the employees from one department to another .

Uh you might have various other micro services related to the other hr related operations for onboarding for determination for the appraisals etc so name it of naming anything depending on your requirements you might have tons of microservices and all of those services will be .

Revolving around certain business capabilities of business requirements the second positive aspect of micro services is that you have greater scalability as i was explaining that in case of monolithic architecture scalability also becomes a major concern with one single monolithic fat application but here in .

This case since you have separated your requirement and your services in the form of micro services so now if you have to go for a horizontal or vertical scaling this is uh at your own convenience let's suppose that you have 10 micro services and one of the micro .

Services out of those 10 services is dealing with the user registration and you have require you come across the scenarios that you have a lot of user registrations coming in at some specific season during the year so what you can do is that you can .

Simply do the scalable you can you can simply consider that particular microservices service for the scalability and you can add multiple additional resources for those for additional resources and you can have additional deployments for the same service and in that way you .

Can have vertical as well as horizontal uh scaling of your application you can always scale it up you can always scale it down if you you if you if you think that certain microservice is getting underutilized is under utilizing the resources because you put too many .

Resources you can always scale it down as well and utilize those resources for some other services so you have your own convenience and you have flexibility to scale it up and scale it down another positive aspect for the microservices is that you have a better control .

How you have a better control because contrary to the monolithic architecture now you have ease of deployment as you are handling all of the services separately in the form of microservices so any of the microservice you can always think of it as a single piece and you can deploy it you can undeploy it you .

Can make the changes and also if you have to handle any issues you can handle it separately so once you have this will result into a little plug-and-play type of situation for you in your organization and if you have to do the redeployments you have to host deployments if you have to do hot .

Deployments if you have to make any changes and you have to revert anything you are not going to revert you are not going to deploy and deploy or make any changes to the entire set of services rather you are focusing on a single service .

And another way you will have a better control is that now since you have separate services based on this from business capabilities you will have separate teams or separate resources within your organization handling these different micro services so if a particular team or set of resources within a team is handing a .

Particular uh microservice then they have full control they have full visibility they have full understanding of their particular microservice and they will be in a better position to handle issues separately for that contrary to the monolithic where uh if you have .

To understand a problem you will have to look into the entire code you will have to look into the entire application and even after that you will not know that some specific changes who is responsible within the team of course you can track it down based on the .

Based on the version control systems and based on the tracking that who has committed those changes but in either case this becomes a mess but in case of micro services this becomes quite easier to handle within the teams as well and the next positive thing is that you have an increased productivity .

As i stated in previous case in case monolithic it's always difficult to adapt to the technology changes to the technology stack selection once you have a mature application already running and any changes or enhancements are also difficult and you have resistance within the team and within the organization .

But in case of micro services since you are handling these services of these capabilities separately you are you are you have a convenience to adapt and change and enhance it's beyond the technical uh technology limitations as well maybe you have one micro service that has been .

That is in the form of some apis or services deployed and implemented in dotnet you might have another microservice which is in java and you might have another one in some other maybe in php or in some other programming language so you have easy ease to adapt and whenever .

You have to make some changes in terms of the technology stack you will be able to make those changes quite conveniently the next positive point that i'll talk about is that you have fine grained fault tolerance so contrary to monolithic where you have to do the fault tolerance and the entire .

Application level here in case of microservice based architecture you will have your fault tolerance implemented at individual service level so in this way depending uh on your requirements depending on your business model you will be going at .

Any level that for example maybe in some business critical may some financial or some other related applications which are critical in nature you will have a higher level of fault tolerance and you will be having you will be dealing those errors and thoughts in a separate way and maybe you .

Have some other time critical applications for which the time and the response time is the major concern in that case you will be handling it separately and you will be doing it in a way that those responses are not impacted just because of .

Excessive fault tolerance so all this decision related to fault tolerance will be at the individual micro service level so that's it from this video and i hope that the information that i have conveyed to you through this video will be helpful for you of course i didn't go into much of the nitty-gritties and technical .

Details specific to each topic as the microservice architecture and the terms and the technologies and the concepts that are associated with this micro service architecture are quite huge so i cannot cover all of those in one video but i tried my best to focus on the .

Basics keeping in mind the beginners in as this video is focused on the beginners so if you have any questions of if you have any doubts you can always write in the comments section i'll try my best to respond to your questions and and to clarify if you have any doubts you can always refer to .

My website if you need any further assistance and if you want to read further about related topics as we have tons of videos and and other articles on on the website that's it from this video and if you like this video don't please don't forget to .

Subscribe to the channel and press the bell icon thank you very much


Most Popular