These are the slides from my talk at the CodeMash 2017 conferenece: http://www.codemash.org/session/creating-a-responsive-application-using-reactive-extensions/
Code examples are located here: https://github.com/tamirdresher/FromZeroToTheActorModel
2. 2
• Author of Rx.NET in Action (manning publications)
• Software architect, consultant and instructor
• Software Engineering Lecturer @ Ruppin Academic Center
@tamir_dresher
tamirdr@codevalue.net
http://www.TamirDresher.com.
About Me
4. Agenda
1. Actor Model
2. Semiconductors
3. Metrology Target Designer (MTD) by KLA-Tencor
4. Rearchitecting to Actor Model with Akka.NET
4
5. The Actor Model (Hewitt et al. 1973)
5
Alice
Mailbox
Bob
Sally
Mailbox
Mailbox
“the Actor model retained
more of what I thought
were the good features of
the object idea.”
Alan Kay
Object Orientation pioneer
and Smalltalk co-designer
Alice
Parent
Bob
Parent
Sally
Parent
7. Actors in Akka.NET
public class CoordinatorActor : ReceiveActor
{
public CoordinatorActor()
{
Receive<StartSimulation>(start =>
{
//Initiate a new simulation
});
}
}
public class StartSimulation
{
public Guid ProjectId { get; set; }
}
7
9. Location Transparency (kind of…)
Actors live inside an ActorSystem
Each Actor has a unique address
Local: akka://ActorSystem-A/user/A2
Remote: akka.tcp://ActorSystem-C@Machine-B:5678/user/C1
Machine A Machine B
ActorSystem A
A1
A2
ActorSystem B
B1
B2
ActorSystem C
C1
9
10. Actor Model Messaging Decoupling
Message passing yields decoupling
Interesting messaging patterns are now available
Alice
Sally
Bob
Forwarding
Alice
Sally
Bob
Multiple Responses
10
12. KLA-Tencor Corporation is a
leading supplier of process control
and yield management solutions
for the semiconductor and related
microelectronics industries
12
16. MTD Original Architecture
Technology B Services
Technology A ServicesUI Clients
Stack
composer
Material
manager
Simulation
setup
DOE
generator
Geometry
Materials
Simulation
Results
HTTP requests
Notification hubSubscribe
Notify
Notify
Distribution
Service
Cluster
Outgoing queue
per simulation
Incoming queue
per simulation
Simulation Coordinator
Technology A
Simulator
Technology B
Simulator
otify
16
18. Actor Based Architecture - Hierarchy
/user
Simulation
Coordinator
Simulation
Queue
Simulation
Notifier
Technology A
Coordinator
Technology A
Simulation
Sub
Simulation 1
Sub
Simulation 2
Sub
Simulation 3
Technology B
Coordinator
Technology B
Simulation
Sub
Simulation 1
Sub
Simulation 2
Sub
Simulation 3
18
20. Statefulness and Behavior switching
Stateful is no longer a dirty word (kind of…)
The less calls you have for the persistence store the better the
performance will be
Durability is a must (state-awareness)
State goes hand-in-hand with supported behavior
Actors have the power to switch their behaviors at any point in time.
the actor becomes busy or the actor becomes connected.
Which messages to Receive, Deny, Postpone (Stashing)
State machine
20
24. Final thoughts
Testing – easier sometimes, harder sometimes
Dependency injection – injecting ActorRefsActorSelections is not intuitive
Runtime contract vs. compile-time contract
Your messages are the contract
Messages versioning should be considered up-front
24
25. Summary
1. Actor Model
2. Semi conductor
3. Metrology Target Designer (MTD) by KLA-Tencor
4. Rearchitecting to Actor Model with Akka.NET
25
My name is tamir dresher
Im an architect from codevalue israel and a software engineering lecturer at the ruppin academic center
CodeValue is a consulting company and we are also the proud development center of OzCode the amazing debugging extension for visual studio. We have a booth here at conference, so please go and check it out, youll be amazed how you lived without it.
My book Rx in action is now available at Manning early access program should be published in the next few months.
And that the end of my self promotion(it never hurts right?).
So what are we really here for?
ארכיטקטורת תוכנה היא נורא דומה לפסטה
ואפשר לראות את ההתפתחות שלנו כתעשיה בוסג הפסטה שאנחנו משתמשים
בהתחלה כולנו כתבנו ספגטי קוד עם GOTO
ואז למדנו שאי אפשר אפילו להבין ולתחזק את מה שאנחנו כתבנו אז עברנו למודל הלזניה והתחלנו לכתוב הכל בשכבות
ואז ראינו שלהכין את הלזניה כחתיכה אחת זה לא מספיק טוב, בטח כשיש לנו המון סועדים ועדיף לנו לחלק אותה לחתיכות קטנות יותר
מה שיצר את מודל הרביולי – אותם microservices שהם הBUZZWORD שכולם נהנים להגיד
איך שלא יהיה, בסופו של דבר יש לנו משתמש שנמצא בקצה אחד שרוצה לקבל שירות, בין אם המשתמש אנושי או מערכת אחרת.
והמטרה הסופית שלנו כשעשינו את המערכת זה שהיא תדע להגיב
כמו כן אני מרצה במרכז האקדמי רופין
אחד הbuzzwords שאנחנו שומעים יותר ויותר בשנים האחרונות הוא נושא ה Reactiveness של מערכות ושל אפליקציות ובשפות תכנות באופן כללי.
גם אותי זה נורא הלהיב, ובפרט הטכנולוגיה שנקראת
זה הלהיב אותי כל כך שכתבתי ספר בנושא Reactive Extensions in Action בהוצאת manning
קצת Self Promotion לא הזיק
אבל בוא נקח רגע צעד אחורה ונסתכל על האבולוציה של הארכיטקטורות שלנו
מודל נוסף שמקיים את הדרישות של ארכיטקטורה שהיא reactive הוא הActor model
הוצג ע"י Carl Hewitt ב1973
Actors are just classes like you normally write.
The only difference here is that it derives from the RecieveActor base class
This give our CoordinatorActor in this case the ability to receive and react to messages.
Messages are also simple classes, they are POCO that will be serialized when between the actors
The amount of concurrent simulations vs available clusters is virtually non-controlable
Pools
Router "Pools" are routers that create their own worker actors, that is; you provide the number of instances as a parameter to the router and the router will handle routee creation by itself.
Groups
Sometimes, rather than having the router actor create its routees, it is desirable to create routees yourself and provide them to the router for its use. You can do this by passing the paths of the routees to the router's configuration. Messages will be sent with ActorSelection to these paths.