SlideShare a Scribd company logo
1 of 28
AKKA & Scala
@ Inneractive
Intro
Gal Aviv
R&D Group Manager
What we do…
RTB Networks
Advertiser
Advertiser
Advertiser
Advertiser
Advertiser
$$$
1M/min
250ms
RIR Networks
SAPI Networks
Video Networks
RAPI Networks
Architecture
Richard Grossman
System Architect
Version 1.0
lBased on Tomcat Server
lSpring MVC as HTTP request handler
lRequests to ad networks serially w/ Apache HTTP client
lHorizontal Scaling + AWS scaling policies worked
lDB Access Read/Write for each query
RTB and Parallel HTTP World
l~ 30 HTTP requests out for 1 request in
lLatency requirements 150ms max per RTB request
lMobile advertising requires parallel HTTP
lRequires heavy resources
lMust optimize machine utilization
Concurrency Framework
lWhy a framework for concurrent software?
lConcurrent application at very high scale is difficult
lRxJava, Akka, fiber co-routine (Quasar)
lAkka + Spray is the winner
Akka Basics – The Actor Model
Akka Example
case class Greeting(who: String)
class GreetingActor extends Actor with ActorLogging {
def receive = {
case Greeting(who) ⇒ log.info("Hello " + who)
}
}
val system = ActorSystem("MySystem")
val greeter = system.actorOf(Props[GreetingActor], name = "greeter")
greeter ! Greeting("Charlie Parker") // Send Message to actor
Future with Akka
class GreetingActor extends Actor with ActorLogging {
def receive = {
case Greeting(who) ⇒ sender ! "Hello " + who
}
}
val future = greeter ? Greeting("Charlie Parker")
// Option 1: Future callback
future onComplete {
case Success(message) => //Have response here when future complete
case Failure(t) => println("An error has occured: " + t.getMessage)
}
// Option 2: Blocking code
Result = Await.result(future, 100 millis)
Akka Basics – Dispatcher
Akka Basics – Router
Akka Basics - State & Supervision
Spray Framework
lREST/HTTP integration on top of Akka
lAsynchronous
lActor-based
lLightweight
object Main extends App with SimpleRoutingApp {
implicit val system = ActorSystem("my-system")
val greeter = system.actorOf(Props[GreetingActor],
name = "greeter")
startServer(interface = "localhost", port = 8080) {
path("hello") {
get {
clientIP { ip =>
complete {
greeter ? Greeting(ip)
}
}
}
}
}
}
Inneractive Actor's Model
Development
Aviem Zur
Senior Server-Side Developer
Akka in Production
lConsultation
lMonitoring:
lTypesafe Console (EOL, now Activator)
lKamon (Actor Monitoring: Mailbox Size, Time in Mailbox, Processing Time)
lDatadog – Monitoring SaaS
Akka in Production
lSpray-servlet on top of Tomcat 7 (Servlet 3) as a precursor to Spray standalone
lBlocking code
lBenchmarking
lBack-pressure (memory issues)
lDispatchers & routers tuning
Why Scala?
lScala is:
lObject-oriented
lFunctional
lStatically typed - with type inference
lConcise - typically 3 to 4 times more than Java
lBased on JVM - full compatibility with Java
lSpray and Akka
Scala Features
lType system – val, var, type inference
lClass Definition
lObjects
lCollections & Ops
lString interpolation
lInteroperability with Java
More Scala Features
lFunctions as values - first class citizen
lLazy evaluation
lCase Classes & Pattern matching
lDIY Operators & DSLs
lOptions – No more null
lImplicit Conversion
lFutures
lTraits
Migrating to Scala
lJava/Scala hybrid codebase (No rewrite)
lMaven
lIntelliJ IDEa
lBackward incompatibility
lResources: Coursera, Google Groups, Books, Scala REPL / Worksheet
lScalatest
Scalatest Example
import collection.mutable.Stack
import org.scalatest._
class ExampleSpec extends FlatSpec with Matchers {
"A Stack" should "pop values in last-in-first-out order" in {
val stack = new Stack[Int]
stack.push(1)
stack.push(2)
stack.pop() should be (2)
stack.pop() should be (1)
}
it should "throw NoSuchElementException if an empty stack is popped" in {
val emptyStack = new Stack[Int]
a [NoSuchElementException] should be thrownBy {
emptyStack.pop()
}
}
}
Migrating to Akka
lActor model vs. stack
lChain of Responsibility / Actors hybrid (Again, no rewrite)
lRough breakdown of existing code into actors
lRefactor blocking code
lSpring bridge
Resources
lCoursera
lFunctional Programming Principles in Scala
lPrinciples of Reactive Programming
lGoogle Groups
lScala Google Group
lAkka Google Group
lSpray Google Group
lBooks
lScala for the
Impatient
lAkka Essentials
lEffective Akka
lScala REPL / Worksheet
What's Next ?
lAkka actor to micro-service
lCluster of more than 100 Machines talking each other
lAkka Streaming to manage back pressure at actor level
lMESOS clustering framework
{ Thanks}

