SlideShare a Scribd company logo
1 of 24
Akka Actors




@Sander_Mak
Akka
              Part of



              stack

Written in Scala
With officially supported Java API
Akka

     ‘s premise
It’s too hard to write systems that are:

  Concurrent & Correct
  Highly scalable
  Fault-tolerant
Akka

   2.0
Actors
Software Transactional Memory
Dataflow concurrency
Futures
Akka
who uses



           ?
               traffic management
Actors
Inspired by               :


    Asynchronous message passing
    Scale up, scale out
    Fault-tolerant (‘let it crash’)
Actors
How to define an actor?
                         ~400 bytes




                         Local state

                          Behavior




               mailbox
Actors
How to define an actor?
                              ~400 bytes
  Create more actors
  Send messages
  Modify state                Local state

  Modify behavior              Behavior




                    mailbox
Actors
How to define an actor?


class MyFirstActor extends Actor {
  var total = 0

    def receive = {
      case MyMessage(payload) => println(“Received: “ + payload”)
      case countMessage: Int => total += countMessage
      case _ => println("Unknown message")
    }
}
Actors
Dispatcher: contains executor strategy




                           Local state
       Event-driven
                           Behavior




                 mailbox
Actors and Fork/Join
Ping/pong messages (no processing)




                   Improved
 48
                 JSR-166 build (     ?)
cores
Demo
                 NearestCityActor
                 NearestCityActor
                  NearestCityActor
                  NearestCityActor



  RoundRobin                       Result
    Router                     ListenerActor



Messages with cities             Print results
Supervision
Hierarchical supervision
 Child actors supervised by parent
Trap exceptions and apply recovery
Error Kernel pattern

 Actor 1     create child
                actor
                            Actor 2   dangerous
                                      operation
  critical
   state      supervise




Distinguish scratch and critical state
Supervision
class GuardianActor extends Actor {

    def supervisorStrategy = OneForOneStrategy({
        case _:CompanyBankruptException    => Stop
        case _:InvalidStateException       => Restart
        case _:ServiceUnavailableException => Resume
        case _                             => Escalate
     }, maxNrOfRetries = 3, 5.seconds)

    def receive = {
      ...
    }
}




             Actor may implement
            preRestart & postRestart
Remote actors
Dispatchers for scale-up, remote actors for scala-out


   Machine A                           Machine B
                    actor2 ! SomeMsg
      Actor 1                           Actor 2
                     Netty, Protobuf



      Router                            Actor 3


   Actor creation
   Supervision
   Remote deploy through config (no code change)
Remote actors
Creating 10 actors on 2 nodes with a router
 akka	
  {
 	
  	
  actor	
  {
 	
  	
  	
  	
  deployment	
  {
 	
  	
  	
  	
  	
  	
  /serviceA/aggregation	
  {
 	
  	
  	
  	
  	
  	
  	
  	
  router	
  =	
  "round-­‐robin"
 	
  	
  	
  	
  	
  	
  	
  	
  nr-­‐of-­‐instances	
  =	
  10
 	
  	
  	
  	
  	
  	
  	
  	
  target	
  {
 	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  nodes	
  =	
  ["akka://app@10.0.0.2:2552",	
  "akka://app@10.0.0.3:2552"]
 	
  	
  	
  	
  	
  	
  	
  	
  }
 	
  	
  	
  	
  	
  	
  }
 	
  	
  	
  	
  }
 	
  	
  }
 }




Looking up a remote actor
 val	
  actor	
  =	
  
 	
  	
  	
  context.actorFor("akka://actorSystemName@10.0.0.1:2552/user/actorName")
Blocking
Actors lift some ForkJoin restrictions
    Remoting possible
    Recursive decomposition optional
    Fault-tolerant

Still, there are restrictions similar to ForkJoin tasks

    No blocking IO
    No explicit locking
    No shared memory writes
Async IO
 Based on composable Futures

Serve http
                mini               akka-Spray


Consume http
               async-http-client


Persistence
                hammersmith
Async IO
          Based on Java NIO


Akka IO

   Immutable abstractions on top of:
     Channels
     Streams (Iteratee based)
   Bridges (low-level) async IO and actors
