SlideShare a Scribd company logo
1 of 74
_LET_IT_CRASH_ ***  Pavlo Baron, OOP‘12
The Blue Screen Of Death (BSOD) used as background in this presentation has been friendly provided by Microsoft Windows
_PAVLO_BARON_ [email_address] @pavlobaron
Do you know _MURPHY_? You should, since he’s developing your software, deploying and releasing, testing and using it. He’s also designing and operating the whole hardware your programs are running on
Everything that _CAN_ go wrong _WILL_ go wrong (Murphy’s Law)
The very question is: do you _REALLY_ know everything that can go wrong?
You can cover your cleaner bottle with hazard symbols, and still there will be a genius who will clean his teeth with it
Or in topic relevant terms, look at this line of code: C = A / B
[object Object],[object Object],[object Object],[object Object],[object Object],C = A / B
Was it all? No, there’s more: 5. C assumed to be a string 6. C gets overwritten 7. A, B, C not thread safe 8. C = 0 through rounding 9. this is copy/paste code . . .  C = A / B
And that’s just one LOC. Now imagine the explosion with every further LOC
Your primary instinct is to protect yourself from things going wrong…
… through attempting to prevent things from going wrong
_DEFENSIVE_PROGRAMMING_ is what they taught us to do: critical if (isnum(A) and     isnum(B) and (A > B * 10) and (B > 0)) try C = A / B catch (DivisionByZero) …
And of course you will omit the one which will crash the whole thing
So what you sometimes are trying to do is: catch (WrongStellarConstellation) //move stars catch (WrongSunPosition) //move after the sun catch (Angle45DegreeToHorizon) //run for your life catch (*) //just for the case
You’re hounding _MURPHY_. Btw.: did you already check your payroll? Maybe you’ll find him there
Do you imply I’m stupid? Wanna fight?
No. I just suggest to let go of trying to achieve the impossible
It is _HARD_TO_FORESEE_ every eventuality
It is _IMPOSSIBLE_TO_FORESEE_ every eventuality dealing with big data amounts and huge event numbers
It is wrong to catch all eventualities in a generic _ERROR_HANDLER_OF_FEAR_
_DYNAMICALLY_TYPED_ languages have much more potential to introduce unpredictable data constellations
_WEB_BASED_APPLICATIONS_ come up with the user generated content which is completely unpredictable
_HARDWARE_ is unreliable. Accept. Period.
_NETWORKS_ are unreliable. Accept. Period.
Error handling code makes your source code _UNREADABLE_ and _UNMAINTAINABLE_
Why would you think that the error handling code is _FREE_FROM_ERRORS_?
Of course, your _TEST_COVERAGE_ is extremely high, especially for the error handling code
Or, alternatively, your programs are just completely free from bugs
This is a typical, complete, wholly bug-free program: begin end
Aha. So what should I do instead?
[object Object],[object Object],[object Object],[object Object],[object Object]
_LET_IT_CRASH_
_YOU_NEED_ “ Virtual” processing units much smaller than your OS’s processes / threads Their cheapness pays off when they get scheduled through zero/minimal context switching and possibility to run 100’000s of them in one single VM instance
_YOU_NEED_ Actors
_YOU_NEED_ A virtual machine to run these actors, to schedule them, to control resources
_YOU_NEED_ Mechanisms in your VM to protect and isolate single actors from each other and the whole VM from the actors Actors must pass messages instead of sharing resources in order to minimize dependencies
_YOU_NEED_ A very high level of actor isolation
_YOU_NEED_ To be able to externalize actor’s state Actors get their state from some storage / another actor with every new “call” and return a modified state for further storage
_YOU_NEED_ An onion alike, layered model When an actor crashes, another one still “stores” its state and can pass it on to a new actor
_YOU_NEED_ Ideally a functional programming approach There, you can only apply state from outside and get back a modified one
_YOU_NEED_ Mechanisms which allow an actor to automatically get informed when an other actor crashes Also mechanisms to link actors together so they “die” together
_YOU_NEED_ Linking (and monitoring) mechanisms
_YOU_NEED_ Worker actors just doing some job. They can crash, but might get restarted at the point of crash to go on
_YOU_NEED_ Supervisor actors only monitoring other actors, killing, restarting them, providing them their external state
_YOU_NEED_ Hierarchies / trees of workers and supervisors, with branches being configured differently
_YOU_NEED_ An automated strategy configuration for how to start workers, how to deal with crashes, how often etc.
Aha. And where can I get it for free?
Erlang/OTP (the heart of Joe’s thesis) can do it all
Spawn / register / message passing register(?MODULE, spawn(?MODULE, loop, [])), ?MODULE ! {start}.
Linking / trapping exits register(?MODULE, spawn_link(?MODULE, loop, [])), ?MODULE ! {start}. ... loop() -> receive {start} -> process_flag(trap_exit, true), loop(); {'EXIT', _Pid, stop} -> ...
Monitoring erlang:monitor(process, From), ... loop() -> receive   {'DOWN', _Ref, process, Pid, Reason} -> ...
Worker / Supervisor -behaviour(supervisor). ... init(Args) -> {ok, {{one_for_one, 2, 10}, [ {the_server,   {test_server, start_link,   [Args]}, permanent, 2000,   worker, [test_server]} ]}}.
Worker state externalization -behaviour(gen_server). ... init(Args) -> ... State = #state{id = Id, session_id = SessionId}, {ok, State}. ... handle_cast(stop, State) -> dr_session:stop( State#state.session_id), {noreply, State};
Same approach works (with minimal modifications) not only on one node, but on several nodes and even distributed over a network. That allows building true fault-tolerant systems
Erlang was invented to program switches, control networks etc. It’s been designed for the mentioned hardware and network “ reliability”
Erjang - Erlang VM “ on top“ of the JVM – can do this, too
And Scala/Akka can also do this on the JVM
Linking // link and unlink actors self.link(actorRef) self.unlink(actorRef) // starts and links Actors atomically self.startLink(actorRef) // spawns (creates and starts) actors self.spawn[MyActor] self.spawnRemote[MyActor] // spawns and links Actors atomically self.spawnLink[MyActor] self.spawnLinkRemote[MyActor]
Worker / supervisor val supervisor = Supervisor( SupervisorConfig( AllForOneStrategy( List(classOf[Exception]),3,1000), Supervise( actorOf[MyActor1], Permanent) :: Supervise( actorOf[MyActor2], Permanent) :: Nil))
What’s the catch? There must be one – I can’t simply build upon crashing
Right. There’s no such thing as a free lunch
  _ASK_YOURSELF_ Should I handle this error? Defensive programming and “let it crash” philosophy must not exclude each other
  _ASK_YOURSELF_ How should I handle this error? Throw an exception? Return a value? Ignore? Write a log? Terminate the program?
  _ASK_YOURSELF_ Can I terminate / crash here? Do I have to go on? Can I go on from here at all?
  _ASK_YOURSELF_ Can I leave some garbage after I crash? Do I have to clean up before / after I do?
  _ASK_YOURSELF_ When I restart a worker, how can I know it doesn’t crash again, and again?..
  _ASK_YOURSELF_ Why do I expect wrong function parameters? Don’t I trust my own non-API calls? Shouldn’t I fix this outside?
  _ASK_YOURSELF_ When should I prefer in-place error handlers? When should I better go for a central error handler knowing about all types of possible errors?
  _ASK_YOURSELF_ Do I have to check parameter types? Do I have to generally check the semantics of the API function parameters, implement a contract?
