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
Elixir - Exploring actor-based systems
Search
Michał Muskała
September 23, 2017
Programming
1
95
Elixir - Exploring actor-based systems
Talk given at PartialConf 2017 in Sofia, Bulgaria
Michał Muskała
September 23, 2017
Tweet
Share
More Decks by Michał Muskała
See All by Michał Muskała
From Elixir to Erlang - Experience report
michalmuskala
0
54
What is the BEAM?
michalmuskala
0
67
Elixir & Ecosystem Update SF 2020
michalmuskala
0
31
Let there be light
michalmuskala
0
690
What actually is the BEAM?
michalmuskala
6
1.6k
Optimising for the BEAM
michalmuskala
2
660
Extending OTP with custom behaviours
michalmuskala
0
130
Abandoning models - embracing data
michalmuskala
0
200
Ecto - the past, the present, the future
michalmuskala
5
1.1k
Other Decks in Programming
See All in Programming
Nurturing OpenJDK distribution: Eclipse Temurin Success History and plan
ivargrimstad
0
300
Googleのテストサイズを活用したテスト環境の構築
toms74209200
0
300
OpenTelemetryでRailsのパフォーマンス分析を始めてみよう(KoR2024)
ymtdzzz
5
1.9k
推し活としてのrails new/oshikatsu_ha_iizo
sakahukamaki
3
2k
A Journey of Contribution and Collaboration in Open Source
ivargrimstad
0
300
デプロイを任されたので、教わった通りにデプロイしたら障害になった件 ~俺のやらかしを越えてゆけ~
techouse
53
33k
Hotwire or React? ~Reactの録画機能をHotwireに置き換えて得られた知見~ / hotwire_or_react
harunatsujita
8
4.8k
リリース8年目のサービスの1800個のERBファイルをViewComponentに移行した方法とその結果
katty0324
5
4.1k
プロジェクト新規参入者のリードタイム短縮の観点から見る、品質の高いコードとアーキテクチャを保つメリット
d_endo
1
1.1k
Server Driven Compose With Firebase
skydoves
0
430
Modern Angular: Renovation for Your Applications
manfredsteyer
PRO
0
240
受け取る人から提供する人になるということ
little_rubyist
0
170
Featured
See All Featured
RailsConf 2023
tenderlove
29
890
Gamification - CAS2011
davidbonilla
80
5k
A Philosophy of Restraint
colly
203
16k
The Power of CSS Pseudo Elements
geoffreycrofte
73
5.3k
Side Projects
sachag
452
42k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
Unsuck your backbone
ammeep
668
57k
A Tale of Four Properties
chriscoyier
156
23k
Raft: Consensus for Rubyists
vanstee
136
6.6k
Making Projects Easy
brettharned
115
5.9k
The Art of Programming - Codeland 2020
erikaheidi
52
13k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.1k
Transcript
ELIXIR Exploring actor-based systems
ELIXIR Exploring actor-based systems The good parts
THE COMMUNITY
None
MICHAŁ MUSKAŁA http://michal.muskala.eu/ https://github.com/michalmuskala/ @michalmuskala
http://omt.tech/ Orther Mulelid-Tynes Technology, Inc.
THE MODERN COMPUTING
None
None
ACTOR MODEL
Actor Model Communicating Sequential Processes π-calculus Software Transactional Memory
None
FUNCTIONAL PROGRAMMING
• Explicit state • Transformation instead of mutation
– José Valim “Functional programming is associated with concurrency but
it was not by design. It just happens that, by making the complex parts of our system explicit, solving more complicated issues like concurrency becomes much simpler.”
None
None
Switch Switch
Server Server Browser Endpoints Mobile
None
2 MILLION CONNECTIONS on a single server https://blog.whatsapp.com/196/1-million- is-so-2011
None
None
http://www.phoenixframework.org/blog/the-road-to-2-million-websocket-connections
ELIXIR CONCURRENT FUNCTIONAL
Sequential code
Sequential code Functional code
None
x1 = async_func1() x2 = async_func2(x1) x3 = async_func3(x2) x4
= async_func4(x3) x5 = async_func5(x4) x6 = async_func6(x5)
async_func1() |> async_func2() |> async_func3() |> async_func4() |> async_func5() |>
async_func6()
None
None
OTP
DB Web Mailer Websockets
DB Web Mailer Websockets Supervisor
Application
None
None
app1@node1 app1@node2
– Joe Armstrong “We do not have ONE web-server handling
2 millions sessions. We have 2 million webservers handling one session each.”
GOALS OF ELIXIR
THE GOALS OF ELIXIR • COMPATIBILITY • EXTENSIBILITY • PRODUCTIVITY
None
THE GOALS OF ELIXIR • COMPATIBILITY • EXTENSIBILITY • PRODUCTIVITY
THE GOALS OF ELIXIR • COMPATIBILITY • EXTENSIBILITY • PRODUCTIVITY
• PRODUCTIVITY • MAINTAINABILITY • RELIABILITY
COMPATIBILITY
https://elixir-lang.org/crash-course.html
EXTENSIBILITY
defmodule Test do use ExUnit.Case, async: true test "math works"
do assert 1 + 2 == 2 end end
None
from w in Weather, where: w.prcp <= 0.0 or is_nil(w.prcp),
order_by: w.city, select: w
defmacro if(condition, clauses) do optimize_boolean(quote do case unquote(condition) do x
when x in [false, nil] -> unquote(else_clause) _ -> unquote(do_clause) end end) end
PRODUCTIVITY
None
None
None
None
HEXDOCS • https://hexdocs.pm/elixir/String.html • https://hexdocs.pm/elixir/1.5.0/String.html • https://hexdocs.pm/phoenix/Phoenix.Channel.html • https://hexdocs.pm/phoenix/1.2.0/Phoenix.Channel.html
None
None
None
None
None
DEMO
MAINTAINABILITY
RELIABILITY
HOW DO I START?
elixir-lang.org
None
None
• http://elixir-lang.org • http://www.erlang.org • http://nerves-project.com • http://www.phoenixframework.org/
ELIXIR Exploring actor-based systems
None