Microservices interview question and answers | Architecture design and Best practices

preview_player
Показать описание
This Microservices Interview Questions and Answers video will help you to prepare for the Microservices Interviews.

Below are the topics cover in this micro-services interview question and answers tutorial:
1) Basic Microservices Interview Questions
2) Microservices Architecture Interview Questions
3) Migration of monolithic application to microservices
4) Communication between micro-services
5) Continuous Deployment Interview Questions
6) Technologies used in Microservices
7) Microservices best practices
8) Drawbacks of microservices

----------------------------------------
⚙️Gears used⚙️

------------------------------------------------
Follow me on:
-----------------------------------------------

#Microservices #MicroservicesInterviewQuestions
Рекомендации по теме
Комментарии
Автор

Micro Services Interview Questions

01. so tell me what do you understand by microservices?
Ans: microservice basically decoupling of entire application into small small services. like if I take an example of Amazon or Uber or like you can say any application. so like take example of Amazon okay so in Amazon we'll have like many partners like seller then we will have buyers and at the end we'll have like persons from Amazon who will be managing all the applications or like we'll be seeing the transactions and every other details so we will mention it as an admin so this is an entire application say suppose it is written in Java so what happen is like if I need to change something like in buyer I need to change a small like I want to give an offer of 5% so what I need to do I need to write the code and deploy the entire application so instead of this we can use microservice based architecture where the seller will be a single application buyer will be another application and the admin would be another application so here what happen is like if the admin is down or like if the server is down the entire Amazon website is down so but in this case if admin is down people can use the buyer option or like if the seller is down seller will not be able to add any further items to his store but the buyer can able to check out from his cart and or you can add anything from other sellers or which are already in the stores and if suppose I want to change something in seller and want to deploy, so will just go and deploy this application and the seller what happened is like it may be written in Java it may be written in .net it may be written in node.js so you.

02. so you said that it is a decoupled architecture so coming to that can you explain what are the major differences between service-oriented architecture or monolithic application and a micro service?
Ans: so what happen is like as I already told that in service-oriented architecture or monolithic application is the entire application so the application monolithic application is the whole block of application service layer or SOA service-oriented architecture is like we define small small module but inside the same application only so we make it modular wise like we take the part of if you take the example of Java we created packages we create interface for particularly for DAO a particularly for seller particularly for customer and particularly for admin and in micro service what we have is like we'll have more granular level of breakdowns like in seller also we can have different types of sellers like from us we can have the part for us only which will be running on any servers on us or we can have clients of any other applications who will be interacting with or auth layer for particularly sellers and auth layer for particularly admin 2 different applications we can have so all these are completely segregated and talked to each other in like over an HTTP and not throw the application himself so if I draw an example like monolithic SOA and if I take the example of micro service I can say like microservice and there can be N number of microservices okay now I will give you