With all this in mind: Don’t program too defensively. _LET_IT_CRASH_
_THANK_YOU_
Presentation inspired by the work of Joe Armstrong, Steve Vinoski, Mazen Harake, Jonas Bonér and Kresten Krab Thorup Most images originate from istockphoto.com except few ones taken from Wikipedia and product pages

More Related Content

What's hot

Openframworks x Mobile
Openframworks x MobileOpenframworks x Mobile
Openframworks x MobileJanet Huang
 
Section 8 Programming Style and Your Brain: Douglas Crockford
Section 8 Programming Style and Your Brain: Douglas CrockfordSection 8 Programming Style and Your Brain: Douglas Crockford
Section 8 Programming Style and Your Brain: Douglas Crockfordjaxconf
 
Types of exceptions
Types of exceptionsTypes of exceptions
Types of exceptionsmyrajendra
 
New land of error handling in swift
New land of error handling in swiftNew land of error handling in swift
New land of error handling in swiftTsungyu Yu
 

What's hot (7)

Of class3
Of class3Of class3
Of class3
 
Openframworks x Mobile
Openframworks x MobileOpenframworks x Mobile
Openframworks x Mobile
 
Presentation1
Presentation1Presentation1
Presentation1
 
Section 8 Programming Style and Your Brain: Douglas Crockford
Section 8 Programming Style and Your Brain: Douglas CrockfordSection 8 Programming Style and Your Brain: Douglas Crockford
Section 8 Programming Style and Your Brain: Douglas Crockford
 
Types of exceptions
Types of exceptionsTypes of exceptions
Types of exceptions
 
Emet bypsass
Emet bypsass Emet bypsass
Emet bypsass
 
New land of error handling in swift
New land of error handling in swiftNew land of error handling in swift
New land of error handling in swift
 

Viewers also liked

@pavlobaron Why monitoring sucks and how to improve it
@pavlobaron Why monitoring sucks and how to improve it@pavlobaron Why monitoring sucks and how to improve it
@pavlobaron Why monitoring sucks and how to improve itPavlo Baron
 
Theoretical aspects of distributed systems - playfully illustrated (@pavlobaron)
Theoretical aspects of distributed systems - playfully illustrated (@pavlobaron)Theoretical aspects of distributed systems - playfully illustrated (@pavlobaron)
Theoretical aspects of distributed systems - playfully illustrated (@pavlobaron)Pavlo Baron
 
Concurrency in Elixir with OTP
Concurrency in Elixir with OTPConcurrency in Elixir with OTP
Concurrency in Elixir with OTPJustin Reese
 
KNOWLEDGE FOR ACTION_Let us serve COMMUNITY through linking it to ACADEMIA_ O...
KNOWLEDGE FOR ACTION_Let us serve COMMUNITY through linking it to ACADEMIA_ O...KNOWLEDGE FOR ACTION_Let us serve COMMUNITY through linking it to ACADEMIA_ O...
KNOWLEDGE FOR ACTION_Let us serve COMMUNITY through linking it to ACADEMIA_ O...Dr Talaat Refaat
 
Elixir Elevated: The Ups and Downs of OTP at ElixirConf2014
Elixir Elevated: The Ups and Downs of OTP at ElixirConf2014Elixir Elevated: The Ups and Downs of OTP at ElixirConf2014
Elixir Elevated: The Ups and Downs of OTP at ElixirConf2014Greg Vaughn
 
맛만 보자 액터 모델이란
맛만 보자 액터 모델이란 맛만 보자 액터 모델이란
맛만 보자 액터 모델이란 jbugkorea
 
Making an outline
Making an outlineMaking an outline
Making an outlineAWKUM
 
Go Green, Go Clean: Visit to Cyprus
Go Green, Go Clean: Visit to CyprusGo Green, Go Clean: Visit to Cyprus
Go Green, Go Clean: Visit to CyprusPatrizia Salutij
 
