Reactive programming with Scala, Lagom, Spark, Akka and Play
TCE introduction (scalability with Scala and Akka)
-
Upload
andrew-skiba -
Category
Technology
-
view
459 -
download
3
description
Transcript of TCE introduction (scalability with Scala and Akka)
Scala-bility
martes 10 de septiembre de 13
Puzzle: what is on the Y axis???
martes 10 de septiembre de 13
OMG, these MHzes don’t grow
anymore :(martes 10 de septiembre de 13
But imagine a beowulf cluster of
these!!!martes 10 de septiembre de 13
Is it possible to handle multiple tasks and not suffer?!
martes 10 de septiembre de 13
DEMO
martes 10 de septiembre de 13
We do it for ages!UNIX pipes connect parallel processes
easily:* Deterministic* Composable
martes 10 de septiembre de 13
Why is it so easy to be parallel with *nix CLI?
Designed to be parallel from the ground up
Designed to be functional from the ground up
Autonomic composable units of execution
martes 10 de septiembre de 13
Pipe example in Java
martes 10 de septiembre de 13
Are we there yet?Reliability?
Availability?Diagnostics?Distribution?
martes 10 de septiembre de 13
Doing it in Java built-inssynchronize, volatile
Collections.synchronized*
java.util.concurrent
java.nio
fork/join
martes 10 de septiembre de 13
High-level tools for Java async
Camel
Spring Integration
GridGain
Akka
martes 10 de septiembre de 13
Today we cover only two
Akka: you can stay in Java and scale vertically/horizontally - transparently
Scala: being functional allows to be parallel - easily
martes 10 de septiembre de 13
Scala: being functional
High order functions
Immutable data
Referential transparency
Lazy evaluation
Recursion (RecursiveAction, anyone?)
martes 10 de septiembre de 13
Scala: if you’re functional, you can be
parallel
import Math._
val r = 0 until 10000000 def f(x: Int) = log10 (pow(3,x *sin(x))) val m = r. map ( f )
r. forall ( i=> f(i)==m(i) ) //10seconds r. par. forall ( i=> f(i)==m(i) ) //5seconds
martes 10 de septiembre de 13
Same JVM, different languagesYou don’t have to choose. You can mix
them in the same project.
martes 10 de septiembre de 13
Right guys to follow ...Martin Odersky
Rod JohnsonJonas Bonér
martes 10 de septiembre de 13
... they already use it in
production
martes 10 de septiembre de 13
Links
http://www.slideshare.net/djspiewak/high-wizardry-in-the-land-of-scala
http://www.forbes.com/sites/quentinhardy/2011/05/12/names-you-need-to-know-scala-and-typeface/
http://www.slinnbooks.com/books/futures/
http://mandubian.com/2012/08/27/understanding-play2-iteratees-for-normal-humans/
martes 10 de septiembre de 13