TCE introduction (scalability with Scala and Akka)

19
Scala-bility martes 10 de septiembre de 13

description

The intro talk for Tikal Community Event on September 2013. Intended to be a warm-up for the next lectures on Akka and Scala for creating applications which utilize modern multicore systems.

Transcript of TCE introduction (scalability with Scala and Akka)

Page 1: TCE introduction (scalability with Scala and Akka)

Scala-bility

martes 10 de septiembre de 13

Page 2: TCE introduction (scalability with Scala and Akka)

Puzzle: what is on the Y axis???

martes 10 de septiembre de 13

Page 3: TCE introduction (scalability with Scala and Akka)

OMG, these MHzes don’t grow

anymore :(martes 10 de septiembre de 13

Page 4: TCE introduction (scalability with Scala and Akka)

But imagine a beowulf cluster of

these!!!martes 10 de septiembre de 13

Page 5: TCE introduction (scalability with Scala and Akka)

Is it possible to handle multiple tasks and not suffer?!

martes 10 de septiembre de 13

Page 6: TCE introduction (scalability with Scala and Akka)

DEMO

martes 10 de septiembre de 13

Page 7: TCE introduction (scalability with Scala and Akka)

We do it for ages!UNIX pipes connect parallel processes

easily:* Deterministic* Composable

martes 10 de septiembre de 13

Page 8: TCE introduction (scalability with Scala and Akka)

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

Page 9: TCE introduction (scalability with Scala and Akka)

Pipe example in Java

martes 10 de septiembre de 13

Page 10: TCE introduction (scalability with Scala and Akka)

Are we there yet?Reliability?

Availability?Diagnostics?Distribution?

martes 10 de septiembre de 13

Page 11: TCE introduction (scalability with Scala and Akka)

Doing it in Java built-inssynchronize, volatile

Collections.synchronized*

java.util.concurrent

java.nio

fork/join

martes 10 de septiembre de 13

Page 12: TCE introduction (scalability with Scala and Akka)

High-level tools for Java async

Camel

Spring Integration

GridGain

Akka

martes 10 de septiembre de 13

Page 13: TCE introduction (scalability with Scala and Akka)

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

Page 14: TCE introduction (scalability with Scala and Akka)

Scala: being functional

High order functions

Immutable data

Referential transparency

Lazy evaluation

Recursion (RecursiveAction, anyone?)

martes 10 de septiembre de 13

Page 15: TCE introduction (scalability with Scala and Akka)

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

Page 16: TCE introduction (scalability with Scala and Akka)

Same JVM, different languagesYou don’t have to choose. You can mix

them in the same project.

martes 10 de septiembre de 13

Page 17: TCE introduction (scalability with Scala and Akka)

Right guys to follow ...Martin Odersky

Rod JohnsonJonas Bonér

martes 10 de septiembre de 13

Page 18: TCE introduction (scalability with Scala and Akka)

... they already use it in

production

martes 10 de septiembre de 13