Async IO
       Practical application:




  JMeter => 1 user, 1 thread     Gatling => 1 user, 1 actor
+ blocking IO                   + async-http-client

= OutOfMemory errors            =
  or clustering necessary

  time drift in results
Async IO
       Practical application:




  JMeter => 1 user, 1 thread     Gatling => 1 user, 1 actor
+ blocking IO                   + async-http-client

= OutOfMemory errors            =
  or clustering necessary

  time drift in results
Is that all?
             Finite State Machine          Akka TestKit




 core
          Scheduler                 Event Bus




modules
Is that all?
                   Typesafe
                   Console




Commercial
subscription
Questions?


      Code @ bit.ly/bejug-akka

More Related Content

What's hot

What's hot (19)

Advanced akka features
Advanced akka featuresAdvanced akka features
Advanced akka features
 
Actor Model Akka Framework
Actor Model Akka FrameworkActor Model Akka Framework
Actor Model Akka Framework
 
Java 8 parallel stream
Java 8 parallel streamJava 8 parallel stream
Java 8 parallel stream
 
Akka - A Brief Intro
Akka - A Brief IntroAkka - A Brief Intro
Akka - A Brief Intro
 
JAVA 8 Parallel Stream
JAVA 8 Parallel StreamJAVA 8 Parallel Stream
JAVA 8 Parallel Stream
 
Akka Futures and Akka Remoting
Akka Futures  and Akka RemotingAkka Futures  and Akka Remoting
Akka Futures and Akka Remoting
 
JavaCro'14 - Is there Kotlin after Java 8 – Ivan Turčinović and Igor Buzatović
JavaCro'14 - Is there Kotlin after Java 8 – Ivan Turčinović and Igor BuzatovićJavaCro'14 - Is there Kotlin after Java 8 – Ivan Turčinović and Igor Buzatović
JavaCro'14 - Is there Kotlin after Java 8 – Ivan Turčinović and Igor Buzatović
 
Working With Concurrency In Java 8
Working With Concurrency In Java 8Working With Concurrency In Java 8
Working With Concurrency In Java 8
 
The internet of (lego) trains
The internet of (lego) trainsThe internet of (lego) trains
The internet of (lego) trains
 
Unit Testing and Coverage for AngularJS
Unit Testing and Coverage for AngularJSUnit Testing and Coverage for AngularJS
Unit Testing and Coverage for AngularJS
 
Angular Weekend
Angular WeekendAngular Weekend
Angular Weekend
 
Testing in Scala. Adform Research
Testing in Scala. Adform ResearchTesting in Scala. Adform Research
Testing in Scala. Adform Research
 
Intro to JavaScript
Intro to JavaScriptIntro to JavaScript
Intro to JavaScript
 
Grand Central Dispatch
Grand Central DispatchGrand Central Dispatch
Grand Central Dispatch
 
Concurrency
ConcurrencyConcurrency
Concurrency
 
Spring boot
Spring bootSpring boot
Spring boot
 
Headless fragments in Android
Headless fragments in AndroidHeadless fragments in Android
Headless fragments in Android
 
Understanding react hooks
Understanding react hooksUnderstanding react hooks
Understanding react hooks
 
Java 9, JShell, and Modularity
Java 9, JShell, and ModularityJava 9, JShell, and Modularity
Java 9, JShell, and Modularity
 

Viewers also liked (20)

____,___
____,_______,___
____,___
 
Selecting a Digital Banking Platform 2017-2018
Selecting a Digital Banking Platform 2017-2018Selecting a Digital Banking Platform 2017-2018
Selecting a Digital Banking Platform 2017-2018
 
Onestival pres
Onestival presOnestival pres
Onestival pres
 
Presentation2[1]
Presentation2[1]Presentation2[1]
Presentation2[1]
 
Roadmap to WordPress Accessibility CSUN 2014
Roadmap to WordPress Accessibility CSUN 2014Roadmap to WordPress Accessibility CSUN 2014
Roadmap to WordPress Accessibility CSUN 2014
 
