In this webinar slideshow, Typesafe Deputy CTO Viktor Klang looks into the world of microservices to see how these architectures emerge from the constraints of reality. We'll review the problems imposed by reality, and show how they can not only be solved, but how the constraints free us from misconceptions that are otherwise very easy to acquire.
We will also explore how distributed systems are at the heart of microservices-based architectures and how communication shapes the structure, behavior and development of the software.
9. Reality
â˘âŻseparation in space & time gives us
â˘âŻ communication for coordination
â˘âŻ variable delays
â˘âŻ partial failures
â˘âŻ partial/local/stale knowledge
9"
10. 10"
System
ÂŤa set of things working together as parts of a
mechanism or an interconnecting network;
a complex wholeÂť
noun
11. Systems
â˘âŻPurpose is (typically) simple
â˘âŻComplex inner workings
â˘âŻConsist of collaborating components
â˘âŻComponents can be systems themselves
â˘âŻComponents are as simple as feasible,
but not simpler
11"
13. 13"
Conwayâs Law
Organizations which design systems ⌠are
constrained to produce designs which are copies of the
communication structures of these organizationsÂť â
Melvin Conway
14. Communication
â˘âŻThe production and consumption of messages
â˘âŻMessaging means that we need to be able to
address recipients
â˘âŻ Addresses/Identities are important!
â˘âŻ They are knowledge that can be shared
â˘âŻMessages can become lost, delayed or
misunderstood
14"
15. Think âReliabilityâ
â˘âŻAre we ever guaranteed delivery?
â˘âŻ at-most-once
â˘âŻ at-least-once
â˘âŻ exactly-once
â˘âŻItâs not about guarantees,
itâs about reliability
15"
17. Encoding & Medium
â˘âŻEmbrace protocols
â˘âŻOvercome the fear of using multiple media
â˘âŻ Removes the single-point of failure
â˘âŻNo encoding is one-size-fits-all
â˘âŻAllow protocols to evolve over time
17"
22. 22"
Universal Scalability Law
ÂŤN is the number of users;
or the number of CPUs,
Îą is the contention level,
β the coherency latency.
C is the relative capacityÂť
27. Discovery is EC
â˘âŻSince knowledge is always local/partial/
stale
â˘âŻDiscovery of components must embrace
eventual consistency
â˘âŻConflict-FreeReplicatedDatatypes
(CRDTs) show great promise here
27"
29. Expectation management
â˘âŻTo humans, fast & slow is about perception
â˘âŻManageable
â˘âŻThe key is consistencyâbecause reliability
â˘âŻNot the same for machine-to-machine
29"
30. Burstiness
â˘âŻMost communication is bursty
â˘âŻ Some is predictable
â˘âŻ Some is not
â˘âŻ requires flow control
â˘âŻ can leverage elasticity
â˘âŻ load shedding can cause burstiness
30"
34. Flow control / Back pressure
34"
â˘âŻBuffers are only grease between cogs
â˘âŻ They do not solve overload problems
â˘âŻLoad shedding does not inform sender
â˘âŻWhen possible, use effectively bounded,
asynchronous, non-blocking, demand-
driven back pressure
www.reac:veBstreams.org"
36. 36"
Requirements Push Pull
support potentially unbounded sequences ! !
sender runs separately from receiver ! !
rate of reception may vary from rate of sending ! !
dropping elements should be a choice and not a necessity " !
minimal (if any) overhead in terms of latency and throughput ! "
Comparing Push vs Pull
39. â˘âŻâpushâ when subscriber is faster
â˘âŻâpullâ when publisher is faster
â˘âŻswitches automatically between both
â˘âŻbatching demand allows batching ops
39"
Dynamic
PushâPull
Reactive Streams
40. 40"
Requirements Push Pull Both
support potentially unbounded sequences ! ! !
sender runs separately from receiver ! ! !
rate of reception may vary from rate of sending ! ! !
dropping elements should be a choice and not a necessity " ! !
minimal (if any) overhead in terms of latency and throughput ! " !
Comparing Push vs Pull vs Both
#"
46. Resilience
â˘âŻNever assume that other entities are immortal
â˘âŻTreat expectation violations as failures
â˘âŻAlways have a Plan B
â˘âŻClients are not responsible to fix a faulty provider
â˘âŻFail fast & predictably
46"
50. 50"
Supervision
â˘âŻ Responsibility to deal with the failure/corruption of other
â˘âŻ Does not place the burden of fixing it on the collaborators
ÂŤQuis custodiet ipsos custodes?Âť
â Decimus Iunius Iuvenalis
52. 52"
An escalator can never break:
it can only become stairs.
You should never see an
Escalator Temporarily Out Of
Order sign,
just Escalator Temporarily Stairs.
Sorry for the convenience.
â Mitch Hedberg
â
â
53. 53"
E l a s t i c i t y
ÂŤLagom is a Swedish word,
meaning "just the right amount"Âť
â Wikipedia
55. â˘âŻMind shift in going async
â˘âŻMind shift in dealing with failure
â˘âŻImportance of appropriate configuration
â˘âŻIntegration using blocking APIs requires care
â˘âŻAvoid the distributed monolith
â˘âŻDeployment requires modern tooling
55"
Transitioning
58. REACTIVE PLATFORMâ¨
Full Lifecycle Support for Play, Akka, Scala and Spark
Give your project a boost with Reactive Platform:
⢠Monitor Message-Driven Apps
⢠Resolve Network Partitions Decisively
⢠Integrate Easily with Legacy Systems
⢠Eliminate Incompatibility & Security Risks
⢠Protect Apps Against Abuse
⢠Expert Support from Dedicated Product Teams
Enjoy learning? See about the availability of
on-site training for Scala, Akka, Play and Spark!
Learn more about our offersCONTACT US
This means that software is -collaborating- in an increasing rate.
Collaboration is at the very heart of this growing world of software.
Communication is at the very heart of collaboration.
Programmers, my self included, all too often jump too quickly into code.
It is worth reminding oneself that programming is âmerelyâ the encoding of a solution for a machine to execute.
The solution ALWAYS exists outside of the code itself.
The point being that it is helpful to ask oneself earlyâhow would I solve this -without- writing any code?
Programmers, my self included, all too often jump too quickly into code.
It is worth reminding oneself that programming is âmerelyâ the encoding of a solution for a machine to execute.
The solution ALWAYS exists outside of the code itself.
The point being that it is helpful to ask oneself earlyâhow would I solve this -without- writing any code?
Programmers, my self included, all too often jump too quickly into code.
It is worth reminding oneself that programming is âmerelyâ the encoding of a solution for a machine to execute.
The solution ALWAYS exists outside of the code itself.
The point being that it is helpful to ask oneself earlyâhow would I solve this -without- writing any code?
Perhaps not a bold assertion, but letâs think about it like this:
No matter how wonderful the imaginary is, the constraints of reality cannot cease to exist.Being aware of the constraints of reality is -essential- to being able to reason about the viability of solutions. Not only from the initial outset of the projectâbut laid out over the projected lifetime of it.
Alright, so do we all agree that in what we call Reality, we have multiple dimensions?
What things do we get from that?
Comm for Coo:
So given that entities do not exist in the same place, it means that they need to communicate if they want to coordinate -anything-.
Delays:
Ever observed a race-condition that as you tried to fix it just became less likely?
Thatâs shortened delaysâmaking the window of opportunity smaller but still possible.
Partial failures:
Since things do not exist in the same location, they especially if collaborating on something, will risk failing individuallyâwhere one succeeded and one failed, for example.
Knowledge:
Since communication is how we coordinate, it is also how we coordinate -information-, and since we have delays and partial failures, we will only ever have a subjective view of the world, one that is bound to be incomplete and stale.
System: noun, âa set of things working together as parts of a mechanism or an interconnecting network; a complex whole.â
Whatâs a system?We build systems, right? Computer systems?
Are you a system?
Are you a component within a system?
Is everything systems within systems within systems withinâŚ
A mechanical watch has a very simple purpose,
but a watch movement has complex inner workings,consists of a lot of small mechanical components that communicate via forceOr the Google Search bar â and whatever kind of beast that powers it :)
This means that software is -collaborating- in an increasing rate.
Collaboration is at the very heart of this growing world of software.
Communication is at the very heart of collaboration.
Why? Because, as weâve discussed, communication is -essential- for collaboration, and organization is ALL about collaboration
Different media have different transport speedsDifferent media have different reception rates & delays
speed of light in vacuum in meters per second
speed of sound at sea level in meters per second
Recent
studies have shown that it can take up to almost 400 msec
before visual information is available for conscious report
(e.g., Scharnowski et al., 2009; Heinen, Jolij, & Lamme, 2005).
The 3 Câs:ConcurrencyContention
CoherencyBeta = 0 == Amdahlâs Law
Little's Law tells us that the average number of customers in the store L, is the effective arrival rate Îť, times the average time that a customer spends in the store W, or simply:
If we observe an effective arrival rate and a mean length, we can calculate the mean time spent
the crucial addition is to make the exchange bidirectional, and explicitly so
message-passing between publisher and subscriber allows asynchronous non-blocking back pressure
. data items flow downstream
. demand flows upstream
. data items flow only when there is demand
. recipient is in control of incoming data rate
. data in flight is bounded by signaled demand
What I have described here for you today, is the essence of the Reactive Manifesto