Building applications with akka.net

Preview:

Citation preview

BUILDING APPLICATIONS

WITH AKKA.NETANTHONY BROWN

@BRUINBROWN93

Hi, i’m Anthonyuniversity student

me@anthonyjbrown.co.uk

@bruinbrown93

moore’s law

now we need

concurrency…

…but concurrency is hard

MULTITHREADING

THEORYPRACTICE

CHECK OUTMY MULTITHREADED CODE

HOW MANY THREADSDOES IT TAKE TO CHANGE A LIGHTBULB?

application requirements have changed

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

Common language to define new style of architecture

Reactive systems

RESPONSIVE

RESILIENT ELASTIC

MESSAGE PASSING

responsive

users want the best possible experience

reactive applications react

to the world around them

Message driven architecture

decouples components

the actor model

concurrency model

STORAGE isolate mutable state

processing reacting to changes

Communication messaging as a requirement

an actor is

A mailbox behaviour state

an actor can…

set it’s behaviour for the next message

an actor can…

send a finite number of messages

an actor can…

spawn a finite number of actors

looking at the original

erlang

99.9999999% uptime

erlang example

introducing the akka.net way

step 1

define an actor

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

step 2

create an actor

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

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

greeteractor isn’t something you can call

normally

it’s a reference to an actor

where is my actual actor?

AKKA.net

root actor

your

actors

Addressable like a file system or web site

akka://Greetersystem/user/parent/child

step 3

send a message

greeter.Tell(“DDDSW”);

step 4

change behaviour

Visual studio based demo

resilience in reactive systems

WE want applications to

ISOLATE ERRORS

SELF HEAL

your users don’t want to see THIS

Service aService B

supervisor

Request

Response

user error

error action

scalability in reactive systems

scale up has a ceiling

scale out doesn't

and it’s easy if you share nothing

how do we handle increased load?

pools of actors

visual studio based demo

how do we use akka.net

the internet of things

what is the Iot?

pointless

A security nightmare

i really don’t want to be facebook

friends with my toaster

managing farms

some things we saw

actors are cheap

DON’t worry about having too many

Always take back pressure seriously

LIBRARIES LIKE POLLY HELP

LET IT CRASHdon’t worry about catching all

exceptions

message passing is harder to debug

use akka.testkit to comprehensively

test

understand message delivery guarantees

at most once is default

at least once is an option

IN conclusion

akka.net gives us lots

Auto-scaling

Service discovery

SELF HEALING

CLUSTERING SUPPORT

CQRS

MESSAGE PASSING LOCATION TRANSPARENCY

CONFIGURATION

MAKES IT EASIER TO build reactive systems

understand the difficulties

where next?

WANT TO contribute?

github.com/akkadotnet/akka.net

gitter.im/akkadotnet/akka.net

want some help?

https://petabridge.com

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

read the book

http://manning.com/brown2

coming later this year

Q&A

Recommended