03. two scenarios first design a simple micro service architecture application and the second scenario is migrate the existing monolithic application to microservices and what will be your means approach or whatever your thought process to break down those into small small micro services like you took example of Amazon right so you can just show how Amazon can or if you are owner of Amazon that particulars software so how you would have broken it into small small micro services so how I design a micro service is like if it is a new application
Ans: as you already told since it is a new application so I'll just take the requirements so I will ask like who are the users what are the existing schema how the relationships are mapped like like what are the dependencies like I can have like buyers and sellers so both are actually correlated we can't segregate it out completely so the database, how will manage the databases and all so if I take example of buyer and seller only so buyer will have its own name ID and like items so we have three tables and seller will have like cart details and items brought so these means different tables so this item and this item is related so it is like it can't be like I have brought here like a pan and the buyer doesn't sell a pen or any of the buyers doesn't sell any pen so it it is related so how it interact is like I will call this and suppose he brought already one item or added it so it it will get deleted from here and it will be added here so this is how but these things are completely independent these and these are completely independent so we can keep it out and build two microservices micro-service one and microservices yeah this is how means generally we define micro-services for if I am going for a new application and say it is database and this is database and how we will break a micro surface actually this is a long term process it doesn't work so quickly or so nicely so what we can do is like in monolithic application there we need to change the existing application also side by side and there are micro services so suppose we have buyer-seller and we want to take this out and make it as a micro service so what we can do is like instead of buyer calling this we need to have like a mechanism to call an API so admin will also be there residing and API for admin also and it will point to this micro service so we'll build this micro service we'll take this part this is business logic from here and put it here and once it is done then we'll just point it out instead of calling this we will now call this and instead of calling this we will now call this so this is how we break down so we need to take care of similarly the table structure I mean the schema and we need to means slowly and gradually we need to take these and map so it's like a long term process
04. while breaking those micro services what so it's like a long term process so while breaking the micro services what are the advantages you have and what are the drawbacks while using all this micro service based architecture
Ans: so the main advantages of micro service is like earlier I told that we will deploy okay so how will define is like a we have buyer then we have seller and we have admin so like Independently we can deploy independently we can make the code change so it's fault tolerant like if it goes down it will be up it will be up then what else one more thing is like we can expand it like we can scale it so like independently we can have entire admin then admin and we can have a load balancer to navigate the traffic and one more thing is like as its mainly practiced by Netflix so like an individual contributor or an individual developer will take like the requirement then he will deploy he will make the code changes then he will deploy it in like cloud or any server independently so he takes a complete responsibility smaller tasks and more thing and one more thing is like it can be written in Java it can be written in node.js so there is no like dependence on any particular technology so anyone can use any technology this is the main criteria so the main problem is like we can have multiple layers of authentication like micro service one is talking to micro service to micro service 3 then it is talking to individually they are talking with each other then micro service 4 the micro service 5 and suppose like so first of all we need to have individual deployment strategy for each one and suppose if something goes failed here so we need to find out we need to find the root cause or why it got failed so we need to debug all the stages here and why it got failed you need to check and on the top of that we need to have multiple layers of authentications, so for micro service 3 it may able to access few of the applications or few of the API so this one will give like auth this one may have authorization type 2 so here we need to implement multiple types of authorization means like for each one individual applications we need to give multiple layers of authentication or authorizations

05. so you have hierarchical of micro services like micro service one and micro service 2 is talking to micro service 3 suppose which is an auth layer and the micro service 3 is talking to some other micro services like 4 and 5 respectively so if something goes wrong like in micro service layer third or layer 4 something went wrong so how you will know that that micro Service is failing and you need to debug that micro service application logs?
Ans: so to answer your question suppose I have multiple layers of micro services so what we can do is like we can traffic all the logs to Splunk or Kibana or we can say elasticsearch and for each request we can generate a correlation ID so this correlation ID would be passed through each of the headers and it will be logged in the Splunk or like elasticsearch and like suppose if anything goes wrong with this request we can later take out that request and see okay how we can process it from the backend so that's how and if something suppose this server went down so we can have a health check to look for all the servers and suppose this went down the health check will return to the Kibana or email notification like that we can have

infomahboobali
Автор

I really appreciate your efforts, It was so good. Small confusion u took the same example for both SOA and MicroServices. Well said, MicroServices uses smallest possible independent Unit which can be easily modified and deployed. In your example - SOA Buyer module can be further be converted in to Customer-MS1, AddressAndDeliveryAddress-MS2 - Here Buyer module can be further divided in to smaller units - Tomorrow if delivery related any extra requirements comes then in that case AddressAndDeliveryAddress-MS2 will get effected and Customer-MS1 will be untouched. I am not sure my example suits in this case or not - I am just adding one more example for better understanding purpose.


Disadvantages of MicroServices not covered-
When it will be difficult to manage
How many maximum number of MS can an product can have, if huge number what are possible challanges, What kind of mechanisms will help to fix dependent issues when you have more and more microServices you have.


Which sectors are not suitable

MicroServices are not suitable for Finance sectors and few other where hudge number of business rules which are interrelated and huge data modifications and data depedndencies.

It is easy pick for CDN, videostream, social media networking related where data is not frequently changing and hence you can bring up more smaller units effortlessly and which becomes easy maintenance and also easy scaling for required ones

eshwareshwar
Автор

My first video on microservices before an year, now I am software engineer at product based company working full time on designing and implementing microservices everyday. TBH I gave same answer in FAANG interviews too they were impressed too

saiyashwanth
Автор

