building massively scalable applications with akka
DESCRIPTION
Session presented at the 6th IndicThreads.com Conference on Java held in Pune, India on 2-3 Dec. 2011. http://Java.IndicThreads.com --- Historically writing correct concurrent, scalable and fault-tolerant applications has been very hard. Akka is an attempt to simplify writing concurrent, scalable and highly available software for the JVM. Akka has an API both for Scala and Java. Akka uses the Actor Model together with Software Transactional Memory (STM) to raise the abstraction level. For fault-tolerance it adopts the “Let it crash” model which help in building self healing always on systems. The presentation walks through the Akka features for building a web scale system. We would look at a real world case study in which Inphina developed a web scale framework using Akka which is capable of processing 150 million streaming messages a day. We would discuss the architecture and key design decisions. http://www.indicthreads.com/9241/scalable-applications-with-akka/TRANSCRIPT
![Page 1: Building Massively Scalable Applications With Akka](https://reader034.vdocuments.net/reader034/viewer/2022052307/554f58acb4c905b9508b5247/html5/thumbnails/1.jpg)
1
Building Massively Scalable Applications with Akka
Vikas Hazrati
Inphina Technologies
![Page 2: Building Massively Scalable Applications With Akka](https://reader034.vdocuments.net/reader034/viewer/2022052307/554f58acb4c905b9508b5247/html5/thumbnails/2.jpg)
2
what?
Platform for next generation, event driven, scalable and fault tolerant architectures on the
JVM.
![Page 3: Building Massively Scalable Applications With Akka](https://reader034.vdocuments.net/reader034/viewer/2022052307/554f58acb4c905b9508b5247/html5/thumbnails/3.jpg)
3
akka
A actor-based concurrency framework
Provides solutions for non blocking concurrency
Written in Scala, also works in Java
Open source
Now at 1.3-RC2 (to be released this weekend)
Lead developer and founder: Jonas Boner
JRockit, AspectWerkz, AspectJ, Terracotta
![Page 4: Building Massively Scalable Applications With Akka](https://reader034.vdocuments.net/reader034/viewer/2022052307/554f58acb4c905b9508b5247/html5/thumbnails/4.jpg)
4
issues
concurrency
scalability
fault tolerance
![Page 5: Building Massively Scalable Applications With Akka](https://reader034.vdocuments.net/reader034/viewer/2022052307/554f58acb4c905b9508b5247/html5/thumbnails/5.jpg)
5
why akka
simpler concurrency
event driven
scale up or scale out
fault tolerance
remoting
scala and java api
![Page 6: Building Massively Scalable Applications With Akka](https://reader034.vdocuments.net/reader034/viewer/2022052307/554f58acb4c905b9508b5247/html5/thumbnails/6.jpg)
6
aha actors!
message-Passing Concurrency
share NOTHING
isolated lightweight processes
communicates through messages
asynchronous and non-blocking
![Page 7: Building Massively Scalable Applications With Akka](https://reader034.vdocuments.net/reader034/viewer/2022052307/554f58acb4c905b9508b5247/html5/thumbnails/7.jpg)
7
actors
defined in the 1973 paper by Carl Hewitt
popularized by Erlang
alleviates the dev
from explicit locking
and thread management
easy to write concurrent and parallel systems
actors like objects BUT dont share state
![Page 8: Building Massively Scalable Applications With Akka](https://reader034.vdocuments.net/reader034/viewer/2022052307/554f58acb4c905b9508b5247/html5/thumbnails/8.jpg)
8
actor models
Thread-based
Event-based• Very lightweight
• can easily create millions on a single
workstation
(6.5 million on 4 G RAM)
![Page 9: Building Massively Scalable Applications With Akka](https://reader034.vdocuments.net/reader034/viewer/2022052307/554f58acb4c905b9508b5247/html5/thumbnails/9.jpg)
9
![Page 10: Building Massively Scalable Applications With Akka](https://reader034.vdocuments.net/reader034/viewer/2022052307/554f58acb4c905b9508b5247/html5/thumbnails/10.jpg)
10
defining an actor
![Page 11: Building Massively Scalable Applications With Akka](https://reader034.vdocuments.net/reader034/viewer/2022052307/554f58acb4c905b9508b5247/html5/thumbnails/11.jpg)
11
firing messages
bang bang bang
![Page 12: Building Massively Scalable Applications With Akka](https://reader034.vdocuments.net/reader034/viewer/2022052307/554f58acb4c905b9508b5247/html5/thumbnails/12.jpg)
12
send anything
![Page 13: Building Massively Scalable Applications With Akka](https://reader034.vdocuments.net/reader034/viewer/2022052307/554f58acb4c905b9508b5247/html5/thumbnails/13.jpg)
13
fault tolerance
let it crash
linked set of actors
![Page 14: Building Massively Scalable Applications With Akka](https://reader034.vdocuments.net/reader034/viewer/2022052307/554f58acb4c905b9508b5247/html5/thumbnails/14.jpg)
14
all for one
![Page 15: Building Massively Scalable Applications With Akka](https://reader034.vdocuments.net/reader034/viewer/2022052307/554f58acb4c905b9508b5247/html5/thumbnails/15.jpg)
15
one for one
![Page 16: Building Massively Scalable Applications With Akka](https://reader034.vdocuments.net/reader034/viewer/2022052307/554f58acb4c905b9508b5247/html5/thumbnails/16.jpg)
16
supervisor hierarchies
![Page 17: Building Massively Scalable Applications With Akka](https://reader034.vdocuments.net/reader034/viewer/2022052307/554f58acb4c905b9508b5247/html5/thumbnails/17.jpg)
17
fault management
![Page 18: Building Massively Scalable Applications With Akka](https://reader034.vdocuments.net/reader034/viewer/2022052307/554f58acb4c905b9508b5247/html5/thumbnails/18.jpg)
18
other concepts
Remote Actors
Akka STM
Akka Serialization
Persistence
![Page 19: Building Massively Scalable Applications With Akka](https://reader034.vdocuments.net/reader034/viewer/2022052307/554f58acb4c905b9508b5247/html5/thumbnails/19.jpg)
19
problem statement
![Page 20: Building Massively Scalable Applications With Akka](https://reader034.vdocuments.net/reader034/viewer/2022052307/554f58acb4c905b9508b5247/html5/thumbnails/20.jpg)
20
considerations
![Page 21: Building Massively Scalable Applications With Akka](https://reader034.vdocuments.net/reader034/viewer/2022052307/554f58acb4c905b9508b5247/html5/thumbnails/21.jpg)
21
hmm...
STM – X
Serialization – X
Persistence – X
Remoting – ?/X
![Page 22: Building Massively Scalable Applications With Akka](https://reader034.vdocuments.net/reader034/viewer/2022052307/554f58acb4c905b9508b5247/html5/thumbnails/22.jpg)
22
![Page 23: Building Massively Scalable Applications With Akka](https://reader034.vdocuments.net/reader034/viewer/2022052307/554f58acb4c905b9508b5247/html5/thumbnails/23.jpg)
23
![Page 24: Building Massively Scalable Applications With Akka](https://reader034.vdocuments.net/reader034/viewer/2022052307/554f58acb4c905b9508b5247/html5/thumbnails/24.jpg)
24
![Page 25: Building Massively Scalable Applications With Akka](https://reader034.vdocuments.net/reader034/viewer/2022052307/554f58acb4c905b9508b5247/html5/thumbnails/25.jpg)
25
issues
maxing out on the os threads
![Page 26: Building Massively Scalable Applications With Akka](https://reader034.vdocuments.net/reader034/viewer/2022052307/554f58acb4c905b9508b5247/html5/thumbnails/26.jpg)
26
dispatchers
thread based – dedicated os thread bound
event based – backed by pool of threads
priority event based
work stealing
![Page 27: Building Massively Scalable Applications With Akka](https://reader034.vdocuments.net/reader034/viewer/2022052307/554f58acb4c905b9508b5247/html5/thumbnails/27.jpg)
27
![Page 28: Building Massively Scalable Applications With Akka](https://reader034.vdocuments.net/reader034/viewer/2022052307/554f58acb4c905b9508b5247/html5/thumbnails/28.jpg)
28
ala carte'
![Page 29: Building Massively Scalable Applications With Akka](https://reader034.vdocuments.net/reader034/viewer/2022052307/554f58acb4c905b9508b5247/html5/thumbnails/29.jpg)
29
used in ...
![Page 30: Building Massively Scalable Applications With Akka](https://reader034.vdocuments.net/reader034/viewer/2022052307/554f58acb4c905b9508b5247/html5/thumbnails/30.jpg)
30
more information
http://akka.io/docs/akka/1.3-RC1/intro
http://thoughts.inphina.com/tag/akka/