11 necto installation_ready
11 necto installation_ready11 necto installation_ready
11 necto installation_ready
 
Aim Presentation
Aim PresentationAim Presentation
Aim Presentation
 
Klimatstrategimall
KlimatstrategimallKlimatstrategimall
Klimatstrategimall
 
Kosvenie rechevie akty
Kosvenie rechevie aktyKosvenie rechevie akty
Kosvenie rechevie akty
 
Prioritas Diklat
Prioritas DiklatPrioritas Diklat
Prioritas Diklat
 
Cross-Build Injection attacks: how safe is your Java build?
Cross-Build Injection attacks: how safe is your Java build?Cross-Build Injection attacks: how safe is your Java build?
Cross-Build Injection attacks: how safe is your Java build?
 
Communication 1
Communication 1Communication 1
Communication 1
 
Teenager
TeenagerTeenager
Teenager
 
Unmanned Video citizin services
Unmanned Video citizin servicesUnmanned Video citizin services
Unmanned Video citizin services
 
How is my Artist Marketed??
How is my Artist Marketed??How is my Artist Marketed??
How is my Artist Marketed??
 
MVC CSRF Protection
MVC CSRF ProtectionMVC CSRF Protection
MVC CSRF Protection
 
William turner
William turnerWilliam turner
William turner
 
Halloween
HalloweenHalloween
Halloween
 
Google Doc Ch4
Google Doc Ch4Google Doc Ch4
Google Doc Ch4
 
Term 4 eport
Term 4 eportTerm 4 eport
Term 4 eport
 

Similar to Akka (BeJUG)

Building Massively Scalable application with Akka 2.0
Building Massively Scalable application with Akka 2.0Building Massively Scalable application with Akka 2.0
Building Massively Scalable application with Akka 2.0Knoldus Inc.
 
Introduction to Actor Model and Akka
Introduction to Actor Model and AkkaIntroduction to Actor Model and Akka
Introduction to Actor Model and AkkaYung-Lin Ho
 
Akka london scala_user_group
Akka london scala_user_groupAkka london scala_user_group
Akka london scala_user_groupSkills Matter
 
First glance at Akka 2.0
First glance at Akka 2.0First glance at Akka 2.0
First glance at Akka 2.0Vasil Remeniuk
 
JavaOne: A tour of (advanced) akka features in 60 minutes [con1706]
JavaOne: A tour of (advanced) akka features in 60 minutes [con1706]JavaOne: A tour of (advanced) akka features in 60 minutes [con1706]
JavaOne: A tour of (advanced) akka features in 60 minutes [con1706]Johan Janssen
 
A tour of (advanced) Akka features in 40 minutes
A tour of (advanced) Akka features in 40 minutesA tour of (advanced) Akka features in 40 minutes
A tour of (advanced) Akka features in 40 minutesJohan Janssen
 
Real world Scala hAkking NLJUG JFall 2011
Real world Scala hAkking NLJUG JFall 2011Real world Scala hAkking NLJUG JFall 2011
Real world Scala hAkking NLJUG JFall 2011Raymond Roestenburg
 
Akka Microservices Architecture And Design
Akka Microservices Architecture And DesignAkka Microservices Architecture And Design
Akka Microservices Architecture And DesignYaroslav Tkachenko
 
Event Sourcing and beyond with Akka.NET Persistence
Event Sourcing and beyond with Akka.NET PersistenceEvent Sourcing and beyond with Akka.NET Persistence
Event Sourcing and beyond with Akka.NET PersistenceKonrad Dusza
 
Akka Actors: an Introduction
Akka Actors: an IntroductionAkka Actors: an Introduction
Akka Actors: an IntroductionRoberto Casadei
 
Akka lsug skills matter
Akka lsug skills matterAkka lsug skills matter
Akka lsug skills matterSkills Matter
 
Scaling Web Apps with Akka
Scaling Web Apps with AkkaScaling Web Apps with Akka
Scaling Web Apps with AkkaMaciej Matyjas
 
Reactive Microservices with JRuby and Docker
Reactive Microservices with JRuby and DockerReactive Microservices with JRuby and Docker
Reactive Microservices with JRuby and DockerJohn Scattergood
 
