What Are Microservices?
Microservices have become quite popular. They're based on the idea that if you break an application down into small, autonomous services that communicate with each other through lightweight mechanisms like HTTP, you can build more scalable and maintainable applications.
Microservices allow you to build applications from small, independent services. Each service can be built and tested independently of other services in the application; this makes them easier to develop, deploy, scale, and maintain compared to more monolithic architectures. This approach encourages continuous deployment by enabling autonomous teams to develop features independently and deploy them quickly.
In addition, because microservices are smaller they can be written using different programming languages and technologies—you may choose Java for one microservice but then opt for Python instead when building another one without having to rewrite everything first following the single responsibility principle. It states that you should separate those things that change for the same reason, and group together those things that change for different reasons. This allows you to develop independently of each other and allows you to deploy independently.
Key Microservice Architecture Patterns
The Client-side Discovery and Server-side Discovery patterns are used with a microservice architecture to route requests for a client to an available service instance. Client-side discovery uses a third-party service to determine the existence of a microservice. This may be done through an API call or by querying the server instance directly. Server-side discovery is used when each microservice has its own internal reference to other services in order to discover their existence.
The Messaging and Remote Procedure Invocation patterns are two different ways that services can communicate. Messaging allows applications to exchange messages, while RPI is used for server-to-server communication. The messaging pattern involves a client sending a message to another service and then waiting for a response. This can be useful if you want to send information from one application to another, such as when an eCommerce site sends out an email order confirmation or when a social network posts status updates.
The RPI pattern involves sending data between two services without requiring the client application to wait for a response
The Single Service per Host and Multiple Services per Host patterns are two additional deployment strategies. When deciding whether to use the Single Service per Host or Multiple Services per Host patterns, you should consider each approach based on your needs. The Single Service per Host pattern is best for environments where every host in a cluster must perform the same service, such as virtual machines (VMs).
The Multiple Services per Host pattern is best for environments in which hosts require access to different services, such as Hyper-V virtual machines and physical servers. One of the nice things about MVH is that you can use it in a wide variety of environments.
A Service Mesh is a network of services that relay and route traffic for the sake of specifically optimized data processing. The way these portions work together also create a kind of control plane, which can be used to store policy in one place and apply it across multiple endpoints. It has become clear that co-location between services and their proxies can speed up operations by accelerating communication latency.The control plane of a service mesh must provide isolation between components.
If this information were dealt with through ingress/egress policies for instances like in separate applications on separate boxes, then co-located instances would interact and interfere with one another.
Domain-Oriented Microservice Architecture (DOMA)
The DOMA pattern is based on the existing Microservices architecture, but it adds an additional layer of abstraction to make each microservice easier to maintain and deploy independently. The core ideas behind the DOMA pattern are that it allows a service to be deployed in isolation.
Domain-oriented Microservices Architecture (DOMA) is an emerging architectural pattern that allows organizations to quickly add new features while scaling up existing ones.
In order for a domain-oriented system to scale, you need mechanisms for isolating individual services within the system from other services and from the interfaces they use. This becomes more important when multiple services share common data or similar business logic, which can lead to dependencies between them. In this situation, you would want changes made only by one service and not to impact other systems directly connected with it through APIs or shared resources.
The Domain-Oriented Microservices Architecture (DOMA) splits up applications into separate domains, which are then organized into smaller groups called microservices using well-defined APIs that provide stateless communication between separate parts and microservices. Domains are defined by sets of interfaces that allow interconnected systems to compose together as required, without explicit coupling. Platforms designed using DOMA have proven to be much more extensible and easier to maintain.
When to use Microservices?
The microservices architectural approach starts by breaking down applications or features into pieces, most commonly based on the data model and supported business capabilities, which are referred to as microservices. A dedicated engineering team is tasked with each of these containing microservices, and because they operate as individual services do not risk "blowing up" the rest of the application when working on a specific feature.
In some cases, this may also allow teams more flexibility in choosing technologies compared to having one monolithic codebase throughout an organization.
While there isn't much commonality between different organizations regarding what makes something a microservice instead of simply being another way to describe splitting off small bits from larger ones, there's generally been three guiding principles behind deploying service-oriented architectures. These trends have helped shape software development best practices for the last decade, so they're worth looking at as well.
The first is encapsulation. Service-oriented architectures are all about the separation of concerns. Most developers can agree that a service is easier to reason about and understand than a monolithic application containing multiple services because it's easier to tell what each service does without having to explicitly consider how it interacts with other parts of your codebase or the outside world. It's also easier for developers and operations staff who have to work with the system to do their jobs more effectively by being able to focus on one thing at a time rather than worrying about everything else in your codebase.
Encapsulating things into separate units makes it possible for developers and operations staff to address them independently from each other, which helps ensure that you're not wasting time on tasks that don't need attention because they happen in different places within an organization or across organizations. It also means that changes made at one end of the system won't cause problems for upstream/downstream components.
Want to contribute or give feedback ? Send me a tweet or DM me on twitter 👇🏿
Last Updated: 5/6/2022