Supervise your Akka actors

Post on 05-Dec-2014

212 views 0 download

description

Vous avez entendu parler des acteurs Akka et vous vous demandez quels types d’architectures vous pouvez mettre en place, ou comment les intégrer dans votre architecture ? Et quelle est la courbe d’apprentissage ? A travers un retour d’expérience, nous répondrons à ces questions et vous montrerons comment en trois mois nous avons mis en place une architecture basée sur Akka et Spray en Scala. Par Nicolas Jozwiak

transcript

Supervise your akka actorsNicolas Jozwiak

Programmeur and agiliste!!@njozwiak

Contents•Context !•Why Akka and Scala ? !•Solution !•DevOps !• Issues and knowledges !•Results

Context

Talend

offers

Web Service offers

Logstash ElasticSearch UI result

syslog

offersFTP

TalendWeb Service

offers

FTP

1 Read FTP

2

Translate Xml in Jobs

3 Ask Web Service for diff

4 Save

offers

offers

•Not happy customers • Lost process •Difficult to replay •Dashboard not

efficient

• Business logic everywhere • Talend processing

complex and not known • Approximate error

handling • Slow integration

• Increase processing reliability

• Centralize business logic

• Enhance processing performance

Why Akka and Scala ?

• Isolate business code in actors

• Events to process

• Fault tolerance

• Supervision strategy

• Performance

Why Akka ?

• Team knows Scala (a little)

• Try Scala in the company

• Scala with Akka rocks !

Why Scala ?

Solution

Web Service offers

FTP

1

2

3

4

Read FTP

Translate Xml in Jobs

Ask Web Service for diff

Save

TalendAkka

offers

offers

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

Actor system

Actor1 Actor2

A D

B C

A

B CException

MasterSupervisor

FileSystem Supervisor

FileCrawler

Xml Supervisor

XmlReader

Posting Supervisor

DiffActorPosting Service

Syslog

DeadLetterListener

WorkStatus

DevOps

•No guarantee on message delivery

•Have some metrics : ‣Logs ‣Metrics with Graphite ‣Ostrich (Twitter) ‣Kamon IO

• Endpoints access with Spray : ‣Statistics ‣HealthCheck ‣Workflow state

Issues & knowledges

• Actor system design • An actor with lots of processing • Unit testing • Actors and Futures

•Mind shift

• Business events

•Delegate to actors

• Isolate business rules

• Behaviour testing

•Domain Driven Design applied

‣Make implicit concepts explicit

‣Aggregates

MasterSupervisor

Xml Supervisor

XmlReader

DeadLetterListener

Entry point

Never call !

Results

• In production

• Proactive way

•New dashboard

• Processing time

•Web Service to optimize

• FTP to remove

Conclusion

• Akka is very powerful ‣Complex underlying notions ‣Active ecosystem

• KISS

Thank you for watching