supervise your akka actors - devoxx
DESCRIPTION
People around you are talking about Akka and you ask yourself which kind of architecture you could set up, or how you can integrate them in your architecture ? And what is the learning curve ? Through a feedback, we’ll answer these questions and will show how, in 3 months, we set up an architecture based on Akka and Spray in Scala. We’ll speak about performance issues and fault tolerance with supervisors. Also we’ll see why it’s important to have some monitoring and efficient tests. Par Nicolas JozwiakTRANSCRIPT
@njozwiak#Devoxx #SuperviseAkka
Supervise your Akka actorsNicolas Jozwiak
Xebia
@njozwiak#Devoxx #SuperviseAkka
Who am I
Programmer and agiliste
@njozwiak
@njozwiak#Devoxx #SuperviseAkka
Agenda
• Context
• Why Akka and Scala ?
• Solution
• DevOps
• Issues and key learnings
• Results
@njozwiak#Devoxx #SuperviseAkka
Context
@njozwiak#Devoxx #SuperviseAkka
Talend
offers
Web Service offers
Logstash ElasticSearch UI result
syslog
offersFTP
1 Read FTP
2
Translate Xml in Jobs
3 Ask Web Service for diff
4 Save
@njozwiak#Devoxx #SuperviseAkka
• Not happy customers
• Business logic everywhere
• Talend processing complex
• Approximate error handling
• Dashboard not efficient
• Slow integrationlost processdifficult to replaytalend not known
@njozwiak#Devoxx #SuperviseAkka
• Increase processing reliability• Centralize business logic
• Enhance processing performance
@njozwiak#Devoxx #SuperviseAkka
Why Akka and Scala ?
@njozwiak#Devoxx #SuperviseAkka
Why Akka ?
• Isolate business code in actors
• Events to process
• Fault tolerance
• Supervision strategy
• Performance
@njozwiak#Devoxx #SuperviseAkka
Why Scala ?
• Team knew Scala (a little)
• Try Scala in the company
• Scala with Akka rocks !
@njozwiak#Devoxx #SuperviseAkka
Solution
@njozwiak#Devoxx #SuperviseAkka
Web Service offers
FTP
1
2
3
4
Read FTP
Translate Xml in Jobs
Ask Web Service for diff
Save
TalendAkka
offers
offers
@njozwiak#Devoxx #SuperviseAkka
Supervision
• Every single actor has a default supervisor strategy
• Means manage Actors failures
• Send a notification to its supervisor
• Clean separation of processing and error handling
@njozwiak#Devoxx #SuperviseAkka
Actor system
Actor1 Actor2
A D
B C
A
B CException
@njozwiak#Devoxx #SuperviseAkka
@njozwiak#Devoxx #SuperviseAkka
MasterSupervisor
FileSystem Supervisor
FileCrawler
Xml Supervisor
XmlReader
Posting Supervisor
DiffActorPosting Service
Syslog
DeadLetterListener
WorkStatus
@njozwiak#Devoxx #SuperviseAkka
DevOps
@njozwiak#Devoxx #SuperviseAkka
• No guarantee on message delivery
• Have some metrics :
‣ Logs
‣ Metrics with Graphite
‣ Ostrich (Twitter)
‣ Kamon IO
@njozwiak#Devoxx #SuperviseAkka
@njozwiak#Devoxx #SuperviseAkka
@njozwiak#Devoxx #SuperviseAkka
@njozwiak#Devoxx #SuperviseAkka
@njozwiak#Devoxx #SuperviseAkka
• Endpoints access with Spray :
‣ Statistics
‣ HealthCheck
‣ Workflow state
@njozwiak#Devoxx #SuperviseAkka
Issues and key learnings
@njozwiak#Devoxx #SuperviseAkka
• Actor system design
• An actor with lots of processing
• Unit testing
• Actors and Futures
@njozwiak#Devoxx #SuperviseAkka
• Mind shift
• Business events
• Delegate to actors
• Isolate business rules
• Behaviour testing
@njozwiak#Devoxx #SuperviseAkka
Results
@njozwiak#Devoxx #SuperviseAkka
• In production
• Proactive way
• Processing time
• Web Service to optimize
• FTP to remove
@njozwiak#Devoxx #SuperviseAkka
Conclusion
@njozwiak#Devoxx #SuperviseAkka
• Akka is very powerful
‣ Complex underlying notions
‣ Active ecosystem
• KISS
@njozwiak#Devoxx #SuperviseAkka
Thank youfor watching