More Related Content

What's hot

What's hot (20)

Real Time Data Processing Using AWS Lambda - DevDay Los Angeles 2017
Real Time Data Processing Using AWS Lambda - DevDay Los Angeles 2017Real Time Data Processing Using AWS Lambda - DevDay Los Angeles 2017
Real Time Data Processing Using AWS Lambda - DevDay Los Angeles 2017
 
Introduction to akka actors with java 8
Introduction to akka actors with java 8Introduction to akka actors with java 8
Introduction to akka actors with java 8
 
SouJava May 2020: Apache Camel 3 - the next generation of enterprise integration
SouJava May 2020: Apache Camel 3 - the next generation of enterprise integrationSouJava May 2020: Apache Camel 3 - the next generation of enterprise integration
SouJava May 2020: Apache Camel 3 - the next generation of enterprise integration
 
Bridging the Gap: Connecting AWS and Kafka
Bridging the Gap: Connecting AWS and KafkaBridging the Gap: Connecting AWS and Kafka
Bridging the Gap: Connecting AWS and Kafka
 
Čtvrtkon #64 - AWS Serverless - Michal Haták
Čtvrtkon #64 - AWS Serverless - Michal HatákČtvrtkon #64 - AWS Serverless - Michal Haták
Čtvrtkon #64 - AWS Serverless - Michal Haták
 
What's new with Apache Camel 3? | DevNation Tech Talk
What's new with Apache Camel 3? | DevNation Tech TalkWhat's new with Apache Camel 3? | DevNation Tech Talk
What's new with Apache Camel 3? | DevNation Tech Talk
 
The forgotten route: Making Apache Camel work for you
The forgotten route: Making Apache Camel work for youThe forgotten route: Making Apache Camel work for you
The forgotten route: Making Apache Camel work for you
 
Apache Camel v3, Camel K and Camel Quarkus
Apache Camel v3, Camel K and Camel QuarkusApache Camel v3, Camel K and Camel Quarkus
Apache Camel v3, Camel K and Camel Quarkus
 
State of integration with Apache Camel (ApacheCon 2019)
State of integration with Apache Camel (ApacheCon 2019)State of integration with Apache Camel (ApacheCon 2019)
State of integration with Apache Camel (ApacheCon 2019)
 
Red Hat Nordics 2020 - Apache Camel 3 the next generation of enterprise integ...
Red Hat Nordics 2020 - Apache Camel 3 the next generation of enterprise integ...Red Hat Nordics 2020 - Apache Camel 3 the next generation of enterprise integ...
Red Hat Nordics 2020 - Apache Camel 3 the next generation of enterprise integ...
 
Kafka and Avro with Confluent Schema Registry
Kafka and Avro with Confluent Schema RegistryKafka and Avro with Confluent Schema Registry
Kafka and Avro with Confluent Schema Registry
 
EVCache at Netflix
EVCache at NetflixEVCache at Netflix
EVCache at Netflix
 
VJUG24 - Reactive Integrations with Akka Streams
VJUG24  - Reactive Integrations with Akka StreamsVJUG24  - Reactive Integrations with Akka Streams
VJUG24 - Reactive Integrations with Akka Streams
 
アドテク×Scala @Dynalyst
アドテク×Scala @Dynalystアドテク×Scala @Dynalyst
アドテク×Scala @Dynalyst
 
Integrating microservices with apache camel on kubernetes
Integrating microservices with apache camel on kubernetesIntegrating microservices with apache camel on kubernetes
Integrating microservices with apache camel on kubernetes
 
Rust with-kafka-07-02-2019
Rust with-kafka-07-02-2019Rust with-kafka-07-02-2019
Rust with-kafka-07-02-2019
 
From Experimentation to Production - Scala & Python APIs for DL4J
From Experimentation to Production - Scala & Python APIs for DL4JFrom Experimentation to Production - Scala & Python APIs for DL4J
From Experimentation to Production - Scala & Python APIs for DL4J
 
Stacktician - CloudStack Collab Conference 2014
Stacktician - CloudStack Collab Conference 2014Stacktician - CloudStack Collab Conference 2014
Stacktician - CloudStack Collab Conference 2014
 
Kafka Tutorial: Streaming Data Architecture
Kafka Tutorial: Streaming Data ArchitectureKafka Tutorial: Streaming Data Architecture
Kafka Tutorial: Streaming Data Architecture
 
