Call Us  +91-8595824647

Microservice Architecture

Blog
  • Ziaul Kadri
  • Process
  • Architecture

The evolution of technologies has changed the way we build the architecture of applications. Docker, Cloud services, and Container Orchestration services brought us ability to develop distributed, more scalable, and reliable solutions.

A microservices architecture consists of a collection of small, autonomous services. Each service is self-contained and should implement a single business capability within a bounded context. A bounded context is a natural division within a business and provides an explicit boundary within which a domain model exists.

Microservices architecture was developed to overcome the challenges and difficulties posed by monolithic architectural approaches to application development.

Monolithic architecture is like a large container holding all software components of an application: user interface, business layer, and data interface. This had several limitations such as inflexibility, lack of reliability, difficulty scaling, slow development, and so on. It was to bypass these issues that microservices architecture was created.

Differences Between Monolithic Architecture and Microservices

https://miro.medium.com/max/1400/1*iYKbqfknR0XGvbwG64EGhQ.png

In Microservices, if you make changes in a single data model, it does not affect others. In Monolithic Architecture, any changes in the data model affect the entire database and due to its bulky size and higher dependencies, build and deploy mechanisms in monoliths are more complicated and time-consuming. Microservices are less resource-sensitive and are built to scale. Since the modules are decoupled from each other, it is easier to build and deploy.

How does a Microservice architecture work?

The Microservice architecture of an application can be simplified into multiple modules that independently perform the single precise standalone task. Let’s see how Microservice architecture works:

  • An application is fragmented into loosely coupled various modules, each of which performs a distinct function.
  • It is distributed across clouds and data centers.
  • Each application module is an independent service/process that can be replaced, updated, or deleted without disrupting the rest of the application.
  • Under microservice architecture, an application can grow along with its requirements.

Microservices Features and Benefits

https://miro.medium.com/max/1400/1*5v3xJZjCr6rECixRNff2fA.png

  1. Decoupling — Services within a system are largely decoupled. So the application as a whole can be easily built, altered, and scaled.
  2. **Componentization **— Microservices are treated as independent components that can be easily replaced and upgraded.
  3. Business Capabilities — Microservices are very simple and focus on a single capability.
  4. Autonomy — Developers and teams can work independently of each other, thus increasing speed.
  5. Continuous Delivery — Allows frequent releases of software, through systematic automation of software creation, testing, and approval. 6.** Responsibility** — Microservices do not focus on applications as projects. Instead, they treat applications as products for which they are responsible.
  6. Decentralized Governance — The focus is on using the right tool for the right job. That means there is no standardized pattern or any technology pattern. Developers have the freedom to choose the best useful tools to solve their problems.
  7. Agility — Microservices support agile development. Any new feature can be quickly developed and discarded again
  8. Small code base — In a monolithic application, there is a tendency over time for code dependencies to become tangled. Adding a new feature requires touching code in a lot of places. By not sharing code or data stores, a microservices architecture minimizes dependencies, and that makes it easier to add new features.
  9. Scalability — Services can be scaled independently, letting you scale out subsystems that require more resources, without scaling out the entire application. Using an orchestrator such as Kubernetes or Service Fabric, you can pack a higher density of services onto a single host, which allows for more efficient utilization of resources.

Best practices

  • Model services around the business domain.
  • Decentralize everything. Individual teams are responsible for designing and building services. Avoid sharing code or data schemas.
  • Data storage should be private to the service that owns the data. Use the best storage for each service and data type.
  • Services communicate through well-designed APIs. Avoid leaking implementation details. APIs should model the domain, not the internal implementation of the service.
  • Avoid coupling between services. Causes of coupling include shared database schemas and rigid communication protocols.
  • Offload cross-cutting concerns, such as authentication and SSL termination, to the gateway.
  • Keep domain knowledge out of the gateway. The gateway should handle and route client requests without any knowledge of the business rules or domain logic. Otherwise, the gateway becomes a dependency and can cause coupling between services.
  • Services should have loose coupling and high functional cohesion. Functions that are likely to change together should be packaged and deployed together. If they reside in separate services, those services end up being tightly coupled, because a change in one service will require updating the other service. Overly chatty communication between two services may be a symptom of tight coupling and low cohesion.
  • Tags:
  • Process
  • Architecture