2. Patrick Di Loreto
CTO Addison Global (MoPlay)
https://github.com/patricknoir
http://patricknoir.blogspot.com
@patricknoir
3.
4.
5.
6. This architecture was designed for
system pre smart phone generation
Need for customer acquisition
=> need for SCALABILITY
Availability became more important
than Consistency (CAP theorem)
7. Response in a
timely manner
Responsive under
failure scenariosResponsive
under load
Enabler for
responsiveness
9. Average system utilization across organization is 15% to 20%
The ideal should be around 80%
20% of IT budgets go to operations
“We have created:
Large
Underutilized
Complex
Environments which are costly to maintain”
11. Has a name
Is a function from In to Out
Service[-In, +Out](name: String, f: In => Out)
12. Sometime services have to handle a state, so in order to elaborate a
computation: they need to know the current state and they will also
produce an output state.
type StatefulService[S, Input, Output] = Service[(S, Input), (S, Output)]
class Service[In, Out](name: String, f: In => Out)
type In = (S, Input) type Out = (S, Output)
13. type In = (S, I)
type Out = (S, O)
class Service[In, Out](name: String, f: In => Out)
f: (S, I) => (S, O)
f: I => S => (S, O) // Currying: I => (S => (S, O))
f: I => State[S, O] // S => (S, O) = State[S, O]
class StatefulService[S, I, O](name: String, f: I => State[S, O])
14.
15. Instruction Time
Execute typical instruction 1/1,000,000,000 = 1 nanosec
Fetch from L1 cache memory 0.5 nanosec
Branch misprediction 5 nanosec
Fetch from L2 cache memory 7 nanosec
Mutex lock/unlock 25 nanosec
Fetch from main memory 100 nanosec
Send 2K bytes over 1Gbps network 20,000 nanosec (20µs)
Read 1MB sequentially from memory 250,000 nanosec (250µs)
Fetch from new disk location (seek) 8,000,000 (8ms)
Read 1MB sequentially from disk 20,000,000 nanosec (20ms)
Send packet US to Europe and back 150,000,000 nanosec (150ms)
16. Instruction Time
Execute typical instruction 1 s
Fetch from L1 cache memory 0.5 s
Branch misprediction 5 s
Fetch from L2 cache memory 7 s
Mutex lock/unlock ½ s
Fetch from main memory 1½ min
Send 2K bytes over 1Gbps network 5½ hours
Read 1MB sequentially from memory 3 days
Fetch from new disk location (seek) 13 weeks
Read 1MB sequentially from disk 6½ months
Send packet US to Europe and back 5 years
17. class Service[In, Out](name: String, f: In => Out)
type ReactiveService[I, O] = Service[I, Future[O]]
val f: I => Future[O]
type ReactiveStatefulService[S, I, E] = StatefulService[I, Future[State[S, E]]]
val f: I => Future[State[S, E]]
O = State[S, E]
30. Mobile growth changed customer behavior, new needs:
SCALABILITY is a must to run your business
Shift on priorities: AVAILABILITY over CONSISTENCY (CAP)
Infrastructure complexity and operational costs increase with MicroService
Architecture vs Monolith
Serverless is the way to go but are not yet good enough to manage State
https://cloudstate.io/