110 Frequently Asked Microservices Interview Questions and Answers
1. What is a Microservice ?
Answer: Microservice is an architectural style which can structure an application as a collection of self contained, loosely coupled services. We will create microservices in several languages which includes Java, Scala, Node.js etc.
2. What are similarities and differences of Microservices with SOA services?
Answer: Following are the similarities of Microservice(MS) with SOA
services :
1. Micro services are loosely coupled and it interact with each other through json, xml etc
2. Both are reusable and will be accessed through desktop application, web applications, mobile applications and even be called by other micro services.
3. WADL, JSON Schema or Swagger will mostly used to describe the microservices.
Following are difference between SOA and MS:
1. There is no physical infrastructure dependency with microservices.
2. They are usually deployed in Docker containers that will encapsulate both the code and required libraries.
3. Microservices will not relay on enterprise products like ESB.
3. Explain Microservice architecture.
Microservice architecture is consist of small, independent, self- contained services which will implement a single functionality.
1. Client : The Client is a desktop or mobile client or even another microservice.
2. API Gateway : It can handle client and will request and forwards to the appropriate service.
3. Service : Small, independent, loosely coupled microservices.
4. Service Discovery : It will Enable service lookup for finding the endpoint for a service.
4. What is a Gateway in microservice?
Answer: Clients will not directly invoke microservices, they will go through the Gateway. The Gateway in turn can call the microservices and will return the response to the client.
The Gateway can decouple the microservices from the clients. It will provide functions such as authentication, logging, load balancing etc.
5. Which tools you use for automation in microservice environments?
Answer: Microservices will be automated starting from development till deployment to production.
1. GIT will mostly used to version control.
2. Jenkins will be used for continuous integration.
3. Testing tools such as JUnit, Selenium will be used for automating testing.
4. Container technologies such as Docker will be used with release management tools such as Chef or Puppet for
infrastructure management automation.
5.Deployment automation will done using tools like Kubernetes or Spring Cloud.
6. What is Spring Cloud?
Spring Cloud will provide tools for developers for quickly building some of the common patterns in distributed systems example for configuration management, service discovery, circuit breakers, intelligent routing, leadership election, distributed sessions, cluster state.
7. What is Spring Boot? Why is Spring Boot popular for Java microservice development ?
Answer: Spring boot will provide a lot of boiler plate code and configurations which we are manually doing for application development. It can abstract the maven dependencies, configurations, application server and reduces development time.
8. What are advantages of using Microservices over traditional monolithic architecture?
Answer: Microservices-based architectures enable continuous delivery and deployment. Microservices are smaller in size and can be quickly built & delivered. This is a great fit in Agile development as the business users don’t have to wait to see the product. In Microservice architecture, the individual services can be built in different language like Java, Scala. Also, different microservices could be on different versions of the same language like Java 8 & 9.
Microservices are independent, therefore one microservice can be independently scaled up or down independent of other microservices. For example, if in Airline ticketing company, the ratio between flight ticket searches and bookings is 50:1, then the search microservice can be scaled up without impacting the ticket booking microservice.This brings down the cost as the company doesn’t have to scale the whole application to meet the
performance needs. With microservices, we can easily change the technology or version of individual services rather than having to affect the whole product.
Microservices are automation friendly and the changes can be continuously integrated with DevOps to increase speed of delivery.
9. What is CI/CD?
Answer: Continuous Integration(CI) is the practice to automatically build and unit test an entire application frequently, ideally on every source code check-in. Continuous Delivery(CD) is the practice to deploy every build to
a production such as environment and perform automated integration and acceptance testing after it will pass its build and unit tests.
This is needed therefore that errors will be identified at an early state and little to no coordination is needed between different teams build different microservices.
10. How do you monitor microservices?
Answer: Spring Boot actuator will be a good tool monitor metrics, counters for individual microservices. But if we have multiple microservices, it is difficult to monitor each individually. We will use open source tools such as Prometheous, Kibana or Graphana for this . Prometheous is a pull based monitoring tool and it will contain metrics at provided intervals, displays them and will also trigger alerts. Kibana or Grafana are dashboard tools which are used for visualizing and monitor the data. When there will be large number of microservices with dependencies, we will use AppDynamics, Dynatrace, and New Relic that will draw dependencies among microservices.
11. What is Kubernetes?
Answer: Kubernetes is the market leading orchestration solution. It will help with automating container deployments, scheduling, and the scalability of containers. Kubernetes can support features like automatic progressive rollouts, versioned deployments, and container resiliency, if containers will fail due to some reason.
files by the
12. How do you manage logging with Microservices?
Answer: We should avoid storing or routing the log application itself with microservices, . The solution is for centrally store and analyze all log messages. In this approach, log messages will be shipped from execution
environments to a central big data store. As part of centralized logging solution, several Cloud logging services such as Loggly, Google Cloud Logging will be available. We will also use popular commercial logging solutions such as
Splunk for log management and analysis.
13. How do you build Fault tolerant microservices ?
Answer: We will use Hystrix for this. Hystrix is a Fault and latency tolerance library designed by Netflix.
Hystrix will be based on the fail fast and rapid recovery principles. There are many microservices involved usually for systems developed using Microservices architecture. These microservices will collaborate with each other.
Hystrix will help isolate it, if there is an issue with a service. It can help to recover quickly by falling back to another
preconfigured fallback service.
14. What is a Reverse Proxy?
Answer: Reverse proxy will retrieve resources from one or more services on behalf of the client. Common uses for a reverse proxy server will include:
1. Load balancing
2. Security
15. What is Cohesion?
Answer: Cohesion is the degree of a module or service belong together inside elements. Microservices will be highly cohesive in nature.
16. What is Coupling and how microservices should be coupled?
Answer: Coupling is the degree of interdependence among software modules. It will be a measure of closeness connected two routines or modules. Microservices will be loosely coupled with each other.
17. What is an Actuator?
Answer: Actuator will be used in Spring Boot for monitoring the state of a microservice. Spring Boot actuators will provide restful service end points which will be used for checking the various metrices.
18. What is difference between REST and Microservice?
Answer: Microservice is an architectural style which will structures an application as a collection of self contained, loosely coupled services. RESTful services is a way for implementing microservices.
19. What is bounded context? What is DRY principle in microservices?
Answer: A bounded context will be thought of a logical boundary. A Bounded Context will encapsulate the details of a single domain, like domain model, data model, application services, etc., and will define the integration points with other bounded contexts or domains. DRY is stand for Don’t Repeat Yourself.
It will promote code reusability.
20. What are the features of Micro services?
Answer: 1. Decoupling: These Services within a system will be largely decoupled. Therefore the application as a whole will be easily built, altered, and scaled.
2. Componentization: Microservices will be treated as independent components which can be easily replaced and
upgraded.
3. Business Capabilities :Microservices will be very simple and focus on a single capability.
4. Autonomy: Developers and teams will work independently of each other, therefore increasing speed.
5. Continous Delivery: It will Allow frequent releases of software, through systematic automation of software creation, testing, and approval.
6. Responsibility: Microservices will not focus on applications as projects. They will treat applications as products for which they will be responsible.
7. Decentralized Governance: The focus will be on using the right tool for the right job. That means there will be no
standardized pattern or any technology pattern. Developers will have the freedom for choosing the best useful tools for solving their problems.
8. Agility: Microservices will support agile development. Any new feature will be quickly developed and discarded again.
21. How does Microservice Architecture work?
Answer: 1. Clients: Different users from various devices will send requests.
2. Identity Providers: Will Authenticate user or clients identities and issues security tokens.
3. API Gateway: will Handle client requests.
4. Static Content: Houses all the content of the system.
5. Management: will balance services on nodes and identifies failures.
6. Service Discovery: A guide for finding the route of communication between microservices.
7. Content Delivery Networks: will Distribute network of proxy servers and their data centers.
8. Remote Service: will Enable the remote access information which will reside on a network of IT devices.
22. What are the pros of Spring Cloud?
Answer: Following are pros of Sping cloud:
1. Complexity associated with distributed systems: This overhead will include network issues, Latency overhead,
Bandwidth issues, security issues.
2. Service Discovery: Service discovery tools will manage how processes and services in a cluster will find and talk to one another. It will involve a directory of services, registering services in that directory, and then being able to lookup and connect for services in that directory.
3. Redundancy: Redundancy will issue in distributed systems.
4. Load balancing: Load balancing will improve the distribution of workloads across multiple computing resources, like computers, a computer cluster, network links, central processing units, or disk drives.
5. Performance issues: Performance will issues due to various operational overheads.
6. Deployment complexities: Requirement of DevOps skills.
23. What Netflix projects did we use?
Answer: Eureka is created by Netflix which is the Netflix Service Discovery Server and Client. Netflix Ribbon which will provide several algorithm for Client-Side Load Balancing. Spring will provide smart Rest Template for service discovery and load balancing by using @Load Balanced annotation with Rest Template instance.
24. How will you monitor multiple microservices for various indicators like Health?
Answer: Spring Boot will provide actuator endpoints for monitoring metrics of individual microservices. These end points will be very special and helpful to get information about applications such as if they will be up, if their components such as database etc will be working good. A major drawback or difficulty to use actuator endpoints is that we have to individually hit the endpoints for applications to have knowledge about their status or health. Imagine microservices will involve 50 applications, the admin can have to hit the actuator endpoints of all 50 applications. To help us deal with this situation, we can be using open source project located at Built on top of Spring Boot Actuator, it will provide a web UI for enabling us visualize
the metrics of multiple applications.
25. What is the difference between Service Registration and Discovery?
Answer: We usually have all the configurations in the properties file when we will start a project. As more and more services will be developed and deployed, adding and modifying these properties will become more complex. Some services may go down, while some the location may change. This manual change of properties will create issues. Eureka Service Registration and Discovery will help in such scenarios. As all services will registered to the Eureka server and lookup done by calling the Eureka Server, any change in service locations required not be handled and is taken care of.
26. What are the Pros of Microservices?
Answer: There will be many advantages in using microservices because these components will not be dependent on the same coding language. developers will use the ones they will be most familiar.
1. Smaller code base is easy to maintain.
2. Easy to scale as individual component
3.Technology diversity i.e. we can mix libraries, databases, frameworks etc
4. Fault isolation i.e. a process failure should not bring whole system down
5. Better support for smaller and parallel team
6. The developers can make use of the latest technologies
7. The code is organized around business capabilities
8. Independent deployment
9. Deployment time reduce
27. Can you explain the Design patterns for microservices?
Answer:
1. Ambassador: It will be used for offload common client connectivity tasks like monitoring, logging, routing, and security such as TLS in a language agnostic way.
2. Anti-corruption layer: This layer will implement a façade between new and legacy applications, for ensuring that the design of a new application will not be limited by dependencies on legacy systems.
3. Backends for Frontends: It will create separate backend services for different types of clients, like desktop and mobile. That way, a single backend service will not required for handling the conflicting requirements of various client types. This pattern will help keep each microservice simple, by separating client-specific concerns.
4. Bulkhead: It will isolate critical resources, like connection pool, memory, and CPU, for each workload or service. By using bulkheads, a single workload or service will not consume all of the resources, starving others. This pattern will increase the resiliency of the system by preventing cascading failures caused by one service.
5. Gateway Aggregation: This aggregates will request to multiple individual microservices into a single request, reducing chattiness between consumers and services.
6. Gateway Offloading: It will enable each microservice to offload shared service functionality, like the use of SSL
certificates, to an API gateway.
7. Gateway Routing: It will route requests for multiple microservices using a single endpoint, so that consumers will
not required to manage many separate endpoints. Sidecar will deploy helper components of an application as a separate container or process for providing isolation and encapsulation.
8. Strangler: It will support incremental migration by gradually replacing specific pieces of functionality with new services.
28. Can you explain the spring batch framework with respect to Microservices?
Answer:
It will be a batch framework which is quite comprehensive and will be light in weight on the application. Its lightweight nature is a great source of positivity in the realm of Microservices. This is so because it will be designed in such a manner that it will facilitate the development of robust batch applications. It will be kind of a feature in the realm of Microservices which will be easily build upon productivity. It will be especially used in the development of enterprise applications which are necessary for making sure that the applications developed are able to meet the set standards of a particular organization.
29. How to achieve server side load balancing using Spring Cloud?
Answer: Server side load balancing will be achieved using Netflix Zuul. Zuul will be a JVM based router and server side load balancing by Netflix. It will provide a single entry to our system, which will allow a browser, mobile app, or other user interface for consume services from multiple hosts without managing cross-
origin resource sharing (CORS) and authentication for each one. We will integrate Zuul with other Netflix projects such as Hystrix for fault tolerance and Eureka for service discovery, or use it to manage routing rules, filters, and load balancing across system.
30. Can you explain Consumer-Driven Contract?
Answer: CDCs (Consumer driven contract) are a pattern to evolve services. It will be used by external systems. When we will work on micro services, there is a particular provider who will build it and there will be one or more consumers who will use Microservice. Generally, providers will specify the interfaces in an XML document. But in Consumer Driven Contract, each consumer of service conveys the interface expected from the Provider.
31. Can you define OAuth?
Answer: OAuth (Open Authorization Protocol) will allow accessing the resources of the resource owner by enabling the client applications on HTTP services like hird-party providers Facebook, GitHub, etc. Therefore with this, we will share resources stored on one site with another site without using their credentials.
32. Can you define SOA?
Answer: SOA is stand for Service-Oriented Architecture is a software design Which will comprise of software components providing service to meet the requirements of business processes and requirements of software users.
33. Can you define DRY?
Answer: DRY is stand for Don’t Repeat Yourself that will promote the concept of reusing the code. This will result in developing and sharing the libraries that in turn result in tight coupling.
34. Can you define Eureka?
Answer: Eureka is the Netflix Service Discovery Server and Client which is using Spring Cloud.
35. Can you define CQRS?
Answer: CQRS is stand for Command and Query Responsibility Segregation and it is a pattern which will segregate the operations that will read data queries from the operations which will update data commands by using separate interfaces. This means that the data models which are used for querying and updates are different. Or CQRS is the creation of two objects where there was previously only one. The separation will occur based upon the methods are a command or a query.
36. Can you define Conway’s law?
Answer: Any different organization which will design a system are defined broadly can produce a design whose structure is a copy of the organization’s communication structure.
37. Can you define service registry?
Answer: The service registry is a database populated which will have an information on how will dispatch requests to microservicm instances. A service registry will required to be highly available and up to date. Clients can cache network locations obtained from the service registry.
38. How do you setup Service Discovery?
Answer: Spring Cloud will support several ways for implementing service discovery but for this I am going to use Eureka created by
Netflix. Spring Cloud provide several annotation to make it use easy and hiding lots of complexity.
39. Can you explain Continuous Monitoring?
Answer: Continuous Monitoring(CM) will get into the depth of monitoring coverage, from in-browser front-end performance metrics, through application performance, and down for hosting virtualized infrastructure metrics.
40. Can you explain Semantic monitoring?
Answer: Semantic monitoring is called as Synthetic monitoring .It will combine automated tests with monitoring the application. It is a web application or mobile application in order for detecting business falling factors.
41. Can you explain Continuous Integration?
Answer: Continuous Integration (CI) is the process to automate the build and test of code every time a team member will commit changes to version control. This will encourage developers for sharing code and unit tests by merging the changes into a shared version control repository after every small task completion.
42. Can you explain DDD?
Answer: DDD will stand for Domain Driven Design. An interesting software design technique for understanding and solve complexity is DDD. It will provide an avenue for facilitating the development of highly cohesive systems through bounded contexts. Model Services will be based on Domain-driven Design. Microservices is an implementation approach which will encourage to focus service boundaries on the business domain
boundaries. DDD and microservices will be used together as move organization for a service-oriented design and reap the benefits of continuous integration and delivery.
43. What is Contract Testing?
Answer: Contract Testing will be a writing tests for ensuring that the explicit and implicit contract of a microservice will work as advertised. There will be two perspectives when it will come to Contract Tests, consumer and provider. Contract testing is immediately applicable anywhere where we have two services which required to communicate – like an API client and a web front-end.
4. Can you define pact?
Answer:Pact is a contract testing tool. Pact is an open source CDC testing framework. It also provides a wide range of language supports like Ruby, Java, Scala, .NET Framework, JavaScript, Swift/Objective-C. We will go through the two major steps with code examples.
45. Can you explain Canary Releasing?
Answer: It is a technique for reducing the risk to introduce a new software version in production. This will be done by slowly rolling out the change to a small subset of users before providing it out to the entire infrastructure, example for making it available to everybody.
46. Can you explain Cross-Functional testing?
Answer:Cross-functional testing will be a verification of non-functional requirements, those requirements which will be be implemented such as a normal feature.
47. Can you explain Cross-Browser Testing?
Answer:Cross browser testing is test website or application in multiple browsers- and will make sure that it will work consistently and as in intended without any dependencies, or compromise in Quality. This testing will be applicable to both web and mobile applications.
48. Can you explain Component testing?
Answer:Component testing is called as program testing or module testing which is done after unit testing. In this type of testing those test objects will be tested independently as a component without integrating with other components for example for modules, classes, objects, and programs. This testing will be done by the development team.
49. What is the importance of Web, RESTful APIs?
Answer: Microservice architecture will be based on a concept wherein all its services will be able to interact with each other to build a business functionality. Therefore, each microservice will have an interface to achieve this. This will make the web API a very important enabler of microservices. Being based on the open networking principles of the Web, RESTful APIs will provide the most logical model to build interfaces between the various components of microservice architecture.
50. How do you access a restful Microservice?
Answer: Load Balanced RestTemplate.
If there will be multiple RestTemplate we will receive the right one.
It will be used for accessing multiple microservices.
51. Can you explain service discovery in microservice architecture?
Answer:Service discovery is regarding finding the network location of a service provider. There will be two types of service discovery patterns.
1. Client-Side Discovery Pattern: The client will be responsible for determine the network locations of available service instances and load balancing requests across them. The client will query a service registry, that is a database of available service instances. The client will use a load-balancing algorithm for selecting one of the available service instances and will make a request.
2. Server side Discovery Pattern: Consumer will send request to a load balancer, the load balancer will query from registry and decide which location of providers to send.
52. Can you explain shed light on Tasklet with reference to Spring Batch and Microservices?
Answer:It will be important for noting that Spring Batch easily will provide a Tasklet interface with the help of that the application will perform a single task. It will also clean and delete the various types of resources that will required before the final execution step.
53. Which companies are using Micro services?
Answer: Following companies are using Micro services:
1. com
2. Netflix 3. Ebay
4. Twitter
5. Uber
6. Nordstorm
7. The guardian
8. GILT
54. What are the cons of Microservices?
Answer: Following are the cons of Microservices:
1. Difficult for achieving strong consistency across services
2. ACID transactions will not span multiple processes.
3. Distributed System is hard for debugging and trace the issues
4. Greater required for end to end testing
5. Required cultural will change in across teams such as Dev and Ops working together even in same team.
6. Developers will have to put additional effort into implementing the mechanism of communication between the
services.
7.Handling use cases which will span more than one service without using distributed transactions is not only tough but also will required communication and cooperation between different teams
8. The architecture usually will result in increased memory consumption
9. Partitioning the application into microservices will be very much an art.
55. What is Spring Cloud in the realm of Microservices?
Answer:It is that kind of a feature in the realm of Microservices that will provide integration with the outside systems. It will be known as a short-lived Microservices framework which has the ability for building applications in a quick fashion. Moreover, it will play an important function in Microservices as it will be associated with finite amounts of processing of data.
56. Shed light on the architecture of Microservices.
Answer:It is will be kind of an architecture which will facilitates the avoidance of huge application implementation to a large system. It will be associated with the providence of loose coupling which will take place between various collaborating procedures. It has the ability for running in an independent manner under various types of situations.
57. Describe the way in which you can set up service discovery.
Answer:A large number of ways will be there in setting up service discovery, we have to use Eureka created by Netflix. This will be usually a very hassle-free process which is not heavy on the application. Also, it will suit a variety of applications which is quite good.
58. What do you mean by Eureka in the realm of Microservices?
Answer: Eureka will be called as the Netflix Service Discovery Server. This will use Spring Cloud and will be most often known as the most used setup for starting service discovery. It will be not very much heavy on the application development process. This is the reason which is quite popular among the developers of today.
59. Shed light on the ways by which you can access a RESTful Microservices.
Answer:Following are ways with the help of which we will use a RESTful Microservice.
1. With the use of the load balanced rest template
2. We will easily use a RESTful template, with the use of multiple Microservices,
3. If we have been provided a large number of RESTful templates, then will always make sure that use the right one.
60. Describe the process by which you can balance the server-side load by utilizing Spring Cloud.
Answer:It is interesting to note the balancing act in case to achieve server-side load will be achieved by the utilization of Netflix Zuul. The Zuul will also be called as a JVM based router. It will be regarded as a load balancer by Netflix. This is the reason that it will facilitates a single entity to the system.
61. Can you integrate Zuul with other types of projects?
Answer:Yes, Zuul will be integrated with other types of Netflix services which are called as Hystrix. It will be meant for tolerance of various types of faults which are commonly present in Eureka. By tolerating various kinds of faults, service discovery will be made easier within the realm of Microservices. One will use it to manage routing tables and effective balancing of the load across the system.
62. Shed light on the basic need of Microservices in today’s context of application development.
Microservices are called as a new pattern in the realm of software development. It will be assumed importance owing
for the fact that it will have the ability for increasing speed and efficiency. It will also manage software solutions in an effective manner. Some also call it as an approach for processing and culture which will deliver business value in an increased manner. In today’s context of application development, it will play a very crucial role as it will be deployed in the development process of a monolithic application in an efficient manner.
63. Describe the circumstances under which you would use the Netflix Hystrix.
Answer:It will be accepted fact that Hystrix is also called as an error tolerance and latency library. The main purpose of Hystrix will be to make sure that it will isolate the access points. With the help of these access points, the remote systems will be easily reached. It will make sure that it can restrict the widespread use of 3rd party libraries as well as services. In this manner, it will ensure that an application will run in an efficient manner. It will also quite effective in prohibiting the failure which will frequently take place in distributed systems which are quite complex in nature.
64. Define the process by which you can easily deploy Spring Batch Tasks with reference to Microservices.
Answer:The task will be related to Spring Batch is called as a simple interface which has just one method for executing. With the help of this feature, we will easily perform singular tasks which will relate for deleting and file queries. An example of Spring Batch in the Microservices can segment can be in the form of Hello World.
65. Shed light on Tasklet with reference to Spring Batch and Microservices.
Answer:It will be important to note that Spring Batch easily will provide a Tasklet interface with the help of which the application will perform a single task. It will also clean and delete the various types of resources which are required before the final execution step.
66. Define the Spring Batch Framework with respect to Microservices.
Answer:It is a batch framework which is quite comprehensive and is light in weight on the application. Its lightweight nature will be a great source of positivity in the realm of Microservices. This is so because it will be designed in such a manner that it will be facilitate the development of robust batch applications. It will be kind of a feature in the realm of Microservices which will be easily build upon productivity. It will be used in the development of enterprise applications which are necessary for making sure that the applications developed will able to meet
the set standards of a particular organization.
67. Shed light on the various aspects of using Spring Profiles.
Answer:The Spring Profiles will play an essential role in the context of Microservices. It is so because it will allow the users in the process of registering various beans. The registration process of beans will always dependent on various ways by which the application has been executed. Hence, if we are running the application in the DEVELOPMENT mode, we will witness which a certain number of items will be encumbered in an easy
manner. The other items will also be loaded, during the time ofproduction. With the widespread will use of Spring Boot, it has become relatively quite easy for making sure which all the profiles will be easily booted. This will make sure that the developed application will run free of errors and will be light on the interface.
68. Define caching with respect to the environment in which Microservices Operate.
Answer:It will be a commonly observed fact which the cache is that kind of an area in the local memory which has the ability for holding the copy of frequently researched data. If we have cache accumulated in the application, the application will speed up in a phenomenal manner. On the other side, we will also use the cast function to control the amount of cache we required.
69. Shed light on AOP and also describe the way in which you can use it with Microservices.
The concerns of cross-cutting will be the ways which will extent numerous roads of a particular application. it is interesting that the concerns of cross-cutting usually will fluctuate from the business logic of a particular application. This is the reason that the separation of the concerns related to the cross-cutting nature is always a primary step that has to be taken in the application development process. AOP is also known as characteristic oriented programming that goes a long way in making sure that business logic is applied correctly to enterprise based applications.
70. Define the process with the help of which you can deploy exception handling in the realm of Microservices.
Answer:It is important to note that Microservices and spring will provide a unique manner in which we will control the Controller Advice. We will state that we have the experience of deploying a class of Controller Advice with the help of the exceptions which are being used by the class of controllers.
71. Describe the advantages of Microservices nowadays.
Answer:There are following advantages of using Microservices:
1. The tiny base of code is quite easy for maintaining.
2. It will be quite easy for scaling as it has only an individual
component.
3. It will support the phenomenon of independent
implementation.
4. It will drastically reduce the installation time.
5. It will render good support for the parallel and the support
teams.
6.It has the ability to facilitate technological diversity.
72. Shed light on the various types of IT characteristics that are available in Microservices.
Answer:With the help of Microservices, business will scale new heights as it will integrate IT planning and execution of projects.
Following is the list of important IT characteristics which are available in Microservices.
1. Planning of various types of IT projects
2. Management of facilities
3. Implementation of several types of Agile Practices
4. The allocation of shared services
5. Management of the business cases
6. Maintaining transparency is various aspects of cost along
with the planning of IT management
at are the uses of reports
73. What are the reports and dashboards in the environment of Microservices?
Answer:It is vital for us to note that Microservices will comprise of a plethora of publishing features. This will include a variety of charts, PDFs, and dashboards. We can easily analyze scenarios and facilitate various types of executive packs with the help of dashboards and reports in Microservices.
74. Shed light on the way by which you can disable the endpoint of Actuator in the realm of Spring Boot .
Answer:All the insightful HTTP endpoints are protected. Hence, the developer with the role of an actuator will only access them. Security will be enforced by the utilization of a user-specific request. This request will be made for the batch frameworks also therefore that the application will run in a smooth manner.
75. What do you know about YAML in the realm of Microservices?
Answer:We will always note that YAML is also called as an individual legible language. Many experts will call it a language which will result in the sterilization of data. Hence, basically, it can denote that it will be used for cleanse data. This has a great advantage on the Microservices network. As compared to the other files of various properties, the YAML file is called to be more organized in manner. It is also less confusing and hence it will provide easy accessibility to a variety of web developers. However, it is also important to note that YAML can possess the hierarchical form of data which will play an essential role in the swift development of various applications.
76. Name three commonly used tools for Microservices.
Answer:Following are commonly used tools for Microservices:
1. Wiremock
2. Docker
3. Hysrix
77. What is Monolithic Architecture?
Monolithic architecture is a big container in that all the software components of an application will be clubbed inside a single package.
78. What are the advantages of microservices?
Answer:Following are significant advantages of using Microservices:
1. Technology diversity- Microservices will mix easily with other
frameworks, libraries, and databases.
2. Fault isolation- A process failure will not bring the whole
system down.
3. Greater support for smaller and parallel team.
4. Independent deployment.
5. Deployment time reduce.
79. Discuss uses of reports and dashboards in the environment of Microservices.
Answer:Reports and dashboards will help in monitoring and upkeep of Microservices. Tons of Application Monitoring Tools will assist in this.
80. What are main differences between Microservices and Monolithic Architecture?
Answer: Microservices Monolithic Architecture Service Startup is fast Service startup will take time They are loosely coupled architecture. This is mostly tightly coupled. Changes will bedone in a single Any changes in the data data model does not affect other Microservices. model will affect the entire database
It will focuse on products, not projects . It put emphasize over the whole project
81. What are the challenges faced while using Microservices?
1. Microservices always rely on each other. So, they are required to communicate with each other.
2. It is a heavily involved model because it is distributed system.
3. If we are using Microservice architecture, we are required to be ready for operations overhead.
4. We require skilled professionals for supporting heterogeneously distributed microservices.
82. In which cases microservice architecture best suited?
Answer:Microservice architecture is best suited for desktop, web, mobile devices, Smart TVs, Wearable, etc.
83. Tell me the name of some famous companies which are using Microservice architecture.
Answer:Most large-scale websites such as Twitter, Netflix, Amazon, will have advanced from a monolithic architecture to a microservices architecture.
84. What are the characteristics of Microservices?
Answer:Following are the characteristics of Microservices:
1. Essential messaging frameworks
2. Decentralized Governance
3. Easy Infrastructure automation
4. Design for failure 5. Infrastructure automation
85. What is RESTful?
Answer: Representational State Transfer (REST)/RESTful web services will be an architectural style which will help computer systems for communicating over the internet. These web services will make microservices easier for understanding and implementing.
86. Explain three types of Tests for Microservices?
Answer: In Microservice architecture tests will be divided into three broad categories:
1. At the bottom level test, we will perform a general test such as performance and unit tests. These tests are entirely
automated.
2. At the middle level, we will perform exploratory tests such as the stress tests and usability tests.
3. At the top level, we will conduct acceptance tests that are mostly fewer in numbers. It will also help stakeholders to know about different software features.
87. What are Client certificates?
Answer: Client certificates is a digital certificate which are used for making authenticated requests to a remote server. It will be termed as a client certificate.
88. Explain the use of PACT in Microservices architecture?
Answer: It will be an open source tool which will allow testing interactions between service providers and consumers. However, it will be separated from the contract made. This will increase the reliability of the Microservices applications.
89. What is the meaning of OAuth?
Answer: OAuth is stand for open authorization protocol. This protocol will allow to access the client applications on HTTP for third-party providers GitHub, Facebook, etc. It will help to share resources stored on one site with another site without the requirement for their credentials.
90. What is End to End Microservices Testing?
Answer: End-to-end testing will validate every process in the workflow whether it is functioning correctly. It will also ensure that the system will work together as a whole and satisfies all requirements.
91. Why are Container used in Microservices?
Answer:Containers are easiest and effective method for managing the microservice based application. It will also help to develop and deploy individually. Docker will also allow to encapsulate microservice in a container image along with its dependencies.
Microservice will use these elements without additional efforts.
92. What is the meaning of Semantic monitoring in Microservices architecture?
Answer: Semantic monitoring will combine automated tests with monitoring of the application. It will allow to find out reasons why business is not getting more profits.
93. What is a CDC?
Answer:CDC is stand for Consumer-Driven Contract. It will be a pattern to develop Microservices therefore that external systems will use them.
94. What is the use of Docker?
Answer: Docker will offer a container environment that will be used for hosting any application. This software application and them dependencies which will support it which will be tightly-packaged together.
95. What are Reactive Extensions in Microservices?
Answer: Reactive Extensions will also called Rx. It will be a design pattern that can allow collecting results by calling multiple services and then compile a combined response. Rx will be a popular tool in distributed systems that will work exactly opposite to legacy flows.
96. Explain the term ‘Continuous Monitoring.
Answer: Continuous monitoring will be a method that is used to search compliance and risk issues associated with a company’s operational and financial environment. It will contain human, processes, and working systems that will support efficient and actual operations.
97. How independent micro-services communicate with each other?
Answer:It will dependsupon project requirement. However, in most cases, developers will use HTTP/REST with JSON or Binary protocol. However, they will use any communication protocol.
98. When should one consider microservice kind of architecture?
Answer:There are following cases.
1. If we already have a monolith application and it will grow to an extent where there are problems in scaling or we will not able to reutilize the components/modules/services across different projects/platforms and there will be a need to do so. As well as at the same time implementing new features will painful and more error-prone and it can be difficult for scaling further.
2. For new applications where implementation will not started yet we will think of a business case to be efficiently implemented, that can be easily maintainable, testable and scalable in the future and may be used across other projects/products/platforms at the same time.
99. How would you test microservice based architecture?
Answer:One will have unit and integration tests where all the functionality of a microservice will be tested. One will also have component based testing.
One will have contract tests for asserting that the expectations by the client will not be breaking. End-to-end test for the microservices, however, should only test the critical flows as these will be time-consuming. The tests will be from two sides, consumer-driven contract test and consumer-side contract test.
We will also leverage Command Query Responsibility Segregation for querying multiple databases and get a
combined view of persisted data.
100. What is service discovery? And how is it helpful?
Answer:In a cloud environment where docker images will be dynamically deployed on any machine or IP + Port combination, it will become difficult for dependent services for updating at runtime. Service discovery will be created due to that purpose only.
Service discovery will be one of the services running under microservices architecture, that are registers entries of all of the services running under the service mesh. All of the actions will be available through the REST API. Therefore whenever the services will up and running, the individual services registers themselves to service discovery service and service discovery services will maintain heartbeat for making sure that those services will be alive. That also will serve the purpose of monitoring services as well. Service discovery will help in distributing requests across services deployed in a fair manner.
101. What are some kind of challenges that distributed systems introduces?
Answer: When you are implementing microservices architecture, there will be some challenges that we required to deal with every single microservices. Moreover, when we think about the interaction with each other, it will create a lot of challenges. As well as if we pre-plan for overcoming some of them and standardize them across all microservices, then it will happen that it will also become easy for developers for maintaining
services. Some of the most challenging things will be testing, debugging,security, version management, communication ( sync or async), state maintenance etc. Some of the cross-cutting concerns which will be standardized are monitoring, logging, performance improvement, deployment, security etc.
102. On what basis should microservices be defined?
Answer: Microservices can be defined based on the following criteria.
1. Business functionalities which will change together in
bounded context
2. Service will be testable independently.
3. Changes will be done without affecting clients as well as
dependent services.
4. It should be small enough which will be maintained by 2-5
developers.
5. Reusability of a service
103. How to tackle service failures when there are dependent services?
Answer: In real time, it will happen that a particular service will becausing a downtime, but the other services will be functioning as per mandate. Therefore, under such conditions, the particular service and it will be dependent services get affected due to the downtime.
To solve this issue, there will be a concept in the microservices architecture pattern which are called the circuit breaker. Any service calling remote service will call a proxy layer which will act as an electric circuit breaker. If the remote service will be slow or down for ‘n’ attempts then proxy layer will fail fast and keep checking the remote service for its availability again. As well as the calling services will handle the errors and will provide retry logic. Once the remote service will resume then the services will start working again and the circuit becomes complete.
This way, all other functionalities can work as expected. Only one or the dependent services will get affected.
104. How can one achieve automation in microservice based architecture?
Answer: This will be related to the automation for cross-cutting concerns. We will standardize some of the concerns such as monitoring strategy, deployment strategy, review and commit strategy, branching and merging strategy, testing strategy, code structure strategies etc.
We will follow the 12-factor application guidelines for standards. If we will follow them, we will definitely achieve
great productivity from day one. We will also containerize our application for utilizing the latest DevOps themes such as dockerization. We will use mesos, marathon or kubernetes for orchestrating docker images. Once we will have dockerized source code, we will use CI/CD pipeline for deploying our newly created codebase. Within that, we will add mechanisms for testing the applications and will make sure we will measure the required metrics in order to deploy the code. We will use strategies such as blue-green deployment or canary deployment to deploy our code therefore that we know the impact of code which may go live on all of the servers at the same time. We will do AB testing and make sure that things will not broken when live. In order for reducing a burden on the IT team, we will use AWS / Google cloud for deploying our solutions and keep them on autoscale for making sure that we
will have enough resources available for serving the traffic we are receiving.
105. What should one do so that troubleshooting becomes easier in microservice based architecture?
Answer:In monolith where HTTP Request will wait for a response, the processing will happen in memory and it will make sure that the transaction from all such modules will work at its best and will ensure that everything will be done according to expectation. But it will become challenging in the case of microservices because all services will be running independently, their datastores will be independent, REST Apis will be deployed on different endpoints. Each service will doing a bit without knowing the context of other microservices.
In this case, we will use the following measures for making sure we are able for tracing the errors easily.
1. Services will log and aggregators will push logs to centralized logging servers. For example, use ELK Stack to analyze.
2. Unique value per client request(correlation-id) which will be logged in all the microservices therefire that errors will be traced on a central logging server.
3. One should have good monitoring in place for each and every microservice in the ecosystem, which will record application metrics and health checks of the services, traffic pattern and service failures.
106. How should microservices communicate with each other?
Answer: Microservices communicate is an important design decision.
The communication between services always not necessary. It will happen synchronously or asynchronously. It will happen sequentially or it will happen in parallel. Therefore, once we had decided what will be our communication mechanism, we will decide the technology which suits the best.
Following are some of the examples which we will consider.
1. Communication will be done by using some queuing service such as rabbitmq, activemq and kafka. This will be called asynchronous communication.
2. Direct API calls will also be made for microservices. With this approach, interservice dependency will increases. This will be called synchronous communication.
3. Webhooks to push data to connected clients/services.
107. How would you implement authentication in microservice architecture?
Following are ways for achieving authentication in microservices architecture.
1. Centralized sessions All the microservices will use a central session store and user authentication will be achieved. This approach will work but has many drawbacks. The centralized session store will be protected and services will connect securely. The applicationrequires to manage the state of the user, Therefore, it will be called stateful session.
2. Token-based authentication/authorization In this approach, unlike the traditional way, information in the
form of token will be held by the clients and the token will be passed along with each request. A server will check the token and verify the validity of the token like expiry etc. Once the token will be validated, the identity of the user will be obtained from the token. However, encryption will be required for security reasons. JWT(JSON web token) will be the new open standard for this, which can be widely used. We will use OAuth based authentication mechanisms as well.
108. What would be your logging strategy in a microservice architecture?
Answer: Logging will be a very important aspect of any application. If we have done proper logging in an application, it will become easy for supporting other aspects of the application. Like in order for debugging the issues / in order foe understanding what business logic may have been executed, it will become very critical to log important details.
We will follow the following practices to log.
1. In a microservice architecture, each request will have a unique value (correlationid) and this value will be passed to each and every microservice therefore the correlationid will be logged across the services. Thus the requests will be traced.
2. Logs generated by all the services will be aggregated in a single location therefore that while searching becomes easier.
Generally, people will use ELK stack for the same. Therefore it will become easy for support persons for debugging the issue.
109 . How does docker help in microservice architecture?
Answer: Docker will help in many ways for microservices architecture.
1. In a microservice architecture, there will be many different services written in different languages. Therefore a developer will have to setup few services along with its dependency and platform requirements. This will become difficult with the growing number of services in an ecosystem. This will become very easy if these services will run inside a Docker container.
2. Running services inside a container will provide a similar setup across all the environments, example for development, staging and production.
3. Docker will help in scaling along with container orchestration.
4. Docker will help to upgrade the underlying language very easily. We will save many man-hours.
5. Docker will help to onboard the engineers fast.
6. Docker will help to reduce the dependencies on IT Teams for set up and manage the different kind of environment required.
110. How would you manage application configuration in microservice running in a container?
Answer: As container based deployment will involve a single image per microservice, it will be a bad idea for bundling the configuration along with the image.
This approach will not at all scalable because we may have multiple environments and also we have to take care of
geographically distributed deployments where we will have different configurations as well.
If there are application and cron application as part of the same codebase, it requires to take additional care on production as it will have repercussions how the crons will be architected.
To solve this, we will put our entire configuration in a centralized config service that will be queried by the application for all its configurations at the runtime. Spring cloud will be one of the example services which will provide this facility.
It can help for securing the information, as the configuration may have passwords or access for reporting or database access controls. Only trusted parties will be allowed for accessing these details for security reasons.
Microservices is the modern and widely adopted architectural concept in Software development. In these days, Microservices is integral part of any major system architecture. Microservices concept is about dividing the application functions into small parts and enabling the integration of them. This architecture not only helps easy maintenance of the system, but also helps in rapid development. Microservices also helps immensely in latest software development methodologies like DevOps , Agile etc.,
Microservices are going to stay here in software industry for very long period. The application and underlying technology may undergo continuous changes, but the concept and architecture is here to stay. Hence, it is very important for modern day software developers to be familiar with Microservices concepts. The above 110 top Microservices interview questions were compiled carefully to help the development community to succeed in their interviews.