Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Simplifying systems with Elixir - Belgrade
Search
Saša Jurić
October 25, 2018
Programming
3
430
Simplifying systems with Elixir - Belgrade
Saša Jurić
October 25, 2018
Tweet
Share
More Decks by Saša Jurić
See All by Saša Jurić
Such Great Heights, Code BEAM Lite, Amsterdam 2018
sasajuric
0
160
Simplifying systems with Elixir
sasajuric
2
560
Metagrokking Elixir
sasajuric
4
280
Solid Ground
sasajuric
15
1.2k
Solid Ground
sasajuric
3
840
Elixir - valentine edition
sasajuric
0
120
What's the fuss about Phoenix?
sasajuric
2
1k
Phoenix
sasajuric
1
210
Phoenix
sasajuric
0
110
Other Decks in Programming
See All in Programming
現場で役立つモデリング 超入門
masuda220
PRO
15
3.2k
よくできたテンプレート言語として TypeScript + JSX を利用する試み / Using TypeScript + JSX outside of Web Frontend #TSKaigiKansai
izumin5210
6
1.7k
シェーダーで魅せるMapLibreの動的ラスタータイル
satoshi7190
1
480
NSOutlineView何もわからん:( 前編 / I Don't Understand About NSOutlineView :( Pt. 1
usagimaru
0
330
「今のプロジェクトいろいろ大変なんですよ、app/services とかもあって……」/After Kaigi on Rails 2024 LT Night
junk0612
5
2.1k
PHP でアセンブリ言語のように書く技術
memory1994
PRO
1
170
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
100
見せてあげますよ、「本物のLaravel批判」ってやつを。
77web
7
7.7k
受け取る人から提供する人になるということ
little_rubyist
0
230
CSC509 Lecture 12
javiergs
PRO
0
160
subpath importsで始めるモック生活
10tera
0
300
Hotwire or React? ~アフタートーク・本編に含めなかった話~ / Hotwire or React? after talk
harunatsujita
1
120
Featured
See All Featured
Fireside Chat
paigeccino
34
3k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
506
140k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
16
2.1k
Product Roadmaps are Hard
iamctodd
PRO
49
11k
A Philosophy of Restraint
colly
203
16k
Designing on Purpose - Digital PM Summit 2013
jponch
115
7k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
25
1.8k
Into the Great Unknown - MozCon
thekraken
32
1.5k
How to train your dragon (web standard)
notwaldorf
88
5.7k
Typedesign – Prime Four
hannesfritz
40
2.4k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
720
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
109
49k
Transcript
Simplifying systems with Elixir @sasajuric aircloak.com
Elixir functional concurrent
process ... foo(...) bar(...) ...
functional Elixir modules and functions immutable data first-class functions
... spawn(fn -> ... end) ...
process A ... foo(...) bar(...) ... process B ... baz(...)
qux(...) ...
send( process_b, some_message ) receive do message -> handle(message) end
process a process b
BEAM (Erlang VM)
BEAM (Erlang VM)
scheduler scheduler scheduler scheduler BEAM (Erlang VM) CPU CPU CPU
CPU
concurrent functional
activities incoming requests background jobs in-memory state load control …
managing activities multiple OS processes 3rd party products service managers
None
None
uniformity simpler development simpler testing simpler deployment simpler maintenance improved
collaboration
None
theerlangelist.com
git clone https://github.com/sasa1977/erlangelist.git mix deps.get && pushd assets && npm
install && popd iex -S mix phx.server
None
serving requests
http listener https listener
http listener https listener handler 1 handler 2 handler n
…
usage stats
stats collector handler handler handler
stats collector disk writer
def store(path, data) do File.write!( path, :erlang.term_to_binary(data) ) end
def read(path, default) do path |> File.read!() |> :erlang.binary_to_term() rescue
ArgumentError -> default end
cleanup
scheduler cleanup job periodically starts
HTTPS
our system CA server certificate request challenge info challenge
certifier http server usage stats
dev CA server
service management
defmodule StatsCollector do def start_link() do # ... end #
... end
Supervisor.start_link( [ StatsCollector, Cleanup ], # .. )
supervisor stats collector cleanup
supervisor worker
1
1 2
1 2 3 4 5
1 2 6 9 7 8 3 4 5
erlangelist usage stats web
usage stats stats collector cleanup
web ACME server main site certifier
None
technical feature built-in options services GenServer, Task service manager Supervisor
service registry Registry k-v ets, mnesia web server phoenix, plug, cowboy periodical jobs :timer, quantum, periodic load regulation jobs, safetyvalve, sbroker concurrent flows Flow, GenStage
Elixir in a nutshell start simple go far
Elixir guides Phoenix guides Learning resources Elixir forum
40% off using code ctwelixirbg18 at manning.com slides available at
bit.ly/elixirbg102018