12.07.2019 Views

NET-Microservices-Architecture-for-Containerized-NET-Applications-(Microsoft-eBook)

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

HTTP or any other protocol. More importantly, the services could share the same data, as long as<br />

these services are cohesive with respect to the same business domain.<br />

Figure 4-8. Business microservice with several physical services<br />

The services in the example share the same data model because the Web API service targets the same<br />

data as the Search service. So, in the physical implementation of the business microservice, you are<br />

splitting that functionality so you can scale each of those internal services up or down as needed.<br />

Maybe the Web API service usually needs more instances than the Search service, or vice versa.)<br />

In short, the logical architecture of microservices does not always have to coincide with the physical<br />

deployment architecture. In this guide, whenever we mention a microservice, we mean a business or<br />

logical microservice that could map to one or more (physical) services. In most cases, this will be a<br />

single service, but it might be more.<br />

Challenges and solutions <strong>for</strong> distributed data management<br />

Challenge #1: How to define the boundaries of each microservice<br />

Defining microservice boundaries is probably the first challenge anyone encounters. Each microservice<br />

has to be a piece of your application and each microservice should be autonomous with all the<br />

benefits and challenges that it conveys. But how do you identify those boundaries?<br />

First, you need to focus on the application’s logical domain models and related data. You must try to<br />

identify decoupled islands of data and different contexts within the same application. Each context<br />

could have a different business language (different business terms). The contexts should be defined<br />

and managed independently. The terms and entities used in those different contexts might sound<br />

similar, but you might discover that in a particular context, a business concept with one is used <strong>for</strong> a<br />

different purpose in another context, and might even have a different name. For instance, a user can<br />

be referred as a user in the identity or membership context, as a customer in a CRM context, as a<br />

buyer in an ordering context, and so <strong>for</strong>th.<br />

The way you identify boundaries between multiple application contexts with a different domain <strong>for</strong><br />

each context is exactly how you can identify the boundaries <strong>for</strong> each business microservice and its<br />

related domain model and data. You always attempt to minimize the coupling between those<br />

microservices. This guide goes into more detail about this identification and domain model design in<br />

the section Identifying domain-model boundaries <strong>for</strong> each microservice later.<br />

32 Architecting Container- and Microservice-Based <strong>Applications</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!