Akka Streams - From Zero to Kafka
Akka Streams - From Zero to KafkaAkka Streams - From Zero to Kafka
Akka Streams - From Zero to Kafka
 

Similar to AKKA and Scala @ Inneractive

What's New in AWS Serverless and Containers
What's New in AWS Serverless and ContainersWhat's New in AWS Serverless and Containers
What's New in AWS Serverless and Containers
Amazon Web Services
 
AKUDA Labs: Pulsar
AKUDA Labs: PulsarAKUDA Labs: Pulsar
AKUDA Labs: Pulsar
AKUDA Labs
 
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
Raymond Roestenburg
 
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
Salesforce Developers
 

Similar to AKKA and Scala @ Inneractive (20)

Developing distributed applications with Akka and Akka Cluster
Developing distributed applications with Akka and Akka ClusterDeveloping distributed applications with Akka and Akka Cluster
Developing distributed applications with Akka and Akka Cluster
 
Terracotta DSO
Terracotta DSOTerracotta DSO
Terracotta DSO
 
What's New in AWS Serverless and Containers
What's New in AWS Serverless and ContainersWhat's New in AWS Serverless and Containers
What's New in AWS Serverless and Containers
 
Spark streaming + kafka 0.10
Spark streaming + kafka 0.10Spark streaming + kafka 0.10
Spark streaming + kafka 0.10
 
Porting a Streaming Pipeline from Scala to Rust
Porting a Streaming Pipeline from Scala to RustPorting a Streaming Pipeline from Scala to Rust
Porting a Streaming Pipeline from Scala to Rust
 
[Big Data Spain] Apache Spark Streaming + Kafka 0.10: an Integration Story
[Big Data Spain] Apache Spark Streaming + Kafka 0.10:  an Integration Story[Big Data Spain] Apache Spark Streaming + Kafka 0.10:  an Integration Story
[Big Data Spain] Apache Spark Streaming + Kafka 0.10: an Integration Story
 
Build Real-Time Streaming ETL Pipelines With Akka Streams, Alpakka And Apache...
Build Real-Time Streaming ETL Pipelines With Akka Streams, Alpakka And Apache...Build Real-Time Streaming ETL Pipelines With Akka Streams, Alpakka And Apache...
Build Real-Time Streaming ETL Pipelines With Akka Streams, Alpakka And Apache...
 
.NET Architects Day - DNAD 2011
.NET Architects Day - DNAD 2011.NET Architects Day - DNAD 2011
.NET Architects Day - DNAD 2011
 
09 - Fábio Akita - Além do rails
09 - Fábio Akita - Além do rails09 - Fábio Akita - Além do rails
09 - Fábio Akita - Além do rails
 
Where is my scalable api?
Where is my scalable api?Where is my scalable api?
Where is my scalable api?
 
AKUDA Labs: Pulsar
AKUDA Labs: PulsarAKUDA Labs: Pulsar
AKUDA Labs: Pulsar
 
Building Distributed Systems in Scala
Building Distributed Systems in ScalaBuilding Distributed Systems in Scala
Building Distributed Systems in Scala
 
Applying ML on your Data in Motion with AWS and Confluent | Joseph Morais, Co...
Applying ML on your Data in Motion with AWS and Confluent | Joseph Morais, Co...Applying ML on your Data in Motion with AWS and Confluent | Joseph Morais, Co...
Applying ML on your Data in Motion with AWS and Confluent | Joseph Morais, Co...
 
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
 
Apache Kafka - Scalable Message-Processing and more !
Apache Kafka - Scalable Message-Processing and more !Apache Kafka - Scalable Message-Processing and more !
Apache Kafka - Scalable Message-Processing and more !
 
JHipster conf 2019 - Kafka Ecosystem
JHipster conf 2019 - Kafka EcosystemJHipster conf 2019 - Kafka Ecosystem
JHipster conf 2019 - Kafka Ecosystem
 
Spark streaming state of the union
Spark streaming state of the unionSpark streaming state of the union
Spark streaming state of the union
 
Actor-based concurrency in a modern Java Enterprise
Actor-based concurrency in a modern Java EnterpriseActor-based concurrency in a modern Java Enterprise
Actor-based concurrency in a modern Java Enterprise
 
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
 
BigDataSpain 2016: Stream Processing Applications with Apache Apex
BigDataSpain 2016: Stream Processing Applications with Apache ApexBigDataSpain 2016: Stream Processing Applications with Apache Apex
BigDataSpain 2016: Stream Processing Applications with Apache Apex
 

Recently uploaded

%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
masabamasaba
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 

Recently uploaded (20)

%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the Situation
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 