Reactive Programming in .Net - actorbased computing with Akka.Net
Reactive Programming in .Net - actorbased computing with Akka.NetReactive Programming in .Net - actorbased computing with Akka.Net
Reactive Programming in .Net - actorbased computing with Akka.NetSören Stelzer
 
Building Stateful Microservices With Akka
Building Stateful Microservices With AkkaBuilding Stateful Microservices With Akka
Building Stateful Microservices With AkkaYaroslav Tkachenko
 
GR8Conf 2011: GPars
GR8Conf 2011: GParsGR8Conf 2011: GPars
GR8Conf 2011: GParsGR8Conf
 
Above the clouds: introducing Akka
Above the clouds: introducing AkkaAbove the clouds: introducing Akka
Above the clouds: introducing Akkanartamonov
 
Reactive programming with akka
Reactive programming with akka Reactive programming with akka
Reactive programming with akka Sovon Nath
 
Reactive Programming in Akka
Reactive Programming in AkkaReactive Programming in Akka
Reactive Programming in AkkaDevFest DC
 

Similar to Akka (BeJUG) (20)

Building Massively Scalable application with Akka 2.0
Building Massively Scalable application with Akka 2.0Building Massively Scalable application with Akka 2.0
Building Massively Scalable application with Akka 2.0
 
Introduction to Actor Model and Akka
Introduction to Actor Model and AkkaIntroduction to Actor Model and Akka
Introduction to Actor Model and Akka
 
Akka london scala_user_group
Akka london scala_user_groupAkka london scala_user_group
Akka london scala_user_group
 
First glance at Akka 2.0
First glance at Akka 2.0First glance at Akka 2.0
First glance at Akka 2.0
 
JavaOne: A tour of (advanced) akka features in 60 minutes [con1706]
JavaOne: A tour of (advanced) akka features in 60 minutes [con1706]JavaOne: A tour of (advanced) akka features in 60 minutes [con1706]
JavaOne: A tour of (advanced) akka features in 60 minutes [con1706]
 
A tour of (advanced) Akka features in 40 minutes
A tour of (advanced) Akka features in 40 minutesA tour of (advanced) Akka features in 40 minutes
A tour of (advanced) Akka features in 40 minutes
 
Real world Scala hAkking NLJUG JFall 2011
Real world Scala hAkking NLJUG JFall 2011Real world Scala hAkking NLJUG JFall 2011
Real world Scala hAkking NLJUG JFall 2011
 
Basics of Akka
Basics of AkkaBasics of Akka
Basics of Akka
 
Akka Microservices Architecture And Design
Akka Microservices Architecture And DesignAkka Microservices Architecture And Design
Akka Microservices Architecture And Design
 
Event Sourcing and beyond with Akka.NET Persistence
Event Sourcing and beyond with Akka.NET PersistenceEvent Sourcing and beyond with Akka.NET Persistence
Event Sourcing and beyond with Akka.NET Persistence
 
Akka Actors: an Introduction
Akka Actors: an IntroductionAkka Actors: an Introduction
Akka Actors: an Introduction
 
Akka lsug skills matter
Akka lsug skills matterAkka lsug skills matter
Akka lsug skills matter
 
Scaling Web Apps with Akka
Scaling Web Apps with AkkaScaling Web Apps with Akka
Scaling Web Apps with Akka
 
Reactive Microservices with JRuby and Docker
Reactive Microservices with JRuby and DockerReactive Microservices with JRuby and Docker
Reactive Microservices with JRuby and Docker
 
Reactive Programming in .Net - actorbased computing with Akka.Net
Reactive Programming in .Net - actorbased computing with Akka.NetReactive Programming in .Net - actorbased computing with Akka.Net
Reactive Programming in .Net - actorbased computing with Akka.Net
 
Building Stateful Microservices With Akka
Building Stateful Microservices With AkkaBuilding Stateful Microservices With Akka
Building Stateful Microservices With Akka
 
GR8Conf 2011: GPars
GR8Conf 2011: GParsGR8Conf 2011: GPars
GR8Conf 2011: GPars
 
