SlideShare uma empresa Scribd logo
1 de 42
Baixar para ler offline
Akka 2.0: towards new heights
                        @remeniuk




                                    emilypolar@flickr
Location Transparency
You’re doing your regular coding job for a local
environment, and get ability to run your system in a
distributed environment any time for free.
RMI, EJB, CORBA, SOAP,
XML-RPC, Thrift
RMI, EJB, CORBA, SOAP,
XML-RPC, Thrift

are easy, but ultimately
flawed!

Fail under network
partitioning and partial
failure...
RMI, EJB, CORBA, SOAP,
XML-RPC

are easy, but ultimately
flawed!
 It’s time for RPC to retire.
Fail under network
partitioning and partial   Steve Vinovsky
failure...
RMI, EJB, CORBA, SOAP,     Akka*
XML-RPC
                           Simple toolkit for building
are easy, but ultimately   distributed, scalable,
flawed!                    fault-tolerant systems

Fail under network         • actors / transactors
partitioning and partial   • supervisors
failure...                 • routing and dispatching
                           • STM for better shared
                             stated concurrency
                           • much more…
class HelloWorldActor extends Actor {
   def receive = {
       case msg => self reply (msg + " World")
   }
}

                                      LocalActorRef


val myActor = actorOf[HelloWorldActor].start()


val result = myActor !! “message”
Dispatcher stuffs actor[-s] with messages


class ActorA extends Actor {
  self.dispatcher = someDispatcher
  ...
}

class ActorB extends Actor {
  self.dispatcher = someDispatcher
  ...
}
Actor Registry knows about all the local
actors
registry.actorFor(id)
registry.actorFor(uuid)
registry.actorsFor(classOf[...])
etc.
making actor accessible remotely
remote.start("localhost", 9999).register(
     "hello-service", actorOf[HelloWorldActor])



                                 RemoteActorRef


val actor = remote.actorFor(
      "hello-service", "localhost", 9999)

val result = actor !! "Hello"
Moreover, there could be a pool of
actors behind the ActorRef
class MyLoadBalancer extends Actor with LoadBalancer {

    val pinger = actorOf(new Actor {
           def receive = { case x => println("Pinger: " + x) } }).start()

    val ponger = actorOf(new Actor {
          def receive = { case x => println("Ponger: " + x) } }).start()

    val seq = new CyclicIterator[ActorRef](List(pinger,ponger))

}
Fault tolerance
Groups of linked, supervised actors define subsystems:
those actors crash and restart together
Fault tolerance
Groups of linked, supervised actors define subsystems:
those actors crash and restart together
Fault tolerance
Groups of linked, supervised actors define subsystems:
those actors crash and restart together
Fault tolerance
Groups of linked, supervised actors define subsystems:
those actors crash and restart together
Fault tolerance
Groups of linked, supervised actors define subsystems:
those actors crash and restart together
Fault tolerance
Groups of linked, supervised actors define subsystems:
those actors crash and restart together
Fault tolerance
Groups of linked, supervised actors define subsystems:
those actors crash and restart together
Fault tolerance
Groups of linked, supervised actors define subsystems:
those actors crash and restart together
val supervisor = Supervisor(
 SupervisorConfig(
  AllForOneStrategy(List(classOf[Exception]), 3, 1000),
  Supervise(actorOf[MyActor1], Permanent) ::
  Supervise(actorOf[MyActor2], Permanent) ::
Nil))


actor1.link(actor2)
supervisor.link(actor2)
Akka 2.0
In Akka 2.0 there’re no
                  local vs.
remote actors anymore. All the
actors are distributed (clustered, routed)
the new level of transparency
brand new akka-cluster

in Soviet Russia by default, all the actors are local



but when you pass a config
cluster magic starts to happen
cluster magic
•   actors migration
•   actors replication
•   cluster-wide routing
•   adaptive load balancing
•   distributed actor registry
•   leader election
•   much more…
New important concepts:

• actor address
• deployment config
[behind the scenes]
                          actor clustering
get deployment config


is scope
                                            LocalActorRef
local?


                     Distributed Registry   add to local actor registry

                    store serilized actor
                    factory in ZooKeeper
                                                 create               create actor on
                                                  actor                    node


                                                ClusteredActorRef / RoutedActorRef
       ZooKeeper is used for storing
       cluster configs, serialized actor
       factories, metrics, etc.