AKKA and Scala @ Inneractive

  • 1. AKKA & Scala @ Inneractive
  • 3. What we do… RTB Networks Advertiser Advertiser Advertiser Advertiser Advertiser $$$ 1M/min 250ms RIR Networks SAPI Networks Video Networks RAPI Networks
  • 5. Version 1.0 lBased on Tomcat Server lSpring MVC as HTTP request handler lRequests to ad networks serially w/ Apache HTTP client lHorizontal Scaling + AWS scaling policies worked lDB Access Read/Write for each query
  • 6. RTB and Parallel HTTP World l~ 30 HTTP requests out for 1 request in lLatency requirements 150ms max per RTB request lMobile advertising requires parallel HTTP lRequires heavy resources lMust optimize machine utilization
  • 7. Concurrency Framework lWhy a framework for concurrent software? lConcurrent application at very high scale is difficult lRxJava, Akka, fiber co-routine (Quasar) lAkka + Spray is the winner
  • 8. Akka Basics – The Actor Model
  • 9. Akka Example case class Greeting(who: String) class GreetingActor extends Actor with ActorLogging { def receive = { case Greeting(who) ⇒ log.info("Hello " + who) } } val system = ActorSystem("MySystem") val greeter = system.actorOf(Props[GreetingActor], name = "greeter") greeter ! Greeting("Charlie Parker") // Send Message to actor
  • 10. Future with Akka class GreetingActor extends Actor with ActorLogging { def receive = { case Greeting(who) ⇒ sender ! "Hello " + who } } val future = greeter ? Greeting("Charlie Parker") // Option 1: Future callback future onComplete { case Success(message) => //Have response here when future complete case Failure(t) => println("An error has occured: " + t.getMessage) } // Option 2: Blocking code Result = Await.result(future, 100 millis)
  • 11. Akka Basics – Dispatcher
  • 12. Akka Basics – Router
  • 13. Akka Basics - State & Supervision
  • 14. Spray Framework lREST/HTTP integration on top of Akka lAsynchronous lActor-based lLightweight object Main extends App with SimpleRoutingApp { implicit val system = ActorSystem("my-system") val greeter = system.actorOf(Props[GreetingActor], name = "greeter") startServer(interface = "localhost", port = 8080) { path("hello") { get { clientIP { ip => complete { greeter ? Greeting(ip) } } } } } }
  • 17. Akka in Production lConsultation lMonitoring: lTypesafe Console (EOL, now Activator) lKamon (Actor Monitoring: Mailbox Size, Time in Mailbox, Processing Time) lDatadog – Monitoring SaaS
  • 18.
  • 19. Akka in Production lSpray-servlet on top of Tomcat 7 (Servlet 3) as a precursor to Spray standalone lBlocking code lBenchmarking lBack-pressure (memory issues) lDispatchers & routers tuning
  • 20. Why Scala? lScala is: lObject-oriented lFunctional lStatically typed - with type inference lConcise - typically 3 to 4 times more than Java lBased on JVM - full compatibility with Java lSpray and Akka
  • 21. Scala Features lType system – val, var, type inference lClass Definition lObjects lCollections & Ops lString interpolation lInteroperability with Java
  • 22. More Scala Features lFunctions as values - first class citizen lLazy evaluation lCase Classes & Pattern matching lDIY Operators & DSLs lOptions – No more null lImplicit Conversion lFutures lTraits
  • 23. Migrating to Scala lJava/Scala hybrid codebase (No rewrite) lMaven lIntelliJ IDEa lBackward incompatibility lResources: Coursera, Google Groups, Books, Scala REPL / Worksheet lScalatest
  • 24. Scalatest Example import collection.mutable.Stack import org.scalatest._ class ExampleSpec extends FlatSpec with Matchers { "A Stack" should "pop values in last-in-first-out order" in { val stack = new Stack[Int] stack.push(1) stack.push(2) stack.pop() should be (2) stack.pop() should be (1) } it should "throw NoSuchElementException if an empty stack is popped" in { val emptyStack = new Stack[Int] a [NoSuchElementException] should be thrownBy { emptyStack.pop() } } }
  • 25. Migrating to Akka lActor model vs. stack lChain of Responsibility / Actors hybrid (Again, no rewrite) lRough breakdown of existing code into actors lRefactor blocking code lSpring bridge
  • 26. Resources lCoursera lFunctional Programming Principles in Scala lPrinciples of Reactive Programming lGoogle Groups lScala Google Group lAkka Google Group lSpray Google Group lBooks lScala for the Impatient lAkka Essentials lEffective Akka lScala REPL / Worksheet
  • 27. What's Next ? lAkka actor to micro-service lCluster of more than 100 Machines talking each other lAkka Streaming to manage back pressure at actor level lMESOS clustering framework