Above the clouds: introducing Akka
Above the clouds: introducing AkkaAbove the clouds: introducing Akka
Above the clouds: introducing Akka
 
Reactive programming with akka
Reactive programming with akka Reactive programming with akka
Reactive programming with akka
 
Reactive Programming in Akka
Reactive Programming in AkkaReactive Programming in Akka
Reactive Programming in Akka
 

More from Sander Mak (@Sander_Mak)

TypeScript: coding JavaScript without the pain
TypeScript: coding JavaScript without the painTypeScript: coding JavaScript without the pain
TypeScript: coding JavaScript without the painSander Mak (@Sander_Mak)
 
The Ultimate Dependency Manager Shootout (QCon NY 2014)
The Ultimate Dependency Manager Shootout (QCon NY 2014)The Ultimate Dependency Manager Shootout (QCon NY 2014)
The Ultimate Dependency Manager Shootout (QCon NY 2014)Sander Mak (@Sander_Mak)
 
Hibernate Performance Tuning (JEEConf 2012)
Hibernate Performance Tuning (JEEConf 2012)Hibernate Performance Tuning (JEEConf 2012)
Hibernate Performance Tuning (JEEConf 2012)Sander Mak (@Sander_Mak)
 

More from Sander Mak (@Sander_Mak) (20)

Scalable Application Development @ Picnic
Scalable Application Development @ PicnicScalable Application Development @ Picnic
Scalable Application Development @ Picnic
 
Coding Your Way to Java 13
Coding Your Way to Java 13Coding Your Way to Java 13
Coding Your Way to Java 13
 
Coding Your Way to Java 12
Coding Your Way to Java 12Coding Your Way to Java 12
Coding Your Way to Java 12
 
Java Modularity: the Year After
Java Modularity: the Year AfterJava Modularity: the Year After
Java Modularity: the Year After
 
Desiging for Modularity with Java 9
Desiging for Modularity with Java 9Desiging for Modularity with Java 9
Desiging for Modularity with Java 9
 
Modules or microservices?
Modules or microservices?Modules or microservices?
Modules or microservices?
 
Migrating to Java 9 Modules
Migrating to Java 9 ModulesMigrating to Java 9 Modules
Migrating to Java 9 Modules
 
Java 9 Modularity in Action
Java 9 Modularity in ActionJava 9 Modularity in Action
Java 9 Modularity in Action
 
Java modularity: life after Java 9
Java modularity: life after Java 9Java modularity: life after Java 9
Java modularity: life after Java 9
 
Provisioning the IoT
Provisioning the IoTProvisioning the IoT
Provisioning the IoT
 
Event-sourced architectures with Akka
Event-sourced architectures with AkkaEvent-sourced architectures with Akka
Event-sourced architectures with Akka
 
TypeScript: coding JavaScript without the pain
TypeScript: coding JavaScript without the painTypeScript: coding JavaScript without the pain
TypeScript: coding JavaScript without the pain
 
The Ultimate Dependency Manager Shootout (QCon NY 2014)
The Ultimate Dependency Manager Shootout (QCon NY 2014)The Ultimate Dependency Manager Shootout (QCon NY 2014)
The Ultimate Dependency Manager Shootout (QCon NY 2014)
 
Modular JavaScript
Modular JavaScriptModular JavaScript
Modular JavaScript
 
Modularity in the Cloud
Modularity in the CloudModularity in the Cloud
Modularity in the Cloud
 
Scala & Lift (JEEConf 2012)
Scala & Lift (JEEConf 2012)Scala & Lift (JEEConf 2012)
Scala & Lift (JEEConf 2012)
 
Hibernate Performance Tuning (JEEConf 2012)
Hibernate Performance Tuning (JEEConf 2012)Hibernate Performance Tuning (JEEConf 2012)
Hibernate Performance Tuning (JEEConf 2012)
 
Fork Join (BeJUG 2012)
Fork Join (BeJUG 2012)Fork Join (BeJUG 2012)
Fork Join (BeJUG 2012)
 
