Microservices or Microservice Architecture (MSA), is a one of the method of software systems development. It is an approach to application development in which a large application is built as a suite of modular components or services. Micro Service is independently deployable service modelled around a business domain. It is a method of breaking large software applications into loosely coupled modules, in which each service runs a unique process and communicates through APIs. It can be developed using messaging or event-driven APIs, or using non-HTTP backed RPC mechanisms.
Microservices, aka Microservice Architecture, is an architectural style that structures an application as a collection of small autonomous services, modelled around a business domain. Itis a variant of the service-oriented architecture (SOA) architectural style that structures an application as a collection of loosely coupled services. In microservices architecture, services should be fine-grained and the protocols should be lightweight. The benefit of decomposing an application into different smaller services is that it improves modularity and makes the application easier to understand, develop and test. It also parallelism development by enabling small autonomous teams to develop, deploy and scale their respective services independently. It also allows the architecture of an individual service to emerge through continuous refactoring. Microservices-based architectures enable continuous delivery and deployment. Complexity associated with distributed systems: This overhead includes network issues, Latency overhead, Bandwidth issues, security issues. Service Discovery: Service discovery tools manage how processes and services in a cluster can find and talk to one another. It involves a directory of services, registering services in that directory, and then being able to lookup and connect to services in that directory. Redundancy: Redundancy issues in distributed systems. Load balancing: Load balancing improves the distribution of workloads across multiple computing resources, such as computers, a computer cluster, network links, central processing units, or disk drives. Performance issues: Performance issues due to various operational overheads. Deployment complexities: Requirement of DevOps skills. Eureka created by Netflix, it is the Netflix Service Discovery Server and Client. Netflix Ribbon, it provides several algorithm for Client-Side Load Balancing. Spring provide smart Rest Template for service discovery and load balancing by using @Load Balanced annotation with Rest Template instance. Spring Boot provides actuator endpoints to monitor metrics of individual microservices. These end points are very special and helpful for getting information about applications like if they are up, if their components like database etc are working good. But a major drawback or difficulty about using actuator endpoints is that we have to individually hit the endpoints for applications to know their status or health. Imagine microservices involving 50 applications, the admin will have to hit the actuator endpoints of all 50 applications. To help us deal with this situation, we will be using open source project located at Built on top of Spring Boot Actuator, it provides a web UI to enable us visualize the metrics of multiple applications. When we start a project, we usually have all the configurations in the properties file. As more and more services are developed and deployed, adding and modifying these properties become more complex. Some services might go down, while some the location might change. This manual changing of properties may create issues. Eureka Service Registration and Discovery helps in such scenarios. As all services are registered to the Eureka server and lookup done by calling the Eureka Server, any change in service locations need not be handled and is taken care of. There are many advantages in using microservices. Because these components are not dependent on the same coding language, developers can use the ones they are most familiar with. Ambassador: It can be used to offload common client connectivity tasks such as monitoring, logging, routing, and security (such as TLS) in a language agnostic way. Anti-corruption layer: This layer implements a façade between new and legacy applications, to ensure that the design of a new application is not limited by dependencies on legacy systems. Backends for Frontends: It creates separate backend services for different types of clients, such as desktop and mobile. That way, a single backend service doesn’t need to handle the conflicting requirements of various client types. This pattern can help keep each microservice simple, by separating client-specific concerns. Bulkhead: It isolates critical resources, such as connection pool, memory, and CPU, for each workload or service. By using bulkheads, a single workload (or service) can’t consume all of the resources, starving others. This pattern increases the resiliency of the system by preventing cascading failures caused by one service. Gateway Aggregation: This aggregates requests to multiple individual microservices into a single request, reducing chattiness between consumers and services. Gateway Offloading: It enables each microservice to offload shared service functionality, such as the use of SSL certificates, to an API gateway. Gateway Routing: It routes requests to multiple microservices using a single endpoint, so that consumers don’t need to manage many separate endpoints. Sidecar deploys helper components of an application as a separate container or process to provide isolation and encapsulation. Strangler: It supports incremental migration by gradually replacing specific pieces of functionality with new services. Read More: It is a batch framework that is quite comprehensive and is 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 is designed in such a manner that it can facilitate the development of robust batch applications. It is that kind of a feature in the realm of Microservices that can easily build upon productivity. It is especially used in the development of enterprise applications that are necessary to make sure that the applications developed are able to meet the set standards of a particular organization. Server side load balancing can be achieved using Netflix Zuul. Zuul is a JVM based router and server side load balancing by Netflix. It provides a single entry to our system, which allows a browser, mobile app, or other user interface to consume services from multiple hosts without managing cross-origin resource sharing (CORS) and authentication for each one. We can integrate Zuul with other Netflix projects like Hystrix for fault tolerance and Eureka for service discovery, or use it to manage routing rules, filters, and load balancing across your system. CDCs (Consumer driven contract) are a pattern for evolving services. It can be used by external systems. When we work on micro services, there is a particular provider who builds it and there are one or more consumers who use Microservice. Generally, providers specify the interfaces in an XML document. But in Consumer Driven Contract, each consumer of service conveys the interface expected from the Provider. OAuth (Open Authorization Protocol) is allows accessing the resources of the resource owner by enabling the client applications on HTTP services such as third-party providers Facebook, GitHub, etc. So with this, you can share resources stored on one site with another site without using their credentials. SOA (Service-Oriented Architecture) is a software design that comprises of software components providing service to meet the requirements of business processes and needs of software users DRY (Don’t Repeat Yourself) that promotes the concept of reusing the code. This results in developing and sharing the libraries which in turn result in tight coupling. Eureka is the Netflix Service Discovery Server and Client. Eureka Server is using Spring Cloud. Spring Cloud Stream App Starters are Spring Boot based Spring Integration applications that provide integration with external systems. Spring Cloud Task, A short-lived microservices framework to quickly build applications that perform finite amounts of data processing. CQRS (Command and Query Responsibility Segregation) is a pattern that segregates the operations that read data (queries) from the operations that update data (commands) by using separate interfaces. This means that the data models used for querying and updates are different. Or CQRS is simply the creation of two objects where there was previously only one. The separation occurs based upon whether the methods are a command or a query Any different organization that designs a system (defined broadly) will produce a design whose structure is a copy of the organization’s communication structure.” The service registry is a database populated with information on how to dispatch requests to microservice instances. A service registry needs to be highly available and up to date. Clients can cache network locations obtained from the service registry. Spring Cloud support several ways to implement 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. CM (Continuous Monitoring) gets into the depth of monitoring coverage, from in-browser front-end performance metrics, through application performance, and down to host virtualized infrastructure metrics. Semantic monitoring is also known as Synthetic monitoring .It combines automated tests with monitoring the application (web application or mobile application) in order to detect business falling factors. CI (Continuous Integration) is the process of automating the build and testing of code every time a team member commits changes to version control. This encourages developers to share code and unit tests by merging the changes into a shared version control repository after every small task completion. DDD stands for Domain Driven Design. An interesting software design technique to understand and solve complexity is DDD. It provides an avenue to facilitate the development of highly cohesive systems through bounded contexts. Model Services based on Domain-driven Design. Microservices is an implementation approach that encourages you to focus your service boundaries on the business domain boundaries. DDD and microservices can be used together as you move your organization to a service-oriented design and reap the benefits of continuous integration and delivery. Contract Testing is writing tests to ensure that the explicit and implicit contract of a microservice works as advertised. There are two perspectives when it comes to Contract Tests, consumer and provider. Contract testing is immediately applicable anywhere where you have two services that need to communicate – such as an API client and a web front-end. It 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. Read More : It is a technique to reduce the risk of introducing a new software version in production. This is done by slowly rolling out the change to a small subset of users before giving it out to the entire infrastructure, i.e. making it available to everybody. Cross-functional testing is a verification of non-functional requirements, those requirements which cannot be implemented like a normal feature. Cross browser testing is simply what its name means- that is, to test your website or application in multiple browsers- and making sure that it works consistently and as in intended without any dependencies, or compromise in Quality. This testing is applicable to both web and mobile applications. Component testing is also known as program testing or module testing, is done after unit testing. In this type of testing those test objects can be tested independently as a component without integrating with other components for e.g. modules, classes, objects, and programs. This testing is done by the development team. Microservice architecture is based on a concept wherein all its services should be able to interact with each other to build a business functionality. So, to achieve this, each microservice must have an interface. This makes the web API a very important enabler of microservices. Being based on the open networking principles of the Web, RESTful APIs provide the most logical model for building interfaces between the various components of microservice architecture. Load Balanced RestTemplate. If there are multiple RestTemplate you get the right one. It can used to access multiple microservices. Service discovery is about finding the network location of a service provider. There are two types of service discovery patterns Client-Side Discovery Pattern: The client is responsible for determining the network locations of available service instances and load balancing requests across them. The client queries a service registry, which is a database of available service instances. The client then uses a load-balancing algorithm to select one of the available service instances and makes a request. Server side Discovery Pattern: Consumer send requests to a load balancer, the load balancer query from registry and decide which location of providers to send to It is important to note that Spring Batch easily provides a Tasklet interface with the help of which the application can perform a single task. It can also clean and delete the various types of resources that are needed before the final execution step.Can you explain Microservices?
What are the features of Micro services?
How does Microservice Architecture work?
What are the pros of Spring Cloud?
What Netflix projects did we use?
How will you monitor multiple microservices for various indicators like Health?
What is the difference between Service Registration and Discovery?
What are the Pros of Microservices?
Can you explain the Design patterns for microservices?
Can you explain the spring batch framework with respect to Microservices?
How to achieve server side load balancing using Spring Cloud?
Can you explain Consumer-Driven Contract?
Can you define OAuth?
Can you define SOA?
Can you define DRY?
Can you define Eureka?
Can you explain Spring Cloud?
Can you define CQRS?
Can you define Conway’s law?
Can you define service registry?
How do you setup Service Discovery?
Can you explain Continuous Monitoring?
Can you explain Semantic monitoring?
Can you explain Continuous Integration?
Can you explain DDD?
What is Contract Testing?
Can you define pact?
Can you explain Canary Releasing?
Can you explain Cross-Functional testing?
Can you explain Cross-Browser Testing?
Can you explain Component testing?
What is the importance of Web, RESTful APIs?
How do you access a restful Microservice?
Can you explain service discovery in microservice architecture?
Can you explain shed light on Tasklet with reference to Spring Batch and Microservices?
Which companies are using Microservices?
What are the cons of Microservices?
Related posts:
- Agile Methodology Interview Questions and Answers
- Agile Testing Interview Questions and Answers
- Appian Interview Questions and Answers
- Magento 2 Interview Questions and Answers
- Pega/PRPC Interview Questions and Answers
- ServiceNow Interview Questions and Answers
- System Analyst Interview Questions and Answers
- Workday HCM Interview Questions and Answers