IV P E R K 1 S X T Jw fshjxht Gjxfw n sn Erlang - - PowerPoint PPT Presentation

iv p e r k 1 s x t
SMART_READER_LITE
LIVE PREVIEW

IV P E R K 1 S X T Jw fshjxht Gjxfw n sn Erlang - - PowerPoint PPT Presentation

FRANCESCO CESARINI presents IV P E R K 1 S X T Jw fshjxht Gjxfw n sn Erlang Solutions @FrancescoC francesco@erlang-solutions.com www.erlang-solutions.com W HAT I S S CALABILITY ? W HAT I S ( MASSIVE ) C ONCURRENCY ? W HAT I S H IGH


slide-1
SLIDE 1

IV P E R K 1 S X T

presents

FRANCESCO CESARINI

Jw fshjxht Gjxfw n sn Erlang Solutions @FrancescoC francesco@erlang-solutions.com www.erlang-solutions.com

slide-2
SLIDE 2
slide-3
SLIDE 3

WHAT IS SCALABILITY?

slide-4
SLIDE 4
slide-5
SLIDE 5

WHAT IS (MASSIVE) CONCURRENCY?

slide-6
SLIDE 6
slide-7
SLIDE 7

WHAT IS HIGH AVAILABILITY?

slide-8
SLIDE 8
slide-9
SLIDE 9

WHAT IS FAULT TOLERANCE?

slide-10
SLIDE 10
slide-11
SLIDE 11

WHAT IS DISTRIBUTION TRANSPARENCY?

slide-12
SLIDE 12
slide-13
SLIDE 13

YES, PLEASE!!!

Do you need a distributed system? Do you need a scalable system? Do you need a reliable system? Do you need a fault-tolerant system? Do you need a massively concurrent system? Do you need a distributed system? Do you need a scalable system? Do you need a reliable system? Do you need a fault-tolerant system? Do distributed system? Do you need a scalable system? Do you need a reliable system? Do you need a fault-tolerant system? Do you need a massively

slide-14
SLIDE 14

TO THE RESCUE

slide-15
SLIDE 15
  • OPEN SOURCE
  • CONCURRENCY-ORIENTED
  • LIGHTWEIGHT PROCESSES
  • ASYNCHRONOUS MESSAGE PASSING
  • SHARE-NOTHING MODEL
  • PROCESS LINKING / MONITORING
  • SUPERVISION TREES AND RECOVERY STRATEGIES
  • TRANSPARENT DISTRIBUTION MODEL
  • SOFT-REAL TIME
  • LET-IT-FAIL PHILOSOPHY
  • HOT-CODE UPGRADES

WHAT IS ERLANG

slide-16
SLIDE 16

WELL, IN FACT YOU NEED MORE.

slide-17
SLIDE 17

ERLANG IS JUST A PROGRAMMING LANGUAGE.

slide-18
SLIDE 18

YOU NEED ARCHITECTURE PATTERNS. YOU NEED MIDDLEWARE. YOU NEED LIBRARIES. YOU NEED TOOLS.

slide-19
SLIDE 19

YOU NEED OTP.

slide-20
SLIDE 20

SOME TEXT

slide-21
SLIDE 21

WHAT IS MIDDLEWARE?

slide-22
SLIDE 22

