The A to Z of Microservice Architecture — Blog

What’s Microservice? Is It Useful and Powerful?

Microservice Architecture Style Structure

  • This is the single point where all the client application would connect in order to get/set the data.
  • All the client-facing APIs/Swagger/Common Logging/ Error reporting would reside here.
  • It provides abstraction on all the micro-service; the client would request the base service, the base service would delegate the request to the respective service and forwards the response to the clients.
  • Each service component would have multiple modules, but the modules would be of the same service domain.
  • Each service would have separate isolated and dedicated storage; no service should have direct access to the storage belonging to the different service
  • If the service wants to access the data of another service, the service should request the owner service of the particular storage/data.

Defining Characteristics of a Microservice

  • In a microservice architecture, services are small, discreet, independent, loosely coupled and having bounded context.
  • Each service is a separate codebase, which can be managed by a small development team.
  • Services can be deployed independently. A team can update an existing service without rebuilding and redeploying the entire application.
  • Services are responsible for persisting their own data or external state. This differs from the traditional model, where a separate data layer handles data persistence.
  • Services communicate with each other by using well-defined APIs. Internal implementation details of each service are hidden from other services.
  • Services don’t need to share the same technology stack, libraries, or frameworks.
  • Isolate the clients from how the application is partitioned into microservices
  • Isolate the clients from the problem of determining the locations of service instances
  • Provides the optimal API for each client
  • Reduces the number of requests/roundtrips. For example, the API gateway enables clients to retrieve data from multiple services with a single round-trip. Fewer requests also mean less overhead and improve user experience. An API gateway is essential for mobile applications.
  • Simplifies the client by moving the logic for calling multiple services from the client to API gateway
  • Translates from a “standard” public web-friendly API protocol to whatever protocols are used internally

What to Consider While Designing Microservice Architecture?

  • User personas are a representation of a class of users of our system, personified as an individual with specific needs, skills, goals, and frustrations. This concept originated in the UX community and is widely used in design processes.
  • Thinking of users in terms of personas helps build empathy and design systems that are a better fit for the jobs they need to get done and that avoid known obstacles.
  • Turns out this is an effective way to understand internal users as well, not only customers. So, we can apply them to understand the information needs of our business stakeholders when it comes to making release decisions.
  • Microservices principles encourage you to focus your service boundaries concur business domain boundaries in a bounded context.
  • Having a domain design helps to determine the microservices.
  • Steps for designing a domain-

Benefits of Microservices

Constraints

  • ComplexityA microservices app has more moving parts than the equivalent monolithic application. Each service is simpler, but the entire system as a whole is more complex to decode.
  • Lack of governance
    The decentralised approach to building microservices has advantages, but it can also lead to problems. You may end up with so many different languages and frameworks that the application becomes hard to maintain.
  • Network congestion and latency
    The use of many small, granular services can result in more inter-service communication. Also, if the chain of service dependencies gets too long (service A calls B, which calls C…), the additional latency can become a problem. You will need to design APIs carefully.
  • Data integrity
    With each microservice responsible for its own data persistence. As a result, data consistency can be a challenge.
  • SkillsetMicroservices are highly distributed systems and might end up managing different tech stacks.
  • A mature DevOps culture to handle all the moving parts in an automated way.
  • Project-wide standards for designing the microservices and communication between them.

Best Practices

  • 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.
  • S ervices 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.
  • Isolate failures — Use resiliency strategies to prevent failures within a service from cascading.

Conclusion

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
SYSTANGO

SYSTANGO

London’s leading digital agency Systango offers full service from strategy, scoping to launch & maintenance, innovative campaigns to enterprise infrastructure.