Erlang - Concurrent Language for Concurrent World
Erlang - Concurrent Language for Concurrent WorldErlang - Concurrent Language for Concurrent World
Erlang - Concurrent Language for Concurrent WorldZvi Avraham
 
Node.jsエンジニア Erlangに入門するの巻
Node.jsエンジニア Erlangに入門するの巻Node.jsエンジニア Erlangに入門するの巻
Node.jsエンジニア Erlangに入門するの巻Recruit Technologies
 
1 hour dive into Erlang/OTP
1 hour dive into Erlang/OTP1 hour dive into Erlang/OTP
1 hour dive into Erlang/OTPJordi Llonch
 
Let it crash! The Erlang Approach to Building Reliable Services
Let it crash! The Erlang Approach to Building Reliable ServicesLet it crash! The Erlang Approach to Building Reliable Services
Let it crash! The Erlang Approach to Building Reliable ServicesBrian Troutwine
 
リアルタイムサーバー 〜Erlang/OTPで作るPubSubサーバー〜
リアルタイムサーバー 〜Erlang/OTPで作るPubSubサーバー〜 リアルタイムサーバー 〜Erlang/OTPで作るPubSubサーバー〜
リアルタイムサーバー 〜Erlang/OTPで作るPubSubサーバー〜 Yugo Shimizu
 
Sanitation and Proper Sanitation of Restaurant Wastes
Sanitation and Proper Sanitation of Restaurant WastesSanitation and Proper Sanitation of Restaurant Wastes
Sanitation and Proper Sanitation of Restaurant WastesJustine Almenario
 
地獄のElixir(目黒スタートアップ勉強会)
地獄のElixir(目黒スタートアップ勉強会)地獄のElixir(目黒スタートアップ勉強会)
地獄のElixir(目黒スタートアップ勉強会)Tsunenori Oohara
 
FOOD SANITATION, SAFETY & HYGIENE - CHAPTER 1
FOOD SANITATION, SAFETY & HYGIENE - CHAPTER 1FOOD SANITATION, SAFETY & HYGIENE - CHAPTER 1
FOOD SANITATION, SAFETY & HYGIENE - CHAPTER 1Bean Malicse
 

Viewers also liked (20)

@pavlobaron Why monitoring sucks and how to improve it
@pavlobaron Why monitoring sucks and how to improve it@pavlobaron Why monitoring sucks and how to improve it
@pavlobaron Why monitoring sucks and how to improve it
 
Theoretical aspects of distributed systems - playfully illustrated (@pavlobaron)
Theoretical aspects of distributed systems - playfully illustrated (@pavlobaron)Theoretical aspects of distributed systems - playfully illustrated (@pavlobaron)
Theoretical aspects of distributed systems - playfully illustrated (@pavlobaron)
 
Concurrency in Elixir with OTP
Concurrency in Elixir with OTPConcurrency in Elixir with OTP
Concurrency in Elixir with OTP
 
KNOWLEDGE FOR ACTION_Let us serve COMMUNITY through linking it to ACADEMIA_ O...
KNOWLEDGE FOR ACTION_Let us serve COMMUNITY through linking it to ACADEMIA_ O...KNOWLEDGE FOR ACTION_Let us serve COMMUNITY through linking it to ACADEMIA_ O...
KNOWLEDGE FOR ACTION_Let us serve COMMUNITY through linking it to ACADEMIA_ O...
 
Elixir Elevated: The Ups and Downs of OTP at ElixirConf2014
Elixir Elevated: The Ups and Downs of OTP at ElixirConf2014Elixir Elevated: The Ups and Downs of OTP at ElixirConf2014
Elixir Elevated: The Ups and Downs of OTP at ElixirConf2014
 
Elixir and OTP
Elixir and OTPElixir and OTP
Elixir and OTP
 
맛만 보자 액터 모델이란
맛만 보자 액터 모델이란 맛만 보자 액터 모델이란
맛만 보자 액터 모델이란
 
Making an outline
Making an outlineMaking an outline
Making an outline
 
Go Green, Go Clean: Visit to Cyprus
Go Green, Go Clean: Visit to CyprusGo Green, Go Clean: Visit to Cyprus
Go Green, Go Clean: Visit to Cyprus
 
Erlang - Concurrent Language for Concurrent World
Erlang - Concurrent Language for Concurrent WorldErlang - Concurrent Language for Concurrent World
Erlang - Concurrent Language for Concurrent World
 
Node.jsエンジニア Erlangに入門するの巻
Node.jsエンジニア Erlangに入門するの巻Node.jsエンジニア Erlangに入門するの巻
Node.jsエンジニア Erlangに入門するの巻
 
1 hour dive into Erlang/OTP
1 hour dive into Erlang/OTP1 hour dive into Erlang/OTP
1 hour dive into Erlang/OTP
 
Erlang OTP
Erlang OTPErlang OTP
Erlang OTP
 
Erlang/OTP in Riak
Erlang/OTP in RiakErlang/OTP in Riak
Erlang/OTP in Riak
 
Let it crash! The Erlang Approach to Building Reliable Services
Let it crash! The Erlang Approach to Building Reliable ServicesLet it crash! The Erlang Approach to Building Reliable Services
Let it crash! The Erlang Approach to Building Reliable Services
 
リアルタイムサーバー 〜Erlang/OTPで作るPubSubサーバー〜
リアルタイムサーバー 〜Erlang/OTPで作るPubSubサーバー〜 リアルタイムサーバー 〜Erlang/OTPで作るPubSubサーバー〜
リアルタイムサーバー 〜Erlang/OTPで作るPubSubサーバー〜
 
