72
BUILDING APPLICATIONS WITH AKKA.NET ANTHONY BROWN @BRUINBROWN93

Building applications with akka.net

Embed Size (px)

Citation preview

Page 1: Building applications with akka.net

BUILDING APPLICATIONS

WITH AKKA.NETANTHONY BROWN

@BRUINBROWN93

Page 2: Building applications with akka.net

Hi, i’m Anthonyuniversity student

[email protected]

@bruinbrown93

Page 3: Building applications with akka.net

moore’s law

Page 4: Building applications with akka.net

now we need

concurrency…

Page 5: Building applications with akka.net

…but concurrency is hard

Page 6: Building applications with akka.net

MULTITHREADING

THEORYPRACTICE

Page 7: Building applications with akka.net

CHECK OUTMY MULTITHREADED CODE

Page 8: Building applications with akka.net

HOW MANY THREADSDOES IT TAKE TO CHANGE A LIGHTBULB?

Page 9: Building applications with akka.net

application requirements have changed

Page 10: Building applications with akka.net

Credit: http://www.theawl.com/wp-content/uploads/2010/08/Screen-shot-2010-08-17-at-2.11.10-PM.png

Page 11: Building applications with akka.net

Common language to define new style of architecture

Page 12: Building applications with akka.net

Reactive systems

Page 13: Building applications with akka.net

RESPONSIVE

RESILIENT ELASTIC

MESSAGE PASSING

Page 14: Building applications with akka.net
Page 15: Building applications with akka.net

responsive

users want the best possible experience

Page 16: Building applications with akka.net

reactive applications react

to the world around them

Page 17: Building applications with akka.net

Message driven architecture

decouples components

Page 18: Building applications with akka.net

the actor model

Page 19: Building applications with akka.net

concurrency model

Page 20: Building applications with akka.net

STORAGE isolate mutable state

Page 21: Building applications with akka.net

processing reacting to changes

Page 22: Building applications with akka.net

Communication messaging as a requirement

Page 23: Building applications with akka.net

an actor is

A mailbox behaviour state

Page 24: Building applications with akka.net

an actor can…

set it’s behaviour for the next message

Page 25: Building applications with akka.net

an actor can…

send a finite number of messages

Page 26: Building applications with akka.net

an actor can…

spawn a finite number of actors

Page 27: Building applications with akka.net

looking at the original

Page 28: Building applications with akka.net

erlang

99.9999999% uptime

Page 29: Building applications with akka.net

erlang example

Page 30: Building applications with akka.net

introducing the akka.net way

Page 31: Building applications with akka.net
Page 32: Building applications with akka.net

step 1

define an actor

Page 33: Building applications with akka.net

class  GreetingActor  :  ReceiveActor  {          public  GreetingActor()          {                  Receive<string>(                          s  =>  Console.WriteLine(“Hello  ”  +  s));          }  }

Page 34: Building applications with akka.net

step 2

create an actor

Page 35: Building applications with akka.net

var  system  =  ActorSystem.Create(“GreeterSystem”);  

var  greeterActor  =  system.ActorOf<GreeterActor>();

Page 36: Building applications with akka.net

greeteractor isn’t something you can call

normally

it’s a reference to an actor

Page 37: Building applications with akka.net

where is my actual actor?

AKKA.net

root actor

your

actors

Page 38: Building applications with akka.net

Addressable like a file system or web site

akka://Greetersystem/user/parent/child

Page 39: Building applications with akka.net

step 3

send a message

Page 40: Building applications with akka.net

greeter.Tell(“DDDSW”);

Page 41: Building applications with akka.net

step 4

change behaviour

Page 42: Building applications with akka.net

Visual studio based demo

Page 43: Building applications with akka.net

resilience in reactive systems

Page 44: Building applications with akka.net

WE want applications to

ISOLATE ERRORS

SELF HEAL

Page 45: Building applications with akka.net

your users don’t want to see THIS

Page 46: Building applications with akka.net

Service aService B

supervisor

Request

Response

user error

error action

Page 47: Building applications with akka.net

scalability in reactive systems

Page 48: Building applications with akka.net

scale up has a ceiling

scale out doesn't

Page 49: Building applications with akka.net

and it’s easy if you share nothing

Page 50: Building applications with akka.net

how do we handle increased load?

Page 51: Building applications with akka.net

pools of actors

Page 52: Building applications with akka.net

visual studio based demo

Page 53: Building applications with akka.net

how do we use akka.net

Page 54: Building applications with akka.net

the internet of things

Page 55: Building applications with akka.net

what is the Iot?

pointless

A security nightmare

i really don’t want to be facebook

friends with my toaster

Page 56: Building applications with akka.net

managing farms

Page 57: Building applications with akka.net
Page 58: Building applications with akka.net

some things we saw

Page 59: Building applications with akka.net

actors are cheap

DON’t worry about having too many

Page 60: Building applications with akka.net

Always take back pressure seriously

LIBRARIES LIKE POLLY HELP

Page 61: Building applications with akka.net

LET IT CRASHdon’t worry about catching all

exceptions

Page 62: Building applications with akka.net

message passing is harder to debug

use akka.testkit to comprehensively

test

Page 63: Building applications with akka.net

understand message delivery guarantees

at most once is default

at least once is an option

Page 64: Building applications with akka.net

IN conclusion

Page 65: Building applications with akka.net

akka.net gives us lots

Auto-scaling

Service discovery

SELF HEALING

CLUSTERING SUPPORT

CQRS

MESSAGE PASSING LOCATION TRANSPARENCY

CONFIGURATION

Page 66: Building applications with akka.net

MAKES IT EASIER TO build reactive systems

Page 67: Building applications with akka.net

understand the difficulties

Page 68: Building applications with akka.net

where next?

Page 69: Building applications with akka.net

WANT TO contribute?

github.com/akkadotnet/akka.net

gitter.im/akkadotnet/akka.net

Page 70: Building applications with akka.net

want some help?

https://petabridge.com

HTTPS://github.com/petabridge/akka-bootcamp

Page 71: Building applications with akka.net

read the book

http://manning.com/brown2

coming later this year

Page 72: Building applications with akka.net

Q&A