Its funny that so many "Egoistic experts" are so triggered when a particular technology is not explained completely. Remember that this is not a tutorial about Microservice. Its just demonstrating a typical technical interview and how one can answer particular questions.

winuxworx
Автор

Nice attempt and good work :) Just a word - At around 15 mins of speaking of best practices while developing a product in microservice pattern, you said we can separate out DB for each service. Actually that is the main point of microservice. Not only buisness functionalty is separate so is the data. In case two microserviecs share the same DS, it is more of a SOA pattern. So always each microservice, if they talk to a db should and will have their own DS and we can have MQ to sync data in case it is required and difff transaction mechanism/pattern to manage transaction across DB.

Martin Fowlers first words are each service is not only decoupled at its own business concern but should not share data from a common datascource, data should be passed along each microservice through an Endpoint.


Good luck . :)

priyakdey
Автор

The diagrams are really helpful to see the overall concepts quickly.. thank you!

devolee
Автор

Very good explanation. Need to add more information for transaction scope and db separation. How to divide a db to support micro services.. How to maintain a table which is common for multiple apps. for example, An Employee can create a sales order so Employee app and Sales app shares common table called employee.. How to maintain that? If a sales order is created (sales app) but during the credit card charge (accounting app), it is failed so how to rollback sales order? These are the some of the real life questions

shahk
Автор

This is really awesome interview discussion, which helps many who are looking to change jobs. Thank you so much for posing excellent video.

AndhraKitchenFoods
Автор

@CodeSpace
In your video you demonstrated that one microservice directly using another microservice. That approach is still monolithic my friend. Microservice calling APIs of another microservice is not how microservices communicate. You didn't mention about service discovery/registry anywhere in the video which is one of the critical piece. Also there is no mention of fault tolerance, that is how to recover when an error occurs

hi-gqrn
Автор

this is awsome way of helping people out there looking to crack Job interviews. Thanks a lot ! !

deveshkumar
Автор

Very easy to understand even if person does not have any background On Microservices. Thanks you for sharing it.

sarikaagrawal
Автор

All I can say is " Thanks a lot " .
Keep helping us .

DeepakKumar-whbv
Автор

Great Video. Bit hesitated to open the video after seeing the Thumbnail (No offense, Many such videos are in Hindi ), But I was wrong. It's Really informative.
Few questions..
1. Assume in Order process 5 microservices taking part of transaction in sequence and if 4th Microservice failed while processing then how will you rollback the entire transaction?
2. You mentioned Microservices will be built as Stateless and session preserved in Redis. IIS usually kills session once it expire, But how Redis Will kill session which are completed or aborted?
3. Per Standard each Microservice should have it own database. But in Industrial application, we can have only single common database. How to manage database without sharing between microservices?

venkatx
Автор

What I listen here for SOA is principle of modular programming that SOA shares, but what is SOA and what differ from Micrsoservices ? SOA is architecture that has separated e indipendent services and decribes what protocols to use for to comunicate each others, this common comunication is the ESB and it is its weakness. The aspect of separate and indipendent services brings SOA closer to microservices but the fundamental difference is that in microservices architecture there is no ESB and therefore the microservice is free to use the most appropriate comunication protocol for the situation.

AlessandroForcuti
Автор

Nice attempt .video was simply good.great work .

bathulanagendra
Автор

Total cinema in 20 min ... Awesome.. liked the explanations....

MrRam
Автор

Very Good Attempt. This video provides brief explanation of all the details for the Micro-service Architecture and Details. It would be helpful if you can make more videos on Spring, Hibernate, Databases, Restful like technologies too for Experienced levels. All the best. Thank you.

gajjalapuusha
Автор

I am not very expert in the microservices or anything, but just observed one things fir your first question.. taking example for changing code for giving 5% discount is little wrong in the first place. this 5% should be associated with the product somewhere and store at some configurable place. might be FS or DB. if you means to say whole about discount feature, then you explanation is right.

agraa
Автор

Sir u r specilly born to motivate people and free from their difficulties and stress...U r inspirational and awesome..

nageshrandive
Автор

I think you are confused about SOA and microservice . explanation is not complete and ambiguous

arghamukherjee