Sanitation and Proper Sanitation of Restaurant Wastes
Sanitation and Proper Sanitation of Restaurant WastesSanitation and Proper Sanitation of Restaurant Wastes
Sanitation and Proper Sanitation of Restaurant Wastes
 
地獄のElixir(目黒スタートアップ勉強会)
地獄のElixir(目黒スタートアップ勉強会)地獄のElixir(目黒スタートアップ勉強会)
地獄のElixir(目黒スタートアップ勉強会)
 
Air Pollution
Air PollutionAir Pollution
Air Pollution
 
FOOD SANITATION, SAFETY & HYGIENE - CHAPTER 1
FOOD SANITATION, SAFETY & HYGIENE - CHAPTER 1FOOD SANITATION, SAFETY & HYGIENE - CHAPTER 1
FOOD SANITATION, SAFETY & HYGIENE - CHAPTER 1
 

Similar to Let It Crash (@pavlobaron)

Exception Handling: Designing Robust Software in Ruby (with presentation note)
Exception Handling: Designing Robust Software in Ruby (with presentation note)Exception Handling: Designing Robust Software in Ruby (with presentation note)
Exception Handling: Designing Robust Software in Ruby (with presentation note)Wen-Tien Chang
 
You shouldneverdo
You shouldneverdoYou shouldneverdo
You shouldneverdodaniil3
 
Devopssecfail
DevopssecfailDevopssecfail
Devopssecfailcacois
 
The Sieve of Eratosthenes - Part 1 - with minor corrections
The Sieve of Eratosthenes - Part 1 - with minor correctionsThe Sieve of Eratosthenes - Part 1 - with minor corrections
The Sieve of Eratosthenes - Part 1 - with minor correctionsPhilip Schwarz
 
The Sieve of Eratosthenes - Part 1
The Sieve of Eratosthenes - Part 1The Sieve of Eratosthenes - Part 1
The Sieve of Eratosthenes - Part 1Philip Schwarz
 
How to find 56 potential vulnerabilities in FreeBSD code in one evening
How to find 56 potential vulnerabilities in FreeBSD code in one eveningHow to find 56 potential vulnerabilities in FreeBSD code in one evening
How to find 56 potential vulnerabilities in FreeBSD code in one eveningPVS-Studio
 
The limits of unit testing by Craig Stuntz
The limits of unit testing by Craig StuntzThe limits of unit testing by Craig Stuntz
The limits of unit testing by Craig StuntzQA or the Highway
 
The Limits of Unit Testing by Craig Stuntz
The Limits of Unit Testing by Craig StuntzThe Limits of Unit Testing by Craig Stuntz
The Limits of Unit Testing by Craig StuntzQA or the Highway
 
10.USING THE ECLIPSE DEBUGGERupdated 8618This t.docx
10.USING THE ECLIPSE DEBUGGERupdated 8618This t.docx10.USING THE ECLIPSE DEBUGGERupdated 8618This t.docx
10.USING THE ECLIPSE DEBUGGERupdated 8618This t.docxpaynetawnya
 
Questioning the status quo
Questioning the status quoQuestioning the status quo
Questioning the status quoIvano Pagano
 
