building massively scalable applications with akka

31
1 Building Massively Scalable Applications with Akka Vikas Hazrati Inphina Technologies

Upload: indicthreads

Post on 10-May-2015

2.954 views

Category:

Technology


6 download

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

1

Building Massively Scalable Applications with Akka

Vikas Hazrati

Inphina Technologies

Page 2: Building Massively Scalable Applications With Akka

2

what?

Platform for next generation, event driven, scalable and fault tolerant architectures on the

JVM.

Page 3: Building Massively Scalable Applications With Akka

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

4

issues

concurrency

scalability

fault tolerance

Page 5: Building Massively Scalable Applications With Akka

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

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

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

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

9

Page 10: Building Massively Scalable Applications With Akka

10

defining an actor

Page 11: Building Massively Scalable Applications With Akka

11

firing messages

bang bang bang

Page 12: Building Massively Scalable Applications With Akka

12

send anything

Page 13: Building Massively Scalable Applications With Akka

13

fault tolerance

let it crash

linked set of actors

Page 14: Building Massively Scalable Applications With Akka

14

all for one

Page 15: Building Massively Scalable Applications With Akka

15

one for one

Page 16: Building Massively Scalable Applications With Akka

16

supervisor hierarchies

Page 17: Building Massively Scalable Applications With Akka

17

fault management

Page 18: Building Massively Scalable Applications With Akka

18

other concepts

Remote Actors

Akka STM

Akka Serialization

Persistence

Page 19: Building Massively Scalable Applications With Akka

19

problem statement

Page 20: Building Massively Scalable Applications With Akka

20

considerations

Page 21: Building Massively Scalable Applications With Akka

21

hmm...

STM – X

Serialization – X

Persistence – X

Remoting – ?/X

Page 22: Building Massively Scalable Applications With Akka

22

Page 23: Building Massively Scalable Applications With Akka

23

Page 24: Building Massively Scalable Applications With Akka

24

Page 25: Building Massively Scalable Applications With Akka

25

issues

maxing out on the os threads

Page 26: Building Massively Scalable Applications With Akka

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

27

Page 28: Building Massively Scalable Applications With Akka

28

ala carte'

Page 29: Building Massively Scalable Applications With Akka

29

used in ...

Page 30: Building Massively Scalable Applications With Akka

30

more information

http://akka.io/docs/akka/1.3-RC1/intro

http://thoughts.inphina.com/tag/akka/

Page 31: Building Massively Scalable Applications With Akka

31

Everyone ! “Thanks”

[email protected]@vhazrati