Featured Post

How to Include Non Academic Writing in Resume

How to Include Non Academic Writing in ResumeIf you are trying to get a job or just to keep your job, then you are most likely going to be r...

Wednesday, July 8, 2020

Microservices Tutorial for Beginners

Microservices Tutorial for Beginners Microservices Tutorial Learn all about Microservices with Example Back Home Categories Online Courses Mock Interviews Webinars NEW Community Write for Us Categories Artificial Intelligence AI vs Machine Learning vs Deep LearningMachine Learning AlgorithmsArtificial Intelligence TutorialWhat is Deep LearningDeep Learning TutorialInstall TensorFlowDeep Learning with PythonBackpropagationTensorFlow TutorialConvolutional Neural Network TutorialVIEW ALL BI and Visualization What is TableauTableau TutorialTableau Interview QuestionsWhat is InformaticaInformatica Interview QuestionsPower BI TutorialPower BI Interview QuestionsOLTP vs OLAPQlikView TutorialAdvanced Excel Formulas TutorialVIEW ALL Big Data What is HadoopHadoop ArchitectureHadoop TutorialHadoop Interview QuestionsHadoop EcosystemData Science vs Big Data vs Data AnalyticsWhat is Big DataMapReduce TutorialPig TutorialSpark TutorialSpark Interview QuestionsBig Data TutorialHive TutorialVIEW ALL Blockchain Blockchain TutorialWhat is BlockchainHyperledger FabricWhat Is EthereumEthereum TutorialB lockchain ApplicationsSolidity TutorialBlockchain ProgrammingHow Blockchain WorksVIEW ALL Cloud Computing What is AWSAWS TutorialAWS CertificationAzure Interview QuestionsAzure TutorialWhat Is Cloud ComputingWhat Is SalesforceIoT TutorialSalesforce TutorialSalesforce Interview QuestionsVIEW ALL Cyber Security Cloud SecurityWhat is CryptographyNmap TutorialSQL Injection AttacksHow To Install Kali LinuxHow to become an Ethical Hacker?Footprinting in Ethical HackingNetwork Scanning for Ethical HackingARP SpoofingApplication SecurityVIEW ALL Data Science Python Pandas TutorialWhat is Machine LearningMachine Learning TutorialMachine Learning ProjectsMachine Learning Interview QuestionsWhat Is Data ScienceSAS TutorialR TutorialData Science ProjectsHow to become a data scientistData Science Interview QuestionsData Scientist SalaryVIEW ALL Data Warehousing and ETL What is Data WarehouseDimension Table in Data WarehousingData Warehousing Interview QuestionsData warehouse architectureTalend T utorialTalend ETL ToolTalend Interview QuestionsFact Table and its TypesInformatica TransformationsInformatica TutorialVIEW ALL Databases What is MySQLMySQL Data TypesSQL JoinsSQL Data TypesWhat is MongoDBMongoDB Interview QuestionsMySQL TutorialSQL Interview QuestionsSQL CommandsMySQL Interview QuestionsVIEW ALL DevOps What is DevOpsDevOps vs AgileDevOps ToolsDevOps TutorialHow To Become A DevOps EngineerDevOps Interview QuestionsWhat Is DockerDocker TutorialDocker Interview QuestionsWhat Is ChefWhat Is KubernetesKubernetes TutorialVIEW ALL Front End Web Development What is JavaScript â€" All You Need To Know About JavaScriptJavaScript TutorialJavaScript Interview QuestionsJavaScript FrameworksAngular TutorialAngular Interview QuestionsWhat is REST API?React TutorialReact vs AngularjQuery TutorialNode TutorialReact Interview QuestionsVIEW ALL Mobile Development Android TutorialAndroid Interview QuestionsAndroid ArchitectureAndroid SQLite DatabaseProgramming ... Microservices Archit ecture Training (12 Blogs) Become a Certified Professional AWS Global Infrastructure Introduction to Microservices What Is Microservices â€" Introduction To Microservice ArchitectureMicroservices Tutorial â€" Learn all about Microservices with ExampleTop 10 Reasons Why You Should Learn MicroservicesMicroservices vs API : How Do These Two Fare Together?Top Microservices Tools You Must Know In 2019 Microservices Architecture Microservice Architecture â€" Learn, Build and Deploy MicroservicesMicroservices vs SOA : What's the DifferenceEverything You Need To Know About Microservices Design Patterns Microservices using Spring Boot Spring Boot Eclipse and CLI Setup to Run Spring Boot ApplicationsSpring Boot Microservices: Building Microservices Application Using Spring Boot Microservices Security How To Secure Your Microservice Infrastructure? Microservices Interview Questions Top 50 Microservices Interview Questions You Must Prepare In 2020Cloud Computing Topics CoveredAWS A rchitect Certification Training (47 Blogs)AWS Development (10 Blogs)SFDC Administration Foundation (3 Blogs)Salesforce Admin and Dev Foundation (9 Blogs)SEE MORE Microservices Tutorial Learn all about Microservices with Example Last updated on Nov 26,2019 87.3K Views Sahiti Kappagantula515 Comments Bookmark 2 / 5 Blog from Introduction to Microservices Become a Certified Professional Microservices TutorialOrganizations are quickly moving towards Microservicesarchitecture hunting for professionals withMicroservices Certification.I hope that you have read my previous blog onWhat is Microservicesthat explains the architecture, comparesmicroserviceswith monolithic and SOA, and also explores when to use microservices with the help of use-cases.In this Microservices tutorial, the following topics will be covered: Monolithic Architecture Challenges of Monolithic ArchitectureWhat is MicroservicesMicroservice ArchitectureMicroservices Example DemoLet us explore the concepts of micr oservices through a use-case on Mediamore.com.Mediamore is an entertainment company which provides streaming media and videos online. It consists of various genres of TV Shows in different languages. Like many other companies mediamore started its journey with a monolithic architecture.Let us now explore the monolithic framework of mediamore.Monolithic ArchitectureFigure 1: Monolithic Architecture of Mediamore Microservices TutorialRefer to the above diagram. We can infer that all the features such as the search, user-info, recommendations, videoplaylist and others are put on a single database using single code.Now, let me tell you the challenges faced by the developers while using a monolithic frameworkby using some scenarios.Challenges of Monolithic ArchitectureScenario 1: Scalability:Lets assume that the developers want toupdate the playlist according to most popular tv shows and also simultaneously want to update all videos to HD quality.The developers cannotscale the applicati on simultaneously. New instances of the same application have to be created every time a new feature has to be developed or deployed.Scenario 2: Agility:Assume that developers want to make immediate changes in the application.The monolithic application can definitely accommodate these changes. But, the problem here is that the developers have to rebuild the code for every small change.Scenario 3: Hybrid Technologies: Suppose developers of this application are comfortable with various technologies like JAVA, C++,.NET, C#.Even though they are comfortable with various technologies, they still have to build large and complex applications on a single technology.Scenario 4: Fault Tolerance:Lets suppose that a specific feature is not working in the application.The complete system goes down because of this problem. In order to tackle this problem, the application has to be re-built, re-tested and also re-deployed.So, how did the developersof mediamore overcome these complexities?Developers thus decided to re-architect their monolithic application into multiple individual deployable components, called as microservices.Here lies the million dollar question!What is Microservices?Microservices is an architecture wherein all the components of the system are put into individual components, which can be built, deployed, and scaled individually.Let me explain you with a simple analogy.You must have seen how bees build their honeycomb by aligning hexagonal wax cells. They initially start with a small section using various materials and continue to build a large beehive out of it. These cells form a pattern resulting in a strong structure which holds together a particular section of the beehive. Here, each cell is independent of the other but it is also correlated with the other cells. This means that damage to one cell does not damage the other cells, so, bees can reconstruct these cells without impacting the complete beehive.Figure 2:Beehive Representation of Microservices M icroservices TutorialRefer to the above diagram. Here, each hexagonal shape represents an individual service component. Similar to the working of bees, each agile team builds an individual service component with the available frameworks and the chosen technology stack. Just as in a beehive, each service component forms a strong microservice architecture to provide better scalability. Also, issues with each service component can be handled individually by the agile team with no or minimal impact on the entire application.The next question that may come to your mind is how do the different components of microservice architecture work together.But, before that, let me list down the components of the microservice architecture.Refer to the below diagram.Figure 3: Microservices Architecture Microservices TutorialClients Different users from various devices send requests.Identity Providers Authenticates user or clients identities and issues security tokens.API Gateway Handles client re quests.Static Content Houses all the content of the system.Management Balances services on nodes and identifies failures.Service Discovery A guide to find the route of communication between microservices.Content Delivery Networks Distributed network of proxy servers and their data centers.Remote Service Enables the remote access information that resides on a network of IT devices.Let me now brief you on how these components work together on mediamore by considering a scenario.Microservice ArchitectureScenario:Alice is an avid user of mediamore. She uses mediamore regularly to watch her favorite series online. She recently missed watching an episode of her favorite TV show.When Alice logs in to the application, she sees the most recommended content on her home page. After some searching, she finally finds her TV Show.But, what if Alice wants to get her TV Show with a single click.How will the developers work together to fulfill Alices request?Alices request is passed on to the I dentity Provider. Identity provider thus authenticates Alices request by identifying her as a regular user on mediamore.These requests are passed to the API Gateway which acts as an entry point for Alice to forward her requests to the appropriate microservices.Each feature has its own working microservice, handling their own data. These microservices also have their own load balancers and execution environments to function properly.Figure 4: Microservices Architecture of Mediamore Microservices TutorialRefer to the diagram below. Each microservice is handled by a small agile team such as content team, video uploading team, most trending team, search team etc.Figure 5:Division of Teams of Mediamore Microservices TutorialThe content team consists of millions of TV Shows that the application provides. The video uploading team have the responsibility to upload all the content into the applicationThe most trending team houses the most trending shows according to the geographical locati on of users and so on.These small teams of developers relate each and every piece of content with the metadata that describes the searched content. Then, metadata is fed into another microservice i.e. the search function which ensures Alices search results are captures into the content catalog.Then, the third microservice i.e. most trending microservice captures the trending content among all the mediamore users according to their geographical locations.The content from this microservice is what Alice sees when she first logs into mediamore.These individually deployable microservices are put in specific containers to join the application. Containers are used to deliver the code to the sector where deployment is required. But before they join the application to work together, they have to find each other to fulfil Alices request.How do these microservices find each other?Microservices use service discovery which acts as a guide to find the route of communication between each of them. Microservices then communicate with each other via a stateless server i.e. either by HTTP Request/Message Bus.Figure 6:Communication Between Microservices Microservices TutorialThese microservices communicate with each other using an Application Program Interface(API).After the Microservices communicate within themselves, they deploy the static content to a cloud-based storage service that can deliver them directly to the clients viaContent Delivery Networks (CDNs).So, when Alice searches for her TV Show, the search microservice communicates with the content catalog service in API about what is Alice searching for and then these microservices compare the typed words with the metadata they already have.Figure 7:Representation of how to search operation is performed with the help of API Microservices TutorialOnce the teams of developers capture the most typed words by Alice, the analytics team update the code in recommendations microservice and compare Alices most viewed content an d preferences to popular content among other users in the same geographical region.This means that the next time Alice logs on to the application, she not only sees the most popular content but also finds a personalized playlist which contains the shows she has previously viewed.In this way, Alices request is fulfilled by the development team in a quick manner as they did not have to build the complete application again and just had to update the code to deploy this new functionality.So this way microservices invoke parallelenvironments to satisfy millions of customers with varying interests.Now in this Microservices Tutorial, my next section will focus on Hands-On.Subscribe to our youtube channel to get new updates..! Microservices Example DemoTo demonstrate the concepts of microservices, I have created 3 Maven Projects called as Doctor_Microservice_Edureka, Diagnosis_Microservice_Edureka, and Patient_Microservice_Edureka using Spring Boot.Refer to the snapshot below.Before you u nderstand how these 3 projects interact with each other. Let me brief you on the files of these projects.To explain this I will consider the project Patient_Microservice_Edureka and list down its basic files.Refer to the snapshot below.Pom.xml Dependencies are added for the creation of REST services.Application.java Identical class in all three projects. Acts as an initiator to Spring Boot.ApplicationConfiguration.java Research configuration class responsible for exposing REST services for application users.Patient.java A simple class consisting of input such as the patients name, id, email.PatientRest.java Starts the implementation of the REST services in the project.In this way, similar files are created for the other 2 projects with some additional files in Doctor_Microservice.REST services are thus created to search patients and the diagnosis. Keys of patient and diagnosis are passed as a parameter to a method(PatientDetails) in Doctor_Microservice.This method gets the data of the patients and diseases.Refer to the snapshot above. Here, we observe that Patient and Diagnosis classes are included in Doctor_Microservice_Edureka. These classes are cloned from their original projects.Then to start the REST services, I have initialized Patient_Microservice_Edurekaon port 8081, Diagnosis_Microservice_Edurekaon 8082 and the Doctor_Microservice_Edureka on port 8083.With the above configurations, when I run each service simultaneously, 3 different console windows run in the Eclipse console window.As you can see below that after we run the projects, Spring Boot generates a boot log. This log consists information on initializing tomcat and its associated resources. The last line of the log indicates us whether our application has started or not.To test if the patient and diagnosis services are functioning properly, one abrowser (Mozilla Firefox) and go tohttp://localhost:8081/ andhttp://localhost:8082/ URLs. You should get the outputs as shown below:Finally, to t est the functionality of the Doctor_Microservice_Edureka, I simulated the information of the patient with id 2, suffering from a disease of id 3 and consulting a doctor with consultation 4.The URL used is as follows:http://localhost:8083/doctor?idPatient=2idDiagnosis=3consultation=4Refer to the snapshot below for the output.In this way, 3 Microservices interact with each other to produce the desired results.I hope you have enjoyed reading this Microservices Tutorial. We have seen a simple example to understand how different microservices communicate with each other.If you want the source code of the example shown, please comment out in the comments section.After this Microservices Tutorial, we will be getting into the depth of practical implementations on microservices with the next blog i.e. Microservices using SpringBoot. Stay tuned! Want To Explore More About Microservices? View Batches Now If you wish to learn Microservices and build your own applications, then check out ourMic roservices Architecture Trainingwhichcomes with instructor-led live training and real-life project experience.This training will help you understand Microservices in depth and help you achieve mastery over the subject.Got a question for us? Please mention it in the comments section of Microservice Tutorial and I will get back to you.Recommended videos for you Building Scalable Application on Cloud Watch Now Efficient Disaster Recovery with Cloud Computing Watch Now Architecting in Cloud-II Watch Now Cloud Computing with AWS II Watch Now Power The Hadoop Cluster With AWS Cloud Watch Now What Is AWS Getting Started With AWS Watch Now AWS Tutorial A Complete Tutorial On Amazon Web Services Watch Now Microsoft Azure Tutorial Step-By-Step Tutorial In Azure Watch Now AWS Vs Azure Cloud Platform Comparison Watch Now AWS Certifications All You Need To Know Watch Now What Is Cloud Computing? A Beginners Guide To Understanding Cloud Watch Now AWS vs Google Cloud Cloud Platform Compare d Watch Now Architecting in Cloud-III Watch NowRecommended blogs for you How To Create Hadoop Cluster With Amazon EMR? Read Article RDS AWS Tutorial: Getting Started With Relational Database Service Read Article How To Become A Cloud Engineer? Read Article Microservices Security How To Secure Your Microservice Infrastructure? Read Article Amazon Route 53: All You Need To Know About Latency Based Routing Read Article AWS Fargate A Compute Engine For ECS Read Article Top 10 Reasons To Learn AWS Read Article Everything You Need To Know About Azure Machine Learning Service Read Article AWS Certification â€" All you need to know Read Article What is Azure? An Introduction To Microsoft Azure Cloud Read Article Running Docker In Production Using Amazon ECS Read Article AWS Data Pipeline Tutorial A Data Workflow Orchestration Service Read Article Introduction to Cloud Computing with AWS Read Article AWS Certification: Your Key To Career Opportunities In Amazon Web Services Read Article G oogle Cloud Pricing Google Cloud Platform Pricing Calculator Read Article AWS CodeCommit A New Home For Your Repository Read Article What Is ServiceNow? A Cloud Solution For Your Enterprise Read Article Google Cloud Platform Tutorial : Getting Started With Google Cloud Platform Read Article Azure Virtual Network For Beginners Securing Your Applications Using VPC Read Article Top AWS Architect Interview Questions In 2020 Read Article Comments 515 Comments Trending Courses in Cloud Computing Microsoft Certified Expert: Azure Solutions A ...6k Enrolled LearnersWeekendLive Class Reviews 5 (2250)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.