Akka Fault Tolerance
-
Upload
hyungho-ko -
Category
Software
-
view
1.160 -
download
4
Transcript of Akka Fault Tolerance
Akka.NET 을 이용한
더 단순한 Fault Tolerance 소프트웨어
고형호
12/05/2015
http://www.slideshare.net/HyungHoKo/
1. 장애 허용 시스템
2. 아키텍처 방향
3. 예외 처리 방향
4. 장애 돌파 기대효과
5. 사례
6. 참고 자료
https://en.wikipedia.org/wiki/Actor_model
We believe that writing
correct concurrent & distributed,
resilient and
elastic applications
is too hard.
Most of the time
it's because we are using
the wrong tools and
the wrong level of abstraction.
https://github.com/akka/akka
유연성(Resilient)
고장이 일어나도 시스템 전체는 계속 반응하는 것
1. 장애 허용 시스템
로그
시스템을 구성하는 부품의 일부에서
1 + 6 = 7
소프트웨어
결함(Fault) 또는 고장(Failure)이 발생하여도
정상적 혹은 부분적으로 기능을 수행할 수 있는 시스템이다.
장애
https://ko.wikipedia.org/wiki/장애 _허용_시스템
객체
1 + 6 = 7로그
1 + 6 = 2015
원인 파악 불가
1 + 6 = 7
10분
1 + 6 = 7
랜덤
1 + 6 = 2015
1 + 6 = 7
소스 불 일지
int float
1 + 6 =
DLL 불 일지 미적용
호출 안됨
1 + 6 =
?분
null + 6 =
처리하지 않은 예외
1 + 6 =
메모리 예외
프로그램 종료
프로그램 종료
프로그램 종료원하는종료
원하지 않는종료
…
…
예외
예외
2. 아키텍처 방향
How Higher level of Abstraction
To make a shortened form of a thing by separating out what is important.
중요한 부분만을 분리하여 간결하게 만드는 것.
제거(Eliminating)
단순(Simple)
...
Vs.
...
입력 출력프로세스
Vs.
입력 출력프로세스
Garbage in Garbage out
장애
개선A
...
개선B
개선C
돌파
시간
속도
쉬운
쉬움을 단순한 것으로 착각한다.
Why?
훈련 친숙함(Familiarity)
단순한(Simple)
그 안에 여러 가지를 분리해 내서 하나의 것으로 다룰 수 있게 하는 것
반대말
복잡한(Complex)
그 안에 여러 가지가 섞여 있는 것(여러 가지를 같이 엮는 것)
어려운(Difficult)
그것을 얻는데 에너지가 많이 드는 것
쉬운(Easy)
그것을 얻는데 에너지가 덜 드는 것(가까이에 놓인 것)
반대말
쉬움은
복잡성을 가리고 진실을 덮는다.
단순한
생산성(Productivity)
복잡성(Complexity)
시간
강도
http://www.techsuda.com/archives/2362
최대한 단순하게 만들되,
(그 물체나 현상이 가지고 있는 실제의 본질이나 원리보다는)
더 단순하게 만들지 말라.
문제
프로그램종료
추상화
돌파방향 ?
시간
동시 부분
순차 부분
C=1 C=2 C=4 C=8
코어 개수
성능 개선
동시 부분
…
C=∞
직접 간접
동기
비동기
순차
동시
Vs.
문제
비동기
동시
간접
프로그램종료
추상화
돌파방향
3. 예외 처리 방향
CustomerCoffee
Machine
Insert coins
Gets coffee
Add more coins
http://www.slideshare.net/jboner/go-reactive-42084559
CustomerCoffee
Machine
Insert coins
Out of coffee beans error
Wrong
http://www.slideshare.net/jboner/go-reactive-42084559
ServiceGuy
CustomerCoffee
Machine
Insert coins
Gets coffee
Addsmore beans
Add more coins
Out of coffee beans
error
책임
http://www.slideshare.net/jboner/go-reactive-42084559
Client Service
Request
Response
ManagesFailure
Validation Error
Supervisor
트리
http://www.slideshare.net/jboner/go-reactive-42084559
ApplicationError
책임
문제
간접
비동기
동시
책임
트리
프로그램종료
추상화
해결
적용
돌파방향
입력 출력프로세스
Garbage in Garbage out
One for One All for One
parent
child1 child2
ExceptionStop
Exception
Message
parent
child1 child2
StopException
Exception
Message
Stop
Restart
Resume
Escalate
예외 복구
= Crash Safely
= Recover Fast
4. 장애 돌파 기대효과
Akka장애(프로그램 종료)
http://www.flaticon.com/
Garbage in Garbage out
Let it crash!
5. 사례
UnhandledExcepCalc
UnhandledExcepCalcWithPersist
OutOfMemoryExcepCalc
OutOfMemoryExcepCalcWithGC
NotRespondingCalcWithTimeout
NotRespondingCalc
UnhandledExcepCalc OutOfMemoryExcepCalc NotRespondingCalc
CalcException
Exception
Message
Stop
UnhandledExcepCalc OutOfMemoryExcepCalc NotRespondingCalc
CalcException
Exception
Message
Stop
Actor
Children
SupervisorStrategy
State
Behavior
Mailbox 1 2 3 4 5
비동기
IActorRefTransportTransport
간접
동시
1. 살아 있니?(다른 스레드)
2. 예외/예외 복구
3. 아직도 살아 있니?
Restart
3. 예외/예외 복구
5. 아직도 살아 있니?
2. Count / (1 or 0)1. 살아 있니?(다른 스레드)
4. 복원6. 복원된 메시지 확인
Restart
Stop, Shutdown, PoisonPill, Kill
ActorPath
Empty path
ActorInstance
Actor incarnation
ActorOf( … )
ResumeNew
Instance
new instance replaces old
Restart
IActorRef
ActorSelection
Constructor
PreStart()
PostRestart()
PreRestart() 1
PostStop() 2
6
3
5
4
Keep going!
Stop
생애
1. 살아 있니?(다른 스레드)
2. 예외/예외 복구
3. 아직도 살아 있니?
Restart
OutOfMemoryException
1. 살아 있니?(다른 스레드)
2. 예외/예외 복구
3. 아직도 살아 있니?
GC
Restart
OutOfMemoryException
PostRestart 메소드에서 GC 호출
Start
Supervisor
Ready상태
Child
Parent
Exception
사용자정의
Cancel
Finished
Timeout
…
Working상태
1. 살아 있니?(다른 스레드)
2. 시작 메시지 3. 작업 중
4. 취소 메시지5. 아직도 살아 있니?
1. 살아 있니?(다른 스레드)
2. 시작 메시지 3. 작업 중
4. Timeout 예외/예외 복구 5. 아직도 살아 있니?
Restart
6. 참고 자료
http://getakka.net/http://akka.io/
http://letitcrash.com/ https://petabridge.com/blog/
Akka.NETAkka
https://www.youtube.com/playlist?list=PLVsNizTWUw7EH7R0gP6qyc4p-vOc6jvJq
임백준의 Akka 시작하기 동영상
임백준의 Akka 시작하기 eBook
http://www.hanbit.co.kr/ebook/look.html?isbn=9788968487897
http://www.slideshare.net/jboner
Jonas Bonér SlideShare
Akka
Akka Blog
Akka.NET
Akka.NET Blog
https://www.youtube.com/channel/UC6sEBl_3Enes2k0FZKzFkoA
Akka.NET Youtube
https://www.youtube.com/watch?v=DeiKrdbNl68
SpringCamp2013 이장원 - Akka 소개 및 Redis를 활용한 Pub/Sub 시스템 구현 동영상