My takeaways from Lightweight Microservice Collaboration, using HTTP at NDC by @chr_horsdal

A natural occurance in Microservice development, is to separate an originally deviced feature into a new microservice. It's a continual evolution.

Enabling continous delivery enables business to experiment and turn around quickly. This is real agility; it's not about the technology as such, but that it enables business to experiment.

By writing very narrowly focused services, they become much more maintainable.
On a negative side, distributed systems are hard! Furthermore, maintaining 100s of services, quickly gets complicated with a complex production environment and a lot of deployments. Refactoring across services are cumbersome. For this last reason, I urge you to start out with slightly too large services and break off distinct functionality as it emerges.

Prefer modelling your communication around events, rather than commands and queries, whenever possible, as events are facts - this thing actually happened.

Both Command and Queries are synchronous in the sense that the recipients must acknowledge the request.

HTTP is there anyway, and is stable - why not use it? And embrace it - return NotFound on queries where the requested object is not found, for example.

Nancy makes implementing ASP.NET Core based systems easy.

For events, the service can publish a get endpoint, supporting paging (HTTP GET /events?from=100&to=200). With an eventing architecture, we can accept (expect) that the service whose events we are polling is down. Perhaps it's being deployed? So we sleep for an hour or so, before we try again, as most events do not need millisecond synchronization anyway, when we dig a bit deper.


There are a lot of cases where queuing makes sense, but it does come with a learning and management cost. I think that you can get a long way just by getting your asynchronous communication done correctly.

By prominently showing 'last updated' information on views that are based of an eventually consistent read model, you minimize the risk of someone making a wrong decision, because the data is not yet up-to-date. We are used to see these fields in views that track our deliveries, but they are useful everywhere were we have eventually consistent data.

Some Microservices are more cohesive than others, and that's okay. You group a number of microservices to a bounded context, for example. This goes back to the evolutionary approach of microservices that we further refactor into multiples. Within a bounded context - within a cohesive "bubble" - commands and queries are more acceptable, whereas beteween bounded context, event based synchronization is preferred, as the services are often further away from eachother, organizationally and technically.

Book: Microservices in .NET Core

Comments

Popular posts from this blog

Auto Mapper and Record Types - will they blend?

Unit testing your Azure functions - part 2: Queues and Blobs

Testing WCF services with user credentials and binary endpoints