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.

these calls increases significantly and at the same time one of the intermediate HTTP calls to a<br />

microservice is blocked. The result is that per<strong>for</strong>mance is impacted, and the overall scalability<br />

will be exponentially affected as additional HTTP requests increase.<br />

• Coupling microservices with HTTP. Business microservices should not be coupled with other<br />

business microservices. Ideally, they should not “know” about the existence of other<br />

microservices. If your application relies on coupling microservices as in the example, achieving<br />

autonomy per microservice will be almost impossible.<br />

• Failure in any one microservice. If you implemented a chain of microservices linked by HTTP<br />

calls, when any of the microservices fails (and eventually they will fail) the whole chain of<br />

microservices will fail. A microservice-based system should be designed to continue to work<br />

as well as possible during partial failures. Even if you implement client logic that uses retries<br />

with exponential backoff or circuit breaker mechanisms, the more complex the HTTP call<br />

chains are, the more complex it is implement a failure strategy based on HTTP.<br />

In fact, if your internal microservices are communicating by creating chains of HTTP requests as<br />

described, it could be argued that you have a monolithic application, but one based on HTTP between<br />

processes instead of intraprocess communication mechanisms.<br />

There<strong>for</strong>e, in order to en<strong>for</strong>ce microservice autonomy and have better resiliency, you should minimize<br />

the use of chains of request/response communication across microservices. It is recommended that<br />

you use only asynchronous interaction <strong>for</strong> inter-microservice communication, either by using<br />

asynchronous message- and event-based communication, or by using (asynchronous) HTTP polling<br />

independently of the original HTTP request/response cycle.<br />

The use of asynchronous communication is explained with additional details later in this guide in the<br />

sections Asynchronous microservice integration en<strong>for</strong>ces microservice’s autonomy and Asynchronous<br />

message-based communication.<br />

Additional resources<br />

• CAP theorem<br />

https://en.wikipedia.org/wiki/CAP_theorem<br />

• Eventual consistency<br />

https://en.wikipedia.org/wiki/Eventual_consistency<br />

• Data Consistency Primer<br />

https://msdn.microsoft.com/library/dn589800.aspx<br />

• Martin Fowler. CQRS (Command and Query Responsibility Segregation)<br />

http://martinfowler.com/bliki/CQRS.html<br />

• Materialized View<br />

https://docs.microsoft.com/azure/architecture/patterns/materialized-view<br />

• Charles Row. ACID vs. BASE: The Shifting pH of Database Transaction Processing<br />

http://www.dataversity.net/acid-vs-base-the-shifting-ph-of-database-transaction-processing/<br />

• Compensating Transaction<br />

https://docs.microsoft.com/azure/architecture/patterns/compensating-transaction<br />

• Udi Dahan. Service Oriented Composition<br />

http://udidahan.com/2014/07/30/service-oriented-composition-with-video/<br />

36 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!