Cognitive Shortcuts: Models, Visualizations, Metaphors, and Other Lies (Rails...
Cognitive Shortcuts: Models, Visualizations, Metaphors, and Other Lies (Rails...Cognitive Shortcuts: Models, Visualizations, Metaphors, and Other Lies (Rails...
Cognitive Shortcuts: Models, Visualizations, Metaphors, and Other Lies (Rails...Sam Livingston-Gray
 
Your Library Sucks, and why you should use it.
Your Library Sucks, and why you should use it.Your Library Sucks, and why you should use it.
Your Library Sucks, and why you should use it.Peter Higgins
 
Logical Expressions in C/C++. Mistakes Made by Professionals
Logical Expressions in C/C++. Mistakes Made by ProfessionalsLogical Expressions in C/C++. Mistakes Made by Professionals
Logical Expressions in C/C++. Mistakes Made by ProfessionalsPVS-Studio
 
Puppet Camp Düsseldorf 2014: Continuously Deliver Your Puppet Code with Jenki...
Puppet Camp Düsseldorf 2014: Continuously Deliver Your Puppet Code with Jenki...Puppet Camp Düsseldorf 2014: Continuously Deliver Your Puppet Code with Jenki...
Puppet Camp Düsseldorf 2014: Continuously Deliver Your Puppet Code with Jenki...Puppet
 
Puppet Camp Duesseldorf 2014: Toni Schmidbauer - Continuously deliver your pu...
Puppet Camp Duesseldorf 2014: Toni Schmidbauer - Continuously deliver your pu...Puppet Camp Duesseldorf 2014: Toni Schmidbauer - Continuously deliver your pu...
Puppet Camp Duesseldorf 2014: Toni Schmidbauer - Continuously deliver your pu...NETWAYS
 
IcingaCamp Stockholm - How to make your monitoring shut up
IcingaCamp Stockholm - How to make your monitoring shut upIcingaCamp Stockholm - How to make your monitoring shut up
IcingaCamp Stockholm - How to make your monitoring shut upIcinga
 
A Unicorn Seeking Extraterrestrial Life: Analyzing SETI@home's Source Code
A Unicorn Seeking Extraterrestrial Life: Analyzing SETI@home's Source CodeA Unicorn Seeking Extraterrestrial Life: Analyzing SETI@home's Source Code
A Unicorn Seeking Extraterrestrial Life: Analyzing SETI@home's Source CodePVS-Studio
 

Similar to Let It Crash (@pavlobaron) (20)

Exception Handling: Designing Robust Software in Ruby (with presentation note)
Exception Handling: Designing Robust Software in Ruby (with presentation note)Exception Handling: Designing Robust Software in Ruby (with presentation note)
Exception Handling: Designing Robust Software in Ruby (with presentation note)
 
You shouldneverdo
You shouldneverdoYou shouldneverdo
You shouldneverdo
 
Devopssecfail
DevopssecfailDevopssecfail
Devopssecfail
 
The Sieve of Eratosthenes - Part 1 - with minor corrections
The Sieve of Eratosthenes - Part 1 - with minor correctionsThe Sieve of Eratosthenes - Part 1 - with minor corrections
The Sieve of Eratosthenes - Part 1 - with minor corrections
 
The Sieve of Eratosthenes - Part 1
The Sieve of Eratosthenes - Part 1The Sieve of Eratosthenes - Part 1
The Sieve of Eratosthenes - Part 1
 
How to find 56 potential vulnerabilities in FreeBSD code in one evening
How to find 56 potential vulnerabilities in FreeBSD code in one eveningHow to find 56 potential vulnerabilities in FreeBSD code in one evening
How to find 56 potential vulnerabilities in FreeBSD code in one evening
 
The limits of unit testing by Craig Stuntz
The limits of unit testing by Craig StuntzThe limits of unit testing by Craig Stuntz
The limits of unit testing by Craig Stuntz
 
The Limits of Unit Testing by Craig Stuntz
The Limits of Unit Testing by Craig StuntzThe Limits of Unit Testing by Craig Stuntz
The Limits of Unit Testing by Craig Stuntz
 
10.USING THE ECLIPSE DEBUGGERupdated 8618This t.docx
10.USING THE ECLIPSE DEBUGGERupdated 8618This t.docx10.USING THE ECLIPSE DEBUGGERupdated 8618This t.docx
10.USING THE ECLIPSE DEBUGGERupdated 8618This t.docx
 
Questioning the status quo
Questioning the status quoQuestioning the status quo
Questioning the status quo
 
PHP 5 Magic Methods
PHP 5 Magic MethodsPHP 5 Magic Methods
PHP 5 Magic Methods
 
Cognitive Shortcuts: Models, Visualizations, Metaphors, and Other Lies (Rails...
Cognitive Shortcuts: Models, Visualizations, Metaphors, and Other Lies (Rails...Cognitive Shortcuts: Models, Visualizations, Metaphors, and Other Lies (Rails...
Cognitive Shortcuts: Models, Visualizations, Metaphors, and Other Lies (Rails...
 
Your Library Sucks, and why you should use it.
Your Library Sucks, and why you should use it.Your Library Sucks, and why you should use it.
Your Library Sucks, and why you should use it.
 
Logical Expressions in C/C++. Mistakes Made by Professionals
Logical Expressions in C/C++. Mistakes Made by ProfessionalsLogical Expressions in C/C++. Mistakes Made by Professionals
Logical Expressions in C/C++. Mistakes Made by Professionals
 
Puppet Camp Düsseldorf 2014: Continuously Deliver Your Puppet Code with Jenki...
Puppet Camp Düsseldorf 2014: Continuously Deliver Your Puppet Code with Jenki...Puppet Camp Düsseldorf 2014: Continuously Deliver Your Puppet Code with Jenki...
Puppet Camp Düsseldorf 2014: Continuously Deliver Your Puppet Code with Jenki...
 
Puppet Camp Duesseldorf 2014: Toni Schmidbauer - Continuously deliver your pu...
Puppet Camp Duesseldorf 2014: Toni Schmidbauer - Continuously deliver your pu...Puppet Camp Duesseldorf 2014: Toni Schmidbauer - Continuously deliver your pu...
Puppet Camp Duesseldorf 2014: Toni Schmidbauer - Continuously deliver your pu...
 
VBscript
VBscriptVBscript
VBscript
 
IcingaCamp Stockholm - How to make your monitoring shut up
IcingaCamp Stockholm - How to make your monitoring shut upIcingaCamp Stockholm - How to make your monitoring shut up
IcingaCamp Stockholm - How to make your monitoring shut up
 
A Unicorn Seeking Extraterrestrial Life: Analyzing SETI@home's Source Code
A Unicorn Seeking Extraterrestrial Life: Analyzing SETI@home's Source CodeA Unicorn Seeking Extraterrestrial Life: Analyzing SETI@home's Source Code
A Unicorn Seeking Extraterrestrial Life: Analyzing SETI@home's Source Code
 
Um2010
Um2010Um2010
Um2010
 

More from Pavlo Baron

Why we do tech the way we do tech now (@pavlobaron)
Why we do tech the way we do tech now (@pavlobaron)Why we do tech the way we do tech now (@pavlobaron)
Why we do tech the way we do tech now (@pavlobaron)Pavlo Baron
 
Qcon2015 living database
Qcon2015 living databaseQcon2015 living database
Qcon2015 living databasePavlo Baron
 
Becoming reactive without overreacting (@pavlobaron)
Becoming reactive without overreacting (@pavlobaron)Becoming reactive without overreacting (@pavlobaron)
Becoming reactive without overreacting (@pavlobaron)Pavlo Baron
 
The hidden costs of the parallel world (@pavlobaron)
The hidden costs of the parallel world (@pavlobaron)The hidden costs of the parallel world (@pavlobaron)
The hidden costs of the parallel world (@pavlobaron)Pavlo Baron
 
data, ..., profit (@pavlobaron)
data, ..., profit (@pavlobaron)data, ..., profit (@pavlobaron)
data, ..., profit (@pavlobaron)Pavlo Baron
 
Data on its way to history, interrupted by analytics and silicon (@pavlobaron)
Data on its way to history, interrupted by analytics and silicon (@pavlobaron)Data on its way to history, interrupted by analytics and silicon (@pavlobaron)
Data on its way to history, interrupted by analytics and silicon (@pavlobaron)Pavlo Baron
 
(Functional) reactive programming (@pavlobaron)
(Functional) reactive programming (@pavlobaron)(Functional) reactive programming (@pavlobaron)
(Functional) reactive programming (@pavlobaron)Pavlo Baron
 
Near realtime analytics - technology choice (@pavlobaron)
Near realtime analytics - technology choice (@pavlobaron)Near realtime analytics - technology choice (@pavlobaron)
Near realtime analytics - technology choice (@pavlobaron)Pavlo Baron
 
Set this Big Data technology zoo in order (@pavlobaron)
Set this Big Data technology zoo in order (@pavlobaron)Set this Big Data technology zoo in order (@pavlobaron)
Set this Big Data technology zoo in order (@pavlobaron)Pavlo Baron
 
a Tech guy’s take on Big Data business cases (@pavlobaron)
a Tech guy’s take on Big Data business cases (@pavlobaron)a Tech guy’s take on Big Data business cases (@pavlobaron)
a Tech guy’s take on Big Data business cases (@pavlobaron)Pavlo Baron
 
Diving into Erlang is a one-way ticket (@pavlobaron)
Diving into Erlang is a one-way ticket (@pavlobaron)Diving into Erlang is a one-way ticket (@pavlobaron)
Diving into Erlang is a one-way ticket (@pavlobaron)Pavlo Baron
 
Dynamo concepts in depth (@pavlobaron)
Dynamo concepts in depth (@pavlobaron)Dynamo concepts in depth (@pavlobaron)
Dynamo concepts in depth (@pavlobaron)Pavlo Baron
 
Chef's Coffee - provisioning Java applications with Chef (@pavlobaron)
Chef's Coffee - provisioning Java applications with Chef (@pavlobaron)Chef's Coffee - provisioning Java applications with Chef (@pavlobaron)
Chef's Coffee - provisioning Java applications with Chef (@pavlobaron)Pavlo Baron
 
From Hand To Mouth (@pavlobaron)
From Hand To Mouth (@pavlobaron)From Hand To Mouth (@pavlobaron)
From Hand To Mouth (@pavlobaron)Pavlo Baron
 
The Big Data Developer (@pavlobaron)
The Big Data Developer (@pavlobaron)The Big Data Developer (@pavlobaron)
The Big Data Developer (@pavlobaron)Pavlo Baron
 
What can be done with Java, but should better be done with Erlang (@pavlobaron)
What can be done with Java, but should better be done with Erlang (@pavlobaron)What can be done with Java, but should better be done with Erlang (@pavlobaron)
What can be done with Java, but should better be done with Erlang (@pavlobaron)Pavlo Baron
 
20 reasons why we don't need architects (@pavlobaron)
20 reasons why we don't need architects (@pavlobaron)20 reasons why we don't need architects (@pavlobaron)
20 reasons why we don't need architects (@pavlobaron)Pavlo Baron
 
NoSQL - how it works (@pavlobaron)
NoSQL - how it works (@pavlobaron)NoSQL - how it works (@pavlobaron)
NoSQL - how it works (@pavlobaron)Pavlo Baron
 
The Agile Alibi (Pavlo Baron)
The Agile Alibi (Pavlo Baron)The Agile Alibi (Pavlo Baron)
The Agile Alibi (Pavlo Baron)Pavlo Baron
 
Harry Potter and Enormous Data (Pavlo Baron)
Harry Potter and Enormous Data (Pavlo Baron)Harry Potter and Enormous Data (Pavlo Baron)
Harry Potter and Enormous Data (Pavlo Baron)Pavlo Baron
 

More from Pavlo Baron (20)

Why we do tech the way we do tech now (@pavlobaron)
Why we do tech the way we do tech now (@pavlobaron)Why we do tech the way we do tech now (@pavlobaron)
Why we do tech the way we do tech now (@pavlobaron)
 
Qcon2015 living database
Qcon2015 living databaseQcon2015 living database
Qcon2015 living database
 
Becoming reactive without overreacting (@pavlobaron)
Becoming reactive without overreacting (@pavlobaron)Becoming reactive without overreacting (@pavlobaron)
Becoming reactive without overreacting (@pavlobaron)
 
The hidden costs of the parallel world (@pavlobaron)
The hidden costs of the parallel world (@pavlobaron)The hidden costs of the parallel world (@pavlobaron)
The hidden costs of the parallel world (@pavlobaron)
 
data, ..., profit (@pavlobaron)
data, ..., profit (@pavlobaron)data, ..., profit (@pavlobaron)
data, ..., profit (@pavlobaron)
 
Data on its way to history, interrupted by analytics and silicon (@pavlobaron)
Data on its way to history, interrupted by analytics and silicon (@pavlobaron)Data on its way to history, interrupted by analytics and silicon (@pavlobaron)
Data on its way to history, interrupted by analytics and silicon (@pavlobaron)
 
(Functional) reactive programming (@pavlobaron)
(Functional) reactive programming (@pavlobaron)(Functional) reactive programming (@pavlobaron)
(Functional) reactive programming (@pavlobaron)
 
Near realtime analytics - technology choice (@pavlobaron)
Near realtime analytics - technology choice (@pavlobaron)Near realtime analytics - technology choice (@pavlobaron)
Near realtime analytics - technology choice (@pavlobaron)
 
Set this Big Data technology zoo in order (@pavlobaron)
Set this Big Data technology zoo in order (@pavlobaron)Set this Big Data technology zoo in order (@pavlobaron)
Set this Big Data technology zoo in order (@pavlobaron)
 
a Tech guy’s take on Big Data business cases (@pavlobaron)
a Tech guy’s take on Big Data business cases (@pavlobaron)a Tech guy’s take on Big Data business cases (@pavlobaron)
a Tech guy’s take on Big Data business cases (@pavlobaron)
 
Diving into Erlang is a one-way ticket (@pavlobaron)
Diving into Erlang is a one-way ticket (@pavlobaron)Diving into Erlang is a one-way ticket (@pavlobaron)
Diving into Erlang is a one-way ticket (@pavlobaron)
 
Dynamo concepts in depth (@pavlobaron)
Dynamo concepts in depth (@pavlobaron)Dynamo concepts in depth (@pavlobaron)
Dynamo concepts in depth (@pavlobaron)
 
Chef's Coffee - provisioning Java applications with Chef (@pavlobaron)
Chef's Coffee - provisioning Java applications with Chef (@pavlobaron)Chef's Coffee - provisioning Java applications with Chef (@pavlobaron)
Chef's Coffee - provisioning Java applications with Chef (@pavlobaron)
 
From Hand To Mouth (@pavlobaron)
From Hand To Mouth (@pavlobaron)From Hand To Mouth (@pavlobaron)
From Hand To Mouth (@pavlobaron)
 
The Big Data Developer (@pavlobaron)
The Big Data Developer (@pavlobaron)The Big Data Developer (@pavlobaron)
The Big Data Developer (@pavlobaron)
 
What can be done with Java, but should better be done with Erlang (@pavlobaron)
What can be done with Java, but should better be done with Erlang (@pavlobaron)What can be done with Java, but should better be done with Erlang (@pavlobaron)
What can be done with Java, but should better be done with Erlang (@pavlobaron)
 
20 reasons why we don't need architects (@pavlobaron)
20 reasons why we don't need architects (@pavlobaron)20 reasons why we don't need architects (@pavlobaron)
20 reasons why we don't need architects (@pavlobaron)
 
NoSQL - how it works (@pavlobaron)
NoSQL - how it works (@pavlobaron)NoSQL - how it works (@pavlobaron)
NoSQL - how it works (@pavlobaron)
 
The Agile Alibi (Pavlo Baron)
The Agile Alibi (Pavlo Baron)The Agile Alibi (Pavlo Baron)
The Agile Alibi (Pavlo Baron)
 
Harry Potter and Enormous Data (Pavlo Baron)
Harry Potter and Enormous Data (Pavlo Baron)Harry Potter and Enormous Data (Pavlo Baron)
Harry Potter and Enormous Data (Pavlo Baron)
 

Recently uploaded

Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Nikki Chapple
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesBernd Ruecker
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructureitnewsafrica
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkPixlogix Infotech
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 

Recently uploaded (20)

Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architectures
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App Framework
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 

Let It Crash (@pavlobaron)

  • 1. _LET_IT_CRASH_ *** Pavlo Baron, OOP‘12
  • 2. The Blue Screen Of Death (BSOD) used as background in this presentation has been friendly provided by Microsoft Windows
  • 4. Do you know _MURPHY_? You should, since he’s developing your software, deploying and releasing, testing and using it. He’s also designing and operating the whole hardware your programs are running on
  • 5. Everything that _CAN_ go wrong _WILL_ go wrong (Murphy’s Law)
  • 6. The very question is: do you _REALLY_ know everything that can go wrong?
  • 7. You can cover your cleaner bottle with hazard symbols, and still there will be a genius who will clean his teeth with it
  • 8. Or in topic relevant terms, look at this line of code: C = A / B
  • 9.
  • 10. Was it all? No, there’s more: 5. C assumed to be a string 6. C gets overwritten 7. A, B, C not thread safe 8. C = 0 through rounding 9. this is copy/paste code . . . C = A / B
  • 11. And that’s just one LOC. Now imagine the explosion with every further LOC
  • 12. Your primary instinct is to protect yourself from things going wrong…
  • 13. … through attempting to prevent things from going wrong
  • 14. _DEFENSIVE_PROGRAMMING_ is what they taught us to do: critical if (isnum(A) and isnum(B) and (A > B * 10) and (B > 0)) try C = A / B catch (DivisionByZero) …
  • 15. And of course you will omit the one which will crash the whole thing
  • 16. So what you sometimes are trying to do is: catch (WrongStellarConstellation) //move stars catch (WrongSunPosition) //move after the sun catch (Angle45DegreeToHorizon) //run for your life catch (*) //just for the case
  • 17. You’re hounding _MURPHY_. Btw.: did you already check your payroll? Maybe you’ll find him there
  • 18. Do you imply I’m stupid? Wanna fight?
  • 19. No. I just suggest to let go of trying to achieve the impossible
  • 20. It is _HARD_TO_FORESEE_ every eventuality
  • 21. It is _IMPOSSIBLE_TO_FORESEE_ every eventuality dealing with big data amounts and huge event numbers
  • 22. It is wrong to catch all eventualities in a generic _ERROR_HANDLER_OF_FEAR_
  • 23. _DYNAMICALLY_TYPED_ languages have much more potential to introduce unpredictable data constellations
  • 24. _WEB_BASED_APPLICATIONS_ come up with the user generated content which is completely unpredictable
  • 25. _HARDWARE_ is unreliable. Accept. Period.
  • 26. _NETWORKS_ are unreliable. Accept. Period.
  • 27. Error handling code makes your source code _UNREADABLE_ and _UNMAINTAINABLE_
  • 28. Why would you think that the error handling code is _FREE_FROM_ERRORS_?
  • 29. Of course, your _TEST_COVERAGE_ is extremely high, especially for the error handling code
  • 30. Or, alternatively, your programs are just completely free from bugs
  • 31. This is a typical, complete, wholly bug-free program: begin end
  • 32. Aha. So what should I do instead?
  • 33.
  • 35. _YOU_NEED_ “ Virtual” processing units much smaller than your OS’s processes / threads Their cheapness pays off when they get scheduled through zero/minimal context switching and possibility to run 100’000s of them in one single VM instance
  • 37. _YOU_NEED_ A virtual machine to run these actors, to schedule them, to control resources
  • 38. _YOU_NEED_ Mechanisms in your VM to protect and isolate single actors from each other and the whole VM from the actors Actors must pass messages instead of sharing resources in order to minimize dependencies
  • 39. _YOU_NEED_ A very high level of actor isolation
  • 40. _YOU_NEED_ To be able to externalize actor’s state Actors get their state from some storage / another actor with every new “call” and return a modified state for further storage
  • 41. _YOU_NEED_ An onion alike, layered model When an actor crashes, another one still “stores” its state and can pass it on to a new actor
  • 42. _YOU_NEED_ Ideally a functional programming approach There, you can only apply state from outside and get back a modified one
  • 43. _YOU_NEED_ Mechanisms which allow an actor to automatically get informed when an other actor crashes Also mechanisms to link actors together so they “die” together
  • 44. _YOU_NEED_ Linking (and monitoring) mechanisms
  • 45. _YOU_NEED_ Worker actors just doing some job. They can crash, but might get restarted at the point of crash to go on
  • 46. _YOU_NEED_ Supervisor actors only monitoring other actors, killing, restarting them, providing them their external state
  • 47. _YOU_NEED_ Hierarchies / trees of workers and supervisors, with branches being configured differently
  • 48. _YOU_NEED_ An automated strategy configuration for how to start workers, how to deal with crashes, how often etc.
  • 49. Aha. And where can I get it for free?
  • 50. Erlang/OTP (the heart of Joe’s thesis) can do it all
  • 51. Spawn / register / message passing register(?MODULE, spawn(?MODULE, loop, [])), ?MODULE ! {start}.
  • 52. Linking / trapping exits register(?MODULE, spawn_link(?MODULE, loop, [])), ?MODULE ! {start}. ... loop() -> receive {start} -> process_flag(trap_exit, true), loop(); {'EXIT', _Pid, stop} -> ...
  • 53. Monitoring erlang:monitor(process, From), ... loop() -> receive {'DOWN', _Ref, process, Pid, Reason} -> ...
  • 54. Worker / Supervisor -behaviour(supervisor). ... init(Args) -> {ok, {{one_for_one, 2, 10}, [ {the_server, {test_server, start_link, [Args]}, permanent, 2000, worker, [test_server]} ]}}.
  • 55. Worker state externalization -behaviour(gen_server). ... init(Args) -> ... State = #state{id = Id, session_id = SessionId}, {ok, State}. ... handle_cast(stop, State) -> dr_session:stop( State#state.session_id), {noreply, State};
  • 56. Same approach works (with minimal modifications) not only on one node, but on several nodes and even distributed over a network. That allows building true fault-tolerant systems
  • 57. Erlang was invented to program switches, control networks etc. It’s been designed for the mentioned hardware and network “ reliability”
  • 58. Erjang - Erlang VM “ on top“ of the JVM – can do this, too
  • 59. And Scala/Akka can also do this on the JVM
  • 60. Linking // link and unlink actors self.link(actorRef) self.unlink(actorRef) // starts and links Actors atomically self.startLink(actorRef) // spawns (creates and starts) actors self.spawn[MyActor] self.spawnRemote[MyActor] // spawns and links Actors atomically self.spawnLink[MyActor] self.spawnLinkRemote[MyActor]
  • 61. Worker / supervisor val supervisor = Supervisor( SupervisorConfig( AllForOneStrategy( List(classOf[Exception]),3,1000), Supervise( actorOf[MyActor1], Permanent) :: Supervise( actorOf[MyActor2], Permanent) :: Nil))
  • 62. What’s the catch? There must be one – I can’t simply build upon crashing
  • 63. Right. There’s no such thing as a free lunch
  • 64. _ASK_YOURSELF_ Should I handle this error? Defensive programming and “let it crash” philosophy must not exclude each other
  • 65. _ASK_YOURSELF_ How should I handle this error? Throw an exception? Return a value? Ignore? Write a log? Terminate the program?
  • 66. _ASK_YOURSELF_ Can I terminate / crash here? Do I have to go on? Can I go on from here at all?
  • 67. _ASK_YOURSELF_ Can I leave some garbage after I crash? Do I have to clean up before / after I do?
  • 68. _ASK_YOURSELF_ When I restart a worker, how can I know it doesn’t crash again, and again?..
  • 69. _ASK_YOURSELF_ Why do I expect wrong function parameters? Don’t I trust my own non-API calls? Shouldn’t I fix this outside?
  • 70. _ASK_YOURSELF_ When should I prefer in-place error handlers? When should I better go for a central error handler knowing about all types of possible errors?
  • 71. _ASK_YOURSELF_ Do I have to check parameter types? Do I have to generally check the semantics of the API function parameters, implement a contract?
  • 72. With all this in mind: Don’t program too defensively. _LET_IT_CRASH_
  • 74. Presentation inspired by the work of Joe Armstrong, Steve Vinoski, Mazen Harake, Jonas Bonér and Kresten Krab Thorup Most images originate from istockphoto.com except few ones taken from Wikipedia and product pages