ebook img

Death by Accidental Complexity PDF

37 Pages·2010·1.72 MB·English
by  
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Death by Accidental Complexity

Erlang Solutions Ltd Death by Accidental Complexity QCon London, March 12, 2010 Ulf Wiger, CTO Erlang Solutions Ltd. Ulf Wiger [email protected] Brain-dead concurrency (cid:1) A.k.a. Embarrassingly Parallel (cid:1) E.g. Plain web server (cid:2) Minimal dependencies, request/reply pattern Copyright 2010 – Erlang Solutions Ltd Mind-blowing concurrency (cid:1) Complex, multi-way signalling (cid:1) Multiple failure domains Presence Billing Registry Gateway/broker Copyright 2010 – Erlang Solutions Ltd Natural product evolution (cid:1) From simple to more complex (cid:1) Structuring and encapsulation should allow us to support this Copyright 2010 – Erlang Solutions Ltd Message ordering (1) (cid:1) All messages from A to B must arrive in the same order as they were sent. A B a3 a2 a1 a1 a2 a3 Copyright 2010 – Erlang Solutions Ltd Message ordering (2) (cid:1) Oft forgotten rule: (cid:2) The language should not force a specific global order upon the programmer C (cid:1) Common (naïve) iimmpplleemmeennttaattiioonn:: AA BB a3 a2 a1 (cid:2) Event loop dispatches in order of arrival a1 (cid:2) Easy to implement c1 (cid:2) But forces the programmer to deal with a2 all possible orderings of events a3 c2 c3 Copyright 2010 – Erlang Solutions Ltd Selective Message Reception (cid:1) (cid:1) Separate message queues One queue per process (cid:2) (cid:2) Ability to select msgs + ability to select msgs out of order out of order C CC A B a3 a2 a1 A B a1 a3 a2 a1 c1 a1 a2 Ch 1 a2 c1 a3 a3 c2 Ch 2 c2 c3 c3 Copyright 2010 – Erlang Solutions Ltd Session Broker Scenario Telecom ”Half-Call” model One or more stateful processes Control/Charging, ... Interaction with multiple uncoordinated message sources MMeessssaaggee sseeqquueenncceess mmaayy AA BB (and invariably will) interleave Resources A = originating side B = terminating side Copyright 2010 – Erlang Solutions Ltd Programming Experiment ”POTS”: Plain Ordinary Demo system used in Ericsson’s Telephony System – Introductory Erlang Course Trivial schoolbook (cid:2) assignment: write a control program example of telephony for a POTS subscriber loop (as simple as it gets) We will re-write the control lloooopp uussiinngg ddiiffffeerreenntt sseemmaannttiiccss.. (cid:2) Selective message passing (cid:2) Event dispatch Note well: no error handling (usually the most complex part) http://github.com/uwiger/pots Demo... Copyright 2010 – Erlang Solutions Ltd Erlang – two approaches Event-based programming Selective receive FSM loop(Module, S) -> call(Server, Request) -> receive Server ! {call, self(), Request}, Msg -> % matches any message receive S1 = Module:event(Msg, S), {Server, reply, Reply} -> lloooopp((MMoodduullee,, SS11)) RReeppllyy end. after 5000 -> % milliseconds exit(timeout) end. We can use Erlang syntax to illustrate both models (hooray!!) Copyright 2010 – Erlang Solutions Ltd

Description:
Programming Experiment. Demo system used in Ericsson's. Introductory Erlang Course. ▫ assignment: write a control program for a POTS subscriber
See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.