Академический Документы
Профессиональный Документы
Культура Документы
menu
Events
I want to quickly paint the picture in my head about distributed systems
(maybe it’s a sloppy picture, but nevertheless). When we talk about
microservices we talk about using microservices as a vehicle for building
business agile IT systems: systems that allow a business to more quickly
change, build new functionality, experiment, and stay ahead of its disruptors
and competition (startups, etc). As part of autonomous systems that interact
with each other to provide business agility, we also need to consider what
happens when parts of these systems fail and how a system reacts to overcome
failure. A central pre-requisite to being able to build agile, failure tolerant
systems is autonomy. Autonomous systems can evolve independently from
each other because they tend to shed dependencies on other systems, teams,
and processes. Changes to a service A shouldn’t force system B to change, and
any other ripple effects. If service A, on which service B depends, goes down,
service B should not just blow up.
This can lead to bottlenecks. It can also lead to hung services and
cascading failures if some of these services in the chain are unavailable. It can
also lead to weird dependencies where something like the inventory service
now has to expose data in a certain way for the tax service and something
different for the shipping service to consume. Or it exposes the data in one
single format with lot of additional details that neither service really cares
about.
What if we looked at this model differently? What if we invert the model.
Instead of relying on and invoking services for their authority on certain
matters, we rely on time and events (like we do in the real world!) to
understand context about our environment before our service even gets
invoked? What if we were able to listen to our environment and find that
shipping from the USA to Cuba has just introduced a lower tax that it once
was. This is a fact that we can observe and react to. Or we could just ignore it
and do nothing. What if we could know that the tax on shipping to Cuba is
now lower and capture that data so we could know it for future queries about
shipping to Cuba when we display the shopping cart page? Then we may have
a little more autonomy over our data and our service. We could store that
information, or derivatives of that information, in our own databases which
would be optimized for the types of service we provide. If we have to make a
version change to our service we can just focus on what it means to version
our own schemas and data and not have to worry what happens when other
dependent services change.
If you are notified of an event immediately, you can react immediately. For
example, if a car is swerving into your lane and you see this, you can quickly
hit the breaks or adjust your driving to not collide. However, if there is some
kind of delay in observing this event then your reaction may be slow (maybe
your driving impaired ?? or playing on your cell phone? or yelling at your kids
for doing something, etc…… okay, please don’t send me mail about how to be
a parent :)). This can also happen in IT systems. Let’s say a I order something
on Amazon. This publishes an event, or fact, to other autonomous services
(like order processing, billing, inventory, etc). These systems can observe this
event, but what if the inventory system is disconnected from the network for a
few minutes/hours/whatever? When they come back, they will eventually see
the event and proceed to check inventory, etc and publish any events it deems
necessary (ie, react) like “InventoryReserved” event or “InadequateInventory”
event. This is a simple example of a set of autonomous systems “eventually”
becoming consistent.
SHARE ON
Why Microservices Should Be Event Driven: Autonomy vs Authority was published on May
27, 2016.
© 2018 Christian Posta. Powered by Jekyll using the Minimal Mistakes theme.