Using clustered actor
akka.enabled-modules = ["cluster"]
akka.event-handler-level = "WARNING"
akka.actor.deployment.service-hello.router = "round-robin"
akka.actor.deployment.service-hello.clustered.replication-factor = 2
akka.actor.deployment.service-hello.clustered.preferred-nodes =
["node:node1","node:node3"]




node.start()
helloActor = actorOf[HelloWorld]("service-hello“)
[Akka 1.x] PROBLEM: synchronization of
registries in a distributed network?




POSSIBLE SOLUTION: https://github.com/remeniuk/akka-easyscale
Distributed Registry


Node A

node.store(“my-actor", classOf[MyActor], serializerFor(classOf[MyActor]))




Node B

node.use(“my-actor")
Actor Props

actorOf(Props[TestActor]
      .withDispatcher(new PinnedDispatcher())
      .withFaultHandler(
      OneForOneStrategy(List(classOf[Exception]), 5, 1000))



actorOf(Props(self ⇒ {
      case “hello" ⇒ self tryReply “hello!"
})
Composable Futures




              !!
                     *HINT: (actor ? message).get
Composable Futures


val future1 = for {
       a <- (actor ? message1).mapTo[String]
       b <- (actor ? message2).mapTo[String]
} yield a + b

val future2 = (actor ? Message3).map(_.toString)

val future3 = Futures.find[String](_.isEmpty)(
                                       Seq(future1, future2))
BONUS: multi-jvm testing with
scalatest in specs2

 https://github.com/typesafehub/sbt-multi-jvm

 https://github.com/jboner/akka/tree/master/akk
 a-cluster/src/multi-jvm

 https://github.com/remeniuk/sbt-multi-jvm
GO AND TRY IT!

> git clone https://github.com/jboner/akka
> sbt

Mais conteúdo relacionado

Mais procurados

Scala ActiveRecord
Scala ActiveRecordScala ActiveRecord
Scala ActiveRecordscalaconfjp
 
Django Celery - A distributed task queue
Django Celery - A distributed task queueDjango Celery - A distributed task queue
Django Celery - A distributed task queueAlex Eftimie
 
Java Libraries You Can’t Afford to Miss
Java Libraries You Can’t Afford to Miss Java Libraries You Can’t Afford to Miss
Java Libraries You Can’t Afford to Miss Andres Almiray
 
Java Libraries You Can’t Afford to Miss
Java Libraries You Can’t Afford to MissJava Libraries You Can’t Afford to Miss
Java Libraries You Can’t Afford to MissAndres Almiray
 
Java libraries you can't afford to miss
Java libraries you can't afford to missJava libraries you can't afford to miss
Java libraries you can't afford to missAndres Almiray
 
Small wins in a small time with Apache Solr
Small wins in a small time with Apache SolrSmall wins in a small time with Apache Solr
Small wins in a small time with Apache SolrSourcesense
 
Isolated development in python
Isolated development in pythonIsolated development in python
Isolated development in pythonAndrés J. Díaz
 
Custom deployments with sbt-native-packager
Custom deployments with sbt-native-packagerCustom deployments with sbt-native-packager
Custom deployments with sbt-native-packagerGaryCoady
 
Reactive Web-Applications @ LambdaDays
Reactive Web-Applications @ LambdaDaysReactive Web-Applications @ LambdaDays
Reactive Web-Applications @ LambdaDaysManuel Bernhardt
 
Catalina.2013 03-05
Catalina.2013 03-05Catalina.2013 03-05
Catalina.2013 03-05NX21
 
MySQL in Go - Golang NE July 2015
MySQL in Go - Golang NE July 2015MySQL in Go - Golang NE July 2015
MySQL in Go - Golang NE July 2015Mark Hemmings
 
Making the Most of Your Gradle Build
Making the Most of Your Gradle BuildMaking the Most of Your Gradle Build
Making the Most of Your Gradle BuildAndres Almiray
 
Alfrescotomcat stderr.2013-03-05
Alfrescotomcat stderr.2013-03-05Alfrescotomcat stderr.2013-03-05
Alfrescotomcat stderr.2013-03-05NX21
 
Avoiding callback hell in Node js using promises
Avoiding callback hell in Node js using promisesAvoiding callback hell in Node js using promises
Avoiding callback hell in Node js using promisesAnkit Agarwal
 
Innovation and Security in Ruby on Rails
Innovation and Security in Ruby on RailsInnovation and Security in Ruby on Rails
Innovation and Security in Ruby on Railstielefeld
 

Mais procurados (20)

Scala ActiveRecord
Scala ActiveRecordScala ActiveRecord
Scala ActiveRecord
 
Django Celery - A distributed task queue
Django Celery - A distributed task queueDjango Celery - A distributed task queue
Django Celery - A distributed task queue
 
Java Libraries You Can’t Afford to Miss
Java Libraries You Can’t Afford to Miss Java Libraries You Can’t Afford to Miss
Java Libraries You Can’t Afford to Miss
 
Sailing with Java 8 Streams
Sailing with Java 8 StreamsSailing with Java 8 Streams
Sailing with Java 8 Streams
 
Java Libraries You Can’t Afford to Miss
Java Libraries You Can’t Afford to MissJava Libraries You Can’t Afford to Miss
Java Libraries You Can’t Afford to Miss
 
Java libraries you can't afford to miss
Java libraries you can't afford to missJava libraries you can't afford to miss
Java libraries you can't afford to miss
 
Small wins in a small time with Apache Solr
Small wins in a small time with Apache SolrSmall wins in a small time with Apache Solr
Small wins in a small time with Apache Solr
 
Jasmine BDD for Javascript
Jasmine BDD for JavascriptJasmine BDD for Javascript
Jasmine BDD for Javascript
 
Play vs Rails
Play vs RailsPlay vs Rails
Play vs Rails
 
Spock
SpockSpock
Spock
 
Isolated development in python
Isolated development in pythonIsolated development in python
Isolated development in python
 
Custom deployments with sbt-native-packager
Custom deployments with sbt-native-packagerCustom deployments with sbt-native-packager
Custom deployments with sbt-native-packager
 
AssertJ quick introduction
AssertJ quick introductionAssertJ quick introduction
AssertJ quick introduction
 
Reactive Web-Applications @ LambdaDays
Reactive Web-Applications @ LambdaDaysReactive Web-Applications @ LambdaDays
Reactive Web-Applications @ LambdaDays
 
Catalina.2013 03-05
Catalina.2013 03-05Catalina.2013 03-05
Catalina.2013 03-05
 
MySQL in Go - Golang NE July 2015
MySQL in Go - Golang NE July 2015MySQL in Go - Golang NE July 2015
MySQL in Go - Golang NE July 2015
 
Making the Most of Your Gradle Build
Making the Most of Your Gradle BuildMaking the Most of Your Gradle Build
Making the Most of Your Gradle Build
 
Alfrescotomcat stderr.2013-03-05
Alfrescotomcat stderr.2013-03-05Alfrescotomcat stderr.2013-03-05
Alfrescotomcat stderr.2013-03-05
 
Avoiding callback hell in Node js using promises
Avoiding callback hell in Node js using promisesAvoiding callback hell in Node js using promises
Avoiding callback hell in Node js using promises
 
Innovation and Security in Ruby on Rails
Innovation and Security in Ruby on RailsInnovation and Security in Ruby on Rails
Innovation and Security in Ruby on Rails
 

Semelhante a First glance at Akka 2.0

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.
 
Akka: Distributed by Design
Akka: Distributed by DesignAkka: Distributed by Design
Akka: Distributed by Designpatriknw
 
Akka Actors: an Introduction
Akka Actors: an IntroductionAkka Actors: an Introduction
Akka Actors: an IntroductionRoberto Casadei
 
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
 
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
 
Testing akka-actors
Testing akka-actorsTesting akka-actors
Testing akka-actorsKnoldus Inc.
 
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
 
Akka london scala_user_group
Akka london scala_user_groupAkka london scala_user_group
Akka london scala_user_groupSkills Matter
 
Buiilding reactive distributed systems with Akka
Buiilding reactive distributed systems with AkkaBuiilding reactive distributed systems with Akka
Buiilding reactive distributed systems with AkkaJohan Andrén
 
Akka Cluster in Java - JCConf 2015
Akka Cluster in Java - JCConf 2015Akka Cluster in Java - JCConf 2015
Akka Cluster in Java - JCConf 2015Jiayun Zhou
 
Build Cloud Applications with Akka and Heroku
Build Cloud Applications with Akka and HerokuBuild Cloud Applications with Akka and Heroku
Build Cloud Applications with Akka and HerokuSalesforce Developers
 
Clojure - A new Lisp
Clojure - A new LispClojure - A new Lisp
Clojure - A new Lispelliando dias
 
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
 
GR8Conf 2011: GPars
GR8Conf 2011: GParsGR8Conf 2011: GPars
GR8Conf 2011: GParsGR8Conf
 
Introduction to Akka - Atlanta Java Users Group
Introduction to Akka - Atlanta Java Users GroupIntroduction to Akka - Atlanta Java Users Group
Introduction to Akka - Atlanta Java Users GroupRoy Russo
 
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
 
Scalaz 8 vs Akka Actors
Scalaz 8 vs Akka ActorsScalaz 8 vs Akka Actors
Scalaz 8 vs Akka ActorsJohn De Goes
 
JavaScript Growing Up
JavaScript Growing UpJavaScript Growing Up
JavaScript Growing UpDavid Padbury
 

Semelhante a First glance at Akka 2.0 (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
 
Akka: Distributed by Design
Akka: Distributed by DesignAkka: Distributed by Design
Akka: Distributed by Design
 
Akka Actors: an Introduction
Akka Actors: an IntroductionAkka Actors: an Introduction
Akka Actors: an Introduction
 
Akka (BeJUG)
Akka (BeJUG)Akka (BeJUG)
Akka (BeJUG)
 
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
 
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]
 
Testing akka-actors
Testing akka-actorsTesting akka-actors
Testing akka-actors
 
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
 
Akka london scala_user_group
Akka london scala_user_groupAkka london scala_user_group
Akka london scala_user_group
 
Buiilding reactive distributed systems with Akka
Buiilding reactive distributed systems with AkkaBuiilding reactive distributed systems with Akka
Buiilding reactive distributed systems with Akka
 
Akka Cluster in Java - JCConf 2015
Akka Cluster in Java - JCConf 2015Akka Cluster in Java - JCConf 2015
Akka Cluster in Java - JCConf 2015
 
Build Cloud Applications with Akka and Heroku
Build Cloud Applications with Akka and HerokuBuild Cloud Applications with Akka and Heroku
Build Cloud Applications with Akka and Heroku
 
Clojure - A new Lisp
Clojure - A new LispClojure - A new Lisp
Clojure - A new Lisp
 
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
 
GR8Conf 2011: GPars
GR8Conf 2011: GParsGR8Conf 2011: GPars
GR8Conf 2011: GPars
 
Introduction to Akka - Atlanta Java Users Group
Introduction to Akka - Atlanta Java Users GroupIntroduction to Akka - Atlanta Java Users Group
Introduction to Akka - Atlanta Java Users Group
 
Introduction to Actor Model and Akka
Introduction to Actor Model and AkkaIntroduction to Actor Model and Akka
Introduction to Actor Model and Akka
 
Scalaz 8 vs Akka Actors
Scalaz 8 vs Akka ActorsScalaz 8 vs Akka Actors
Scalaz 8 vs Akka Actors
 
JavaScript Growing Up
JavaScript Growing UpJavaScript Growing Up
JavaScript Growing Up
 

Mais de Vasil Remeniuk

Product Minsk - РТБ и Программатик
Product Minsk - РТБ и ПрограмматикProduct Minsk - РТБ и Программатик
Product Minsk - РТБ и ПрограмматикVasil Remeniuk
 
Работа с Akka Сluster, @afiskon, scalaby#14
Работа с Akka Сluster, @afiskon, scalaby#14Работа с Akka Сluster, @afiskon, scalaby#14
Работа с Akka Сluster, @afiskon, scalaby#14Vasil Remeniuk
 
Cake pattern. Presentation by Alex Famin at scalaby#14
Cake pattern. Presentation by Alex Famin at scalaby#14Cake pattern. Presentation by Alex Famin at scalaby#14
Cake pattern. Presentation by Alex Famin at scalaby#14Vasil Remeniuk
 
Scala laboratory: Globus. iteration #3
Scala laboratory: Globus. iteration #3Scala laboratory: Globus. iteration #3
Scala laboratory: Globus. iteration #3Vasil Remeniuk
 
Testing in Scala by Adform research
Testing in Scala by Adform researchTesting in Scala by Adform research
Testing in Scala by Adform researchVasil Remeniuk
 
Spark Intro by Adform Research
Spark Intro by Adform ResearchSpark Intro by Adform Research
Spark Intro by Adform ResearchVasil Remeniuk
 
Types by Adform Research, Saulius Valatka
Types by Adform Research, Saulius ValatkaTypes by Adform Research, Saulius Valatka
Types by Adform Research, Saulius ValatkaVasil Remeniuk
 
Types by Adform Research
Types by Adform ResearchTypes by Adform Research
Types by Adform ResearchVasil Remeniuk
 
Scalding by Adform Research, Alex Gryzlov
Scalding by Adform Research, Alex GryzlovScalding by Adform Research, Alex Gryzlov
Scalding by Adform Research, Alex GryzlovVasil Remeniuk
 
Scalding by Adform Research, Alex Gryzlov
Scalding by Adform Research, Alex GryzlovScalding by Adform Research, Alex Gryzlov
Scalding by Adform Research, Alex GryzlovVasil Remeniuk
 
Spark by Adform Research, Paulius
Spark by Adform Research, PauliusSpark by Adform Research, Paulius
Spark by Adform Research, PauliusVasil Remeniuk
 
Scala Style by Adform Research (Saulius Valatka)
Scala Style by Adform Research (Saulius Valatka)Scala Style by Adform Research (Saulius Valatka)
Scala Style by Adform Research (Saulius Valatka)Vasil Remeniuk
 
Spark intro by Adform Research
Spark intro by Adform ResearchSpark intro by Adform Research
Spark intro by Adform ResearchVasil Remeniuk
 
SBT by Aform Research, Saulius Valatka
SBT by Aform Research, Saulius ValatkaSBT by Aform Research, Saulius Valatka
SBT by Aform Research, Saulius ValatkaVasil Remeniuk
 
Scala laboratory: Globus. iteration #2
Scala laboratory: Globus. iteration #2Scala laboratory: Globus. iteration #2
Scala laboratory: Globus. iteration #2Vasil Remeniuk
 
Testing in Scala. Adform Research
Testing in Scala. Adform ResearchTesting in Scala. Adform Research
Testing in Scala. Adform ResearchVasil Remeniuk
 
Scala laboratory. Globus. iteration #1
Scala laboratory. Globus. iteration #1Scala laboratory. Globus. iteration #1
Scala laboratory. Globus. iteration #1Vasil Remeniuk
 
Cassandra + Spark + Elk
Cassandra + Spark + ElkCassandra + Spark + Elk
Cassandra + Spark + ElkVasil Remeniuk
 
Опыт использования Spark, Основано на реальных событиях
Опыт использования Spark, Основано на реальных событияхОпыт использования Spark, Основано на реальных событиях
Опыт использования Spark, Основано на реальных событияхVasil Remeniuk
 

Mais de Vasil Remeniuk (20)

Product Minsk - РТБ и Программатик
Product Minsk - РТБ и ПрограмматикProduct Minsk - РТБ и Программатик
Product Minsk - РТБ и Программатик
 
Работа с Akka Сluster, @afiskon, scalaby#14
Работа с Akka Сluster, @afiskon, scalaby#14Работа с Akka Сluster, @afiskon, scalaby#14
Работа с Akka Сluster, @afiskon, scalaby#14
 
Cake pattern. Presentation by Alex Famin at scalaby#14
Cake pattern. Presentation by Alex Famin at scalaby#14Cake pattern. Presentation by Alex Famin at scalaby#14
Cake pattern. Presentation by Alex Famin at scalaby#14
 
Scala laboratory: Globus. iteration #3
Scala laboratory: Globus. iteration #3Scala laboratory: Globus. iteration #3
Scala laboratory: Globus. iteration #3
 
Testing in Scala by Adform research
Testing in Scala by Adform researchTesting in Scala by Adform research
Testing in Scala by Adform research
 
Spark Intro by Adform Research
Spark Intro by Adform ResearchSpark Intro by Adform Research
Spark Intro by Adform Research
 
Types by Adform Research, Saulius Valatka
Types by Adform Research, Saulius ValatkaTypes by Adform Research, Saulius Valatka
Types by Adform Research, Saulius Valatka
 
Types by Adform Research
Types by Adform ResearchTypes by Adform Research
Types by Adform Research
 
Scalding by Adform Research, Alex Gryzlov
Scalding by Adform Research, Alex GryzlovScalding by Adform Research, Alex Gryzlov
Scalding by Adform Research, Alex Gryzlov
 
Scalding by Adform Research, Alex Gryzlov
Scalding by Adform Research, Alex GryzlovScalding by Adform Research, Alex Gryzlov
Scalding by Adform Research, Alex Gryzlov
 
Spark by Adform Research, Paulius
Spark by Adform Research, PauliusSpark by Adform Research, Paulius
Spark by Adform Research, Paulius
 
Scala Style by Adform Research (Saulius Valatka)
Scala Style by Adform Research (Saulius Valatka)Scala Style by Adform Research (Saulius Valatka)
Scala Style by Adform Research (Saulius Valatka)
 
Spark intro by Adform Research
Spark intro by Adform ResearchSpark intro by Adform Research
Spark intro by Adform Research
 
SBT by Aform Research, Saulius Valatka
SBT by Aform Research, Saulius ValatkaSBT by Aform Research, Saulius Valatka
SBT by Aform Research, Saulius Valatka
 
Scala laboratory: Globus. iteration #2
Scala laboratory: Globus. iteration #2Scala laboratory: Globus. iteration #2
Scala laboratory: Globus. iteration #2
 
Testing in Scala. Adform Research
Testing in Scala. Adform ResearchTesting in Scala. Adform Research
Testing in Scala. Adform Research
 
Scala laboratory. Globus. iteration #1
Scala laboratory. Globus. iteration #1Scala laboratory. Globus. iteration #1
Scala laboratory. Globus. iteration #1
 
Cassandra + Spark + Elk
Cassandra + Spark + ElkCassandra + Spark + Elk
Cassandra + Spark + Elk
 
Опыт использования Spark, Основано на реальных событиях
Опыт использования Spark, Основано на реальных событияхОпыт использования Spark, Основано на реальных событиях
Опыт использования Spark, Основано на реальных событиях
 
ETL со Spark
ETL со SparkETL со Spark
ETL со Spark
 

Último

Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 

Último (20)

Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 

First glance at Akka 2.0

  • 1. Akka 2.0: towards new heights @remeniuk emilypolar@flickr
  • 3. You’re doing your regular coding job for a local environment, and get ability to run your system in a distributed environment any time for free.
  • 4. RMI, EJB, CORBA, SOAP, XML-RPC, Thrift
  • 5. RMI, EJB, CORBA, SOAP, XML-RPC, Thrift are easy, but ultimately flawed! Fail under network partitioning and partial failure...
  • 6. RMI, EJB, CORBA, SOAP, XML-RPC are easy, but ultimately flawed! It’s time for RPC to retire. Fail under network partitioning and partial Steve Vinovsky failure...
  • 7. RMI, EJB, CORBA, SOAP, Akka* XML-RPC Simple toolkit for building are easy, but ultimately distributed, scalable, flawed! fault-tolerant systems Fail under network • actors / transactors partitioning and partial • supervisors failure... • routing and dispatching • STM for better shared stated concurrency • much more…
  • 8. class HelloWorldActor extends Actor { def receive = { case msg => self reply (msg + " World") } } LocalActorRef val myActor = actorOf[HelloWorldActor].start() val result = myActor !! “message”
  • 9. Dispatcher stuffs actor[-s] with messages class ActorA extends Actor { self.dispatcher = someDispatcher ... } class ActorB extends Actor { self.dispatcher = someDispatcher ... }
  • 10. Actor Registry knows about all the local actors
  • 13. remote.start("localhost", 9999).register( "hello-service", actorOf[HelloWorldActor]) RemoteActorRef val actor = remote.actorFor( "hello-service", "localhost", 9999) val result = actor !! "Hello"
  • 14. Moreover, there could be a pool of actors behind the ActorRef class MyLoadBalancer extends Actor with LoadBalancer { val pinger = actorOf(new Actor { def receive = { case x => println("Pinger: " + x) } }).start() val ponger = actorOf(new Actor { def receive = { case x => println("Ponger: " + x) } }).start() val seq = new CyclicIterator[ActorRef](List(pinger,ponger)) }
  • 15. Fault tolerance Groups of linked, supervised actors define subsystems: those actors crash and restart together
  • 16. Fault tolerance Groups of linked, supervised actors define subsystems: those actors crash and restart together
  • 17. Fault tolerance Groups of linked, supervised actors define subsystems: those actors crash and restart together
  • 18. Fault tolerance Groups of linked, supervised actors define subsystems: those actors crash and restart together
  • 19. Fault tolerance Groups of linked, supervised actors define subsystems: those actors crash and restart together
  • 20. Fault tolerance Groups of linked, supervised actors define subsystems: those actors crash and restart together
  • 21. Fault tolerance Groups of linked, supervised actors define subsystems: those actors crash and restart together
  • 22. Fault tolerance Groups of linked, supervised actors define subsystems: those actors crash and restart together
  • 23. val supervisor = Supervisor( SupervisorConfig( AllForOneStrategy(List(classOf[Exception]), 3, 1000), Supervise(actorOf[MyActor1], Permanent) :: Supervise(actorOf[MyActor2], Permanent) :: Nil)) actor1.link(actor2) supervisor.link(actor2)
  • 25. In Akka 2.0 there’re no local vs. remote actors anymore. All the actors are distributed (clustered, routed)
  • 26. the new level of transparency
  • 27. brand new akka-cluster in Soviet Russia by default, all the actors are local but when you pass a config cluster magic starts to happen
  • 28. cluster magic • actors migration • actors replication • cluster-wide routing • adaptive load balancing • distributed actor registry • leader election • much more…
  • 29. New important concepts: • actor address • deployment config
  • 30. [behind the scenes] actor clustering get deployment config is scope LocalActorRef local? Distributed Registry add to local actor registry store serilized actor factory in ZooKeeper create create actor on actor node ClusteredActorRef / RoutedActorRef ZooKeeper is used for storing cluster configs, serialized actor factories, metrics, etc.
  • 31. Using clustered actor akka.enabled-modules = ["cluster"] akka.event-handler-level = "WARNING" akka.actor.deployment.service-hello.router = "round-robin" akka.actor.deployment.service-hello.clustered.replication-factor = 2 akka.actor.deployment.service-hello.clustered.preferred-nodes = ["node:node1","node:node3"] node.start() helloActor = actorOf[HelloWorld]("service-hello“)
  • 32.
  • 33.
  • 34.
  • 35.
  • 36. [Akka 1.x] PROBLEM: synchronization of registries in a distributed network? POSSIBLE SOLUTION: https://github.com/remeniuk/akka-easyscale
  • 37. Distributed Registry Node A node.store(“my-actor", classOf[MyActor], serializerFor(classOf[MyActor])) Node B node.use(“my-actor")
  • 38. Actor Props actorOf(Props[TestActor] .withDispatcher(new PinnedDispatcher()) .withFaultHandler( OneForOneStrategy(List(classOf[Exception]), 5, 1000)) actorOf(Props(self ⇒ { case “hello" ⇒ self tryReply “hello!" })
  • 39. Composable Futures !! *HINT: (actor ? message).get
  • 40. Composable Futures val future1 = for { a <- (actor ? message1).mapTo[String] b <- (actor ? message2).mapTo[String] } yield a + b val future2 = (actor ? Message3).map(_.toString) val future3 = Futures.find[String](_.isEmpty)( Seq(future1, future2))
  • 41. BONUS: multi-jvm testing with scalatest in specs2 https://github.com/typesafehub/sbt-multi-jvm https://github.com/jboner/akka/tree/master/akk a-cluster/src/multi-jvm https://github.com/remeniuk/sbt-multi-jvm
  • 42. GO AND TRY IT! > git clone https://github.com/jboner/akka > sbt