Q M H H P I[ E V I

DESIGN PATTERNS FAULT TOLERANCE DISTRIBUTION UPGRADES PACKAGING

slide-23
SLIDE 23

WHAT ARE LIBRARIES?

slide-24
SLIDE 24

P M F V E V M IW

STORAGE O&M INTERFACES COMMUNICATION

slide-25
SLIDE 25

WHAT TOOLS?

slide-26
SLIDE 26

S X T X S S P W

DEVELOPMENT TEST FRAMEWORKS RELEASE & DEPLOYMENT DEBUGGING & MONITORING

slide-27
SLIDE 27

PART OF THE ERLANG DISTRIBUTION OPEN SOURCE

OTP IS

slide-28
SLIDE 28

OTP

Servers Finite State Machines Event Handlers Supervisors Applications Less Code Less Bugs More Solid Code More Tested Code More Free Time

slide-29
SLIDE 29

Your Heading

slide-30
SLIDE 30

Let It Fail

convert(Day) -> case Day of monday -> 1; tuesday -> 2; wednesday -> 3; thursday -> 4; friday -> 5; saturday -> 6; sunday -> 7; Other -> {error, unknown_day} end.

slide-31
SLIDE 31

Let It Fail

convert(Day) -> case Day of monday -> 1; tuesday -> 2; wednesday -> 3; thursday -> 4; friday -> 5; saturday -> 6; sunday -> 7; end.

slide-32
SLIDE 32

ISOLATE THE ERROR!

slide-33
SLIDE 33

PROPAGATING EXIT SIGNALS

Exit Signals

PidA PidB {'EXIT', PidA, Reason} PidC {'EXIT', PidB, Reason}

slide-34
SLIDE 34

Trap Exit

TRAPPING AN EXIT SIGNAL

PidA {'EXIT', PidA, Reason} PidC PidB

slide-35
SLIDE 35

Supervisors

PidA PidC PidB

Supervisor Workers Application

slide-36
SLIDE 36

Releases

Release

Mongoose

IM

folsom

lager snmp mnesia stdlib SASL kernel

ERTS

slide-37
SLIDE 37

BEHAVIOURS

slide-38
SLIDE 38

SPECIFIC CALLBACK MODULE GENERIC BEHAVIOUR MODULE

W jw |jw

process

slide-39
SLIDE 39

OTP

Servers Finite State Machines Event Handlers Supervisors Applications Less Code Less Bugs More Solid Code More Tested Code More Free Time

slide-40
SLIDE 40

call(Name, Message) -> Name ! {request, self(), Message}, receive {reply, Reply} -> Reply end. reply(Pid, Reply) -> Pid ! {reply, Reply}.

Client Server {request, Pid, Message} {reply, Reply}

slide-41
SLIDE 41

Client Server {request, Pid, Message} {reply, Reply} Server 2 {reply, Reply}

call(Name, Msg) -> Ref = make_ref(), Name ! {request, {Ref, self()}, Msg}, receive {reply, Ref, Reply} -> Reply end. reply({Ref, Pid}, Reply) -> Pid ! {reply, Ref, Reply}.

{request, {Ref, self()}, Message} {reply, Ref, Reply} {reply, ???, Reply}

slide-42
SLIDE 42

PidA PidB

{request, {Ref, PidA}, Msg} call(Name, Msg) -> Ref = erlang:monitor(process, Name), Name ! {request, {Ref, self()}, Msg}, receive

  • {reply, Ref, Reply} ->
  • erlang:demonitor(Ref),
  • Reply;
  • {'DOWN', Ref, process, _Name, _Reason} ->
  • {error, no_proc}

end.

slide-43
SLIDE 43

PidA PidB

{request, {Ref, PidA}, Msg} call(Name, Msg) -> Ref = erlang:monitor(process, Name), Name ! {request, {Ref, self()}, Msg}, receive

  • {reply, Ref, Reply} ->
  • erlang:demonitor(Ref, [flush]),
  • Reply;
  • {'DOWN', Ref, process, _Name, _Reason} ->
  • {error, no_proc}

end. {reply, Ref, Reply} {'DOWN', Ref, process, PidB, Reason}

slide-44
SLIDE 44

F IL E Z M S Y V W

TIMEOUTS DEADLOCKS

TRACING

MONITORING DISTRIBUTION

slide-45
SLIDE 45

AUTOMATIC TAKEOVER AND FAILOVER

slide-46
SLIDE 46

N1

{myApp, 2000, {n1@host, {n2@host, n3@host}]}

N2 N3

Application Master Application n1@host dies Application Masters on failover nodes

slide-47
SLIDE 47

N2 N3

n2@host dies Application is restarted on n2@host {myApp, 2000, {n1@host, {n2@host, n3@host}]}

slide-48
SLIDE 48

N1 N3

n1@host comes back up Application is restarted on n3@host {myApp, 2000, {n1@host, {n2@host, n3@host}]}

slide-49
SLIDE 49

N1 N3

N1 takes over N3 {myApp, 2000, {n1@host, {n2@host, n3@host}]}

slide-50
SLIDE 50

RELEASE STATEMENT OF AIMS

“To scale the radical concurrency-oriented programming paradigm to build reliable general-purpose software, such as server- based systems, on massively parallel machines (10^5 cores).”

slide-51
SLIDE 51

The Runtime Queues

Erlang VM Scheduler #1 Scheduler #2 run queue Scheduler #2 Scheduler #N run queue run queue

migration logic migration logic

slide-52
SLIDE 52
slide-53
SLIDE 53

WP4 Scalable Infrastructure WP3 SD Erlang Language WP2 Virtual Machine WP5 Tools WP6 Case Studies

LIMITATIONS ARE PRESENT AT THREE LEVELS

slide-54
SLIDE 54
  • PUSH THE RESPONSIBILITY FOR SCALABILITY FROM THE PROGRAMMER TO THE VM
  • ANALYZE PERFORMANCE AND SCALABILITY
  • IDENTIFY BOTTLENECKS AND PRIORITIZE CHANGES AND EXTENSIONS
  • TACKLE WELL-KNOWN SCALABILITY ISSUES
  • ETS TABLES (SHARED GLOBAL DATA STRUCTURE)
  • MESSAGE PASSING, COPYING AND FREQUENTLY COMMUNICATING PROCESSES

VM LANGUAGE INFRASTRUCTURE

slide-55
SLIDE 55

VM LANGUAGE INFRASTRUCTURE

  • TWO MAJOR ISSUES
  • FULLY CONNECTED CLUSTERS
  • EXPLICIT PROCESS PLACEMENT
  • SCALABLE DISTRIBUTED (SD) ERLANG
  • NODES GROUPING
  • NON-TRANSITIVE CONNECTIONS
  • IMPLICIT PROCESS PLACEMENT
  • PART OF THE STANDARD ERLANG/OTP PACKAGE
  • NEW CONCEPTS INTRODUCED
  • LOCALITY, AFFINITY AND DISTANCE
slide-56
SLIDE 56
  • MIDDLEWARE LAYER
  • SET OF ERLANG APPLICATIONS
  • CREATE AND MANAGE CLUSTERS OF (HETEROGENEOUS) ERLANG NODES
  • API TO MONITOR AND CONTROL ERLANG DISTRIBUTED SYSTEMS
  • EXISTING TRACING/LOGGING/DEBUGGING TOOLS PLUGGABLE
  • BROKER LAYER BETWEEN USERS AND CLOUD PROVIDERS
  • AUTO-SCALING

VM LANGUAGE INFRASTRUCTURE

CCL /sɪˈsɪlɪ/

... AND MUCH MORE

slide-57
SLIDE 57

CONCLUSIONS

slide-58
SLIDE 58

USE ERLANG

Do you need a distributed system? Do you need a scalable system? Do you need a reliable system? Do you need a fault-tolerant system? Do you need a massively concurrent system? Do you need a distributed system? Do you need a scalable system? Do you need a reliable system? Do you need a fault-tolerant system? Do distributed system? Do you need a scalable system? Do you need a reliable system? Do you need a fault-tolerant system? Do you need a massively

slide-59
SLIDE 59

USE ERLANG/OTP

Do you need a distributed system? Do you need a scalable system? Do you need a reliable system? Do you need a fault-tolerant system? Do you need a massively concurrent system? Do you need a distributed system? Do you need a scalable system? Do you need a reliable system? Do you need a fault-tolerant system? Do distributed system? Do you need a scalable system? Do you need a reliable system? Do you need a fault-tolerant system? Do you need a massively

slide-60
SLIDE 60

@francescoC

QUESTIONS?