akka라이브러리를 이용해 구현하는 결함 내성 (발렌타인...
TRANSCRIPT
AGENDA
Reactive Architecture
Thread model VS Actor model
Master–Worker pattern
What is Future
All For One Strategy
Fault torlen
REACTIVE ARCHITECTURE
Reactive Programming ≒ Functional Programming
Functional Programming
• 데이터뿐만이아니라행위도인자값으로전달하는프로그래밍패러다임
4 Reactive Principles
• 1. Event-Driven
• 2. Scalable
• 3. Resilient (Fault Tolerance)
• 4. Responsive
ACTOR란?
액터는메시지를수신하고그에대한행위를함께
전달하는에이전트이다. 행위의종류에는다음과같은
것이있다.
• 메시지를자신또는다른액터에전송한다.
• 액터를생성한다.
• 다음의행동 (replacement behavior)을규정한다.
액터는메시지를수신하기위해하나의사서함을
가진다. 메시지는액터에직접전달되지않고사서함에
간접적으로전달된다. 사서함은버퍼링기능이있으나,
메시지는 FIFO로처리되는것은아니다.
액터가메시지를받으면일단잠금상태가된다. 잠기면
메시지는처리되지않는다. 다음액터가 become이
되면새로운후계액터가동일한사서함에서메시지를
읽고처리를계속한다.
THE BALANCING DISPATCHER
http://letitcrash.com/post/29044669086/balancing-workload-across-nodes-with-akka-2
FUTURE
A Future is an object holding a value which may become available at some point.
This value is usually the result of some other computation:
1. If the computation has not yet completed, we say that the Future is not
completed.
2. If the computation has completed with a value or with an exception, we say
that the Future is completed.
Completion can take one of two forms:
1. When a Future is completed with a value, we say that the future was
successfully completed with that value.
2. When a Future is completed with an exception thrown by the computation, we
say that the Future was failed with that exception.
http://docs.scala-lang.org/overviews/core/futures.html
SAMPLE CODE
• Master Worker model overview (Scala)
http://www.codeshare.io/MLmTt
• AllForOneStrategy (Scala)
http://www.codeshare.io/90b8v
• AKKA Fault Tolerance Sample
http://www.codeshare.io/Kzx1s(Java)