Fork/Join for Fun and Profit!
Fork/Join for Fun and Profit!Fork/Join for Fun and Profit!
Fork/Join for Fun and Profit!
 
Kscope11 recap
Kscope11 recapKscope11 recap
Kscope11 recap
 

Recently uploaded

Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????blackmambaettijean
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 

Recently uploaded (20)

Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 

Akka (BeJUG)

  • 2. Akka Part of stack Written in Scala With officially supported Java API
  • 3. Akka ‘s premise It’s too hard to write systems that are: Concurrent & Correct Highly scalable Fault-tolerant
  • 4. Akka 2.0 Actors Software Transactional Memory Dataflow concurrency Futures
  • 5. Akka who uses ? traffic management
  • 6. Actors Inspired by : Asynchronous message passing Scale up, scale out Fault-tolerant (‘let it crash’)
  • 7. Actors How to define an actor? ~400 bytes Local state Behavior mailbox
  • 8. Actors How to define an actor? ~400 bytes Create more actors Send messages Modify state Local state Modify behavior Behavior mailbox
  • 9. Actors How to define an actor? class MyFirstActor extends Actor { var total = 0 def receive = { case MyMessage(payload) => println(“Received: “ + payload”) case countMessage: Int => total += countMessage case _ => println("Unknown message") } }
  • 10. Actors Dispatcher: contains executor strategy Local state Event-driven Behavior mailbox
  • 11. Actors and Fork/Join Ping/pong messages (no processing) Improved 48 JSR-166 build ( ?) cores
  • 12. Demo NearestCityActor NearestCityActor NearestCityActor NearestCityActor RoundRobin Result Router ListenerActor Messages with cities Print results
  • 13. Supervision Hierarchical supervision Child actors supervised by parent Trap exceptions and apply recovery Error Kernel pattern Actor 1 create child actor Actor 2 dangerous operation critical state supervise Distinguish scratch and critical state
  • 14. Supervision class GuardianActor extends Actor { def supervisorStrategy = OneForOneStrategy({ case _:CompanyBankruptException => Stop case _:InvalidStateException => Restart case _:ServiceUnavailableException => Resume case _ => Escalate }, maxNrOfRetries = 3, 5.seconds) def receive = { ... } } Actor may implement preRestart & postRestart
  • 15. Remote actors Dispatchers for scale-up, remote actors for scala-out Machine A Machine B actor2 ! SomeMsg Actor 1 Actor 2 Netty, Protobuf Router Actor 3 Actor creation Supervision Remote deploy through config (no code change)
  • 16. Remote actors Creating 10 actors on 2 nodes with a router akka  {    actor  {        deployment  {            /serviceA/aggregation  {                router  =  "round-­‐robin"                nr-­‐of-­‐instances  =  10                target  {                    nodes  =  ["akka://app@10.0.0.2:2552",  "akka://app@10.0.0.3:2552"]                }            }        }    } } Looking up a remote actor val  actor  =        context.actorFor("akka://actorSystemName@10.0.0.1:2552/user/actorName")
  • 17. Blocking Actors lift some ForkJoin restrictions Remoting possible Recursive decomposition optional Fault-tolerant Still, there are restrictions similar to ForkJoin tasks No blocking IO No explicit locking No shared memory writes
  • 18. Async IO Based on composable Futures Serve http mini akka-Spray Consume http async-http-client Persistence hammersmith
  • 19. Async IO Based on Java NIO Akka IO Immutable abstractions on top of: Channels Streams (Iteratee based) Bridges (low-level) async IO and actors
  • 20. Async IO Practical application: JMeter => 1 user, 1 thread Gatling => 1 user, 1 actor + blocking IO + async-http-client = OutOfMemory errors = or clustering necessary time drift in results
  • 21. Async IO Practical application: JMeter => 1 user, 1 thread Gatling => 1 user, 1 actor + blocking IO + async-http-client = OutOfMemory errors = or clustering necessary time drift in results
  • 22. Is that all? Finite State Machine Akka TestKit core Scheduler Event Bus modules
  • 23. Is that all? Typesafe Console Commercial subscription
  • 24. Questions? Code @ bit.ly/bejug-akka