SlideShare uma empresa Scribd logo
1 de 106
Baixar para ler offline
ELIXIR OF LIFE
http://www.efeitmusic.com/efeitimages/Elixeroflife.jpg
Fabio Akita
ELIXIR OF LIFE
http://www.efeitmusic.com/efeitimages/Elixeroflife.jpg
@akitaonrails
0
1,000,000,000
2,000,000,000
3,000,000,000
4,000,000,000
5,000,000,000
6,000,000,000
7,000,000,000
8,000,000,000
1965 1970 1975 1980 1985 1990 1995 2000 2005 2010 2015 2020
Intel1Processors1Transistor1Count
Intel 4004
10 µm Intel 80386 Pentium
0.8 µm
Itanium 2
Six-core Xeon 7400
8-core Itanium Poulson
32 nm
18-core Xeon Haswell-E5
22 nm
15-core Xeon Ivy Bridge-EX
Duo-core + GPU Core i7 Broadwell-U
14 nm
Apple A7
Apple A8
Apple A8X
20 nm
Deveríamos estar em 9Ghz
16nm transistors
quantum tunneling leakage, 1-3nm
http://en.wikipedia.org/wiki/Quantum_tunnelling
EVENTOS!
Node + Express (8 x 200)
Node + Express (8 x 200)
Elixir + Phoenix (8 x 200)
Elixir + Phoenix (8 x 200)
Node + Express (1 x 10 + sleep(1))
Node + Express (1 x 10 + sleep(1))
Elixir + Phoenix (2 x 400 + sleep(1000))
Elixir + Phoenix (2 x 400 + sleep(1000))
LOW LATENCY
http://yarivsblog.blogspot.com.br/2008/05/erlang-vs-scala.html

Scala has two types of Actors: thread-based and event based. Thread based actors execute in heavyweight OS threads. They never block each other, but they don't
scale to more than a few thousand actors per VM. Event-based actors are simple objects. They are very lightweight, and, like Erlang processes, you can spawn millions
of them on a modern machine. The difference with Erlang processes is that within each OS thread, event based actors execute sequentially without preemptive
scheduling. This makes it possible for an event-based actor to block its OS thread for a long period of time (perhaps indefinitely).
começo de novembro

Rackspace 15 GB I/O v1 - these machines have 15GB RAM and 4 cores. Rackspace kindly let us use 3 of these servers for our benchmarks free of charge. 

OnMetal I/O which had 128GB RAM and showed 40 cores in htop.
começo de novembro

Rackspace 15 GB I/O v1 - these machines have 15GB RAM and 4 cores. Rackspace kindly let us use 3 of these servers for our benchmarks free of charge. 

OnMetal I/O which had 128GB RAM and showed 40 cores in htop.
CASES
“Since cut-over of the first nodes in British Telecom's network
in January 2002 only one minor fault has occurred, resulting in
99.9999999% availability.”
“The network performance has been so reliable that there is
almost a risk that our field engineers do not learn maintenance
skills.”
Bernt Nilsson - director of Ericsson’s Next Generation Systems program
http://www.erlang.org/download/armstrong_thesis_2003.pdf
BÁSICO …
iex --sname fabio --cookie secret_token

iex --sname akita --cookie secret_token

Node.list

Node.ping(:"akita@MacBook-Pro")

defmodule Greeting do

def say do

IO.puts "CALLED"

"Hello World from #{Node.self}"

end

end

:rpc.call(:"fabio@MacBook-Pro", Greeting, :say, [])

iex --name fabio@192.168.1.4 --cookie secret_token

iex --name akita@192.168.1.4 --cookie secret_token
iex --sname fabio --cookie secret_token

iex --sname akita --cookie secret_token

Node.list

Node.ping(:"akita@MacBook-Pro")

defmodule Greeting do

def say do

IO.puts "CALLED"

"Hello World from #{Node.self}"

end

end

:rpc.call(:"fabio@MacBook-Pro", Greeting, :say, [])

iex --name fabio@192.168.1.4 --cookie secret_token

iex --name akita@192.168.1.4 --cookie secret_token
PEER-TO-PEER
NETWORKING
Matching

a = 20

defmodule Teste do

def teste do

a = 40

IO.puts("Hello #{a}")

end

end

IO.puts(a)

a = 20

^a = 40

[a, b, c] = [a, 2, 3]

{:ok, message} = {:ok, "world"}

{:ok, [hello: message]} = {:ok, [hello: "world"]}
Matching

a = 20

defmodule Teste do

def teste do

a = 40

IO.puts("Hello #{a}")

end

end

IO.puts(a)

a = 20

^a = 40

[a, b, c] = [a, 2, 3]

{:ok, message} = {:ok, "world"}

{:ok, [hello: message]} = {:ok, [hello: "world"]}
PATTERN
MATCHING
Call by pattern

defmodule Greeting do

def hello([name: name]) do

"Hey, #{name}"

end

def hello([lastname: lastname]) do

"Hello, Mr #{lastname}"

end

end

Greeting.hello(name: "Fabio")

Greeting.hello(lastname: "Akita")
Call by pattern

defmodule Greeting do

def hello([name: name]) do

"Hey, #{name}"

end

def hello([lastname: lastname]) do

"Hello, Mr #{lastname}"

end

end

Greeting.hello(name: "Fabio")

Greeting.hello(lastname: "Akita")
CALL BY
PATTERN
Spawn

self

send(self, :hello)

flush

send(self, :hello)

receive do

:hello -> IO.puts("hello")

end

defmodule Bar do

def say do

receive do

{:ok, message} ->

IO.puts("Hello #{message}")

say

end

end

end
Spawn

self

send(self, :hello)

flush

send(self, :hello)

receive do

:hello -> IO.puts("hello")

end

defmodule Bar do

def say do

receive do

{:ok, message} ->

IO.puts("Hello #{message}")

say

end

end

end
PROCESS
(GREEN THREAD)
Green Thread = Co-Rotina que pode ser suspensa

2000 reduções

single thread por core/scheduler

1 run-queue
Processes

Process.list

defmodule Foo do

def counter(n) do

receive do

{:read, from} ->

send(from, n)

counter(n + 1)

end

end

end

pid = spawn(fn -> Foo.counter(2) end)

list = Enum.map((1..500_000), fn n ->

spawn(fn -> Foo.counter(n) end)

end)
Processes

Process.list

defmodule Foo do

def counter(n) do

receive do

{:read, from} ->

send(from, n)

counter(n + 1)

end

end

end

pid = spawn(fn -> Foo.counter(2) end)

list = Enum.map((1..500_000), fn n ->

spawn(fn -> Foo.counter(n) end)

end)
ASYNCHRONOUS
EXCEPTIONS
ESTADO IMUTAVEL

SEM ESTADO GLOBAL
ASYNCHRONOUS
EXCEPTIONS
ESTADO IMUTAVEL

SEM ESTADO GLOBAL
Trap Exits (http://eddwardo.github.io/elixir/links/2015/11/04/links-in-elixir/)

defmodule Foo do

def counter(n) do

receive do

{:read, from} ->

send(from, n)

counter(n + 1)

{:bla} ->

raise "I'm a bug!"

end

end

end

pid = spawn(fn -> Foo.counter(2) end)

Process.alive?(pid)

Process.link(pid)

Process.exit(pid, :kill)

pid = spawn(fn -> Foo.counter(2) end)
Trap Exits (http://eddwardo.github.io/elixir/links/2015/11/04/links-in-elixir/)

defmodule Foo do

def counter(n) do

receive do

{:read, from} ->

send(from, n)

counter(n + 1)

{:bla} ->

raise "I'm a bug!"

end

end

end

pid = spawn(fn -> Foo.counter(2) end)

Process.alive?(pid)

Process.link(pid)

Process.exit(pid, :kill)

pid = spawn(fn -> Foo.counter(2) end)
Observer/Schedulers

defmodule Foo do

def counter(n) do

receive do

{:read, from} ->

send(from, n)

counter(n + 1)

end

end

end

list = Enum.map((1..100_000), fn n ->

spawn(fn -> Foo.counter(n) end)

end)

Enum.each(list, fn pid -> Process.exit(pid, :kill) end)

defmodule Repeat do
Observer/Schedulers

defmodule Foo do

def counter(n) do

receive do

{:read, from} ->

send(from, n)

counter(n + 1)

end

end

end

list = Enum.map((1..100_000), fn n ->

spawn(fn -> Foo.counter(n) end)

end)

Enum.each(list, fn pid -> Process.exit(pid, :kill) end)

defmodule Repeat do
ACTORS!
GenServer Simple

defmodule Stack do

use GenServer

# Callbacks

def handle_call(:pop, _from, [head|tail]) do

{:reply, head, tail}

end

def handle_cast({:push, item}, state) do

{:noreply, [item|state]}

end

end

{:ok, pid} = GenServer.start_link(Stack, [:hello])

GenServer.call(pid, :pop)

GenServer.cast(pid, {:push, :world})

GenServer.cast(pid, {:push, :blabla})

GenServer.call(pid, :pop)
GenServer Simple

defmodule Stack do

use GenServer

# Callbacks

def handle_call(:pop, _from, [head|tail]) do

{:reply, head, tail}

end

def handle_cast({:push, item}, state) do

{:noreply, [item|state]}

end

end

{:ok, pid} = GenServer.start_link(Stack, [:hello])

GenServer.call(pid, :pop)

GenServer.cast(pid, {:push, :world})

GenServer.cast(pid, {:push, :blabla})

GenServer.call(pid, :pop)
defmodule Stack do

use GenServer

# Public API

def pop(server), do: GenServer.call(server, :pop)

def push(server, item), do: GenServer.cast(server, {:push, item})

# Callbacks

def handle_call(:pop, _from, [head|tail]) do

{:reply, head, tail}

end

def handle_cast({:push, item}, state) do

{:noreply, [item|state]}

end

end

{:ok, pid} = GenServer.start_link(Stack, ["John"])

Stack.push(pid, "Woo")
defmodule Stack do

use GenServer

# Public API

def pop(server), do: GenServer.call(server, :pop)

def push(server, item), do: GenServer.cast(server, {:push, item})

# Callbacks

def handle_call(:pop, _from, [head|tail]) do

{:reply, head, tail}

end

def handle_cast({:push, item}, state) do

{:noreply, [item|state]}

end

end

{:ok, pid} = GenServer.start_link(Stack, ["John"])

Stack.push(pid, "Woo")
GenServer Kill

defmodule Stack do

use GenServer

def start_link(state, opts  []) do

GenServer.start_link(__MODULE__, [state], name: __MODULE__)

end

def pop, do: GenServer.call(__MODULE__, :pop)

def push(item), do: GenServer.cast(__MODULE__, {:push, item})

# Callbacks

def handle_call(:pop, _from, [head|tail]) do

{:reply, head, tail}

end

def handle_cast({:push, item}, state) do

{:noreply, [item|state]}
GenServer Kill

defmodule Stack do

use GenServer

def start_link(state, opts  []) do

GenServer.start_link(__MODULE__, [state], name: __MODULE__)

end

def pop, do: GenServer.call(__MODULE__, :pop)

def push(item), do: GenServer.cast(__MODULE__, {:push, item})

# Callbacks

def handle_call(:pop, _from, [head|tail]) do

{:reply, head, tail}

end

def handle_cast({:push, item}, state) do

{:noreply, [item|state]}
Supervisor - Restart

defmodule StackSupervisor do

use Supervisor

def start_link do

Supervisor.start_link(__MODULE__, [])

end

def init([]) do

children = [

worker(Stack, ["hello"])

]

supervise(children, strategy: :one_for_one)

end

end

StackSupervisor.start_link
Supervisor - Restart

defmodule StackSupervisor do

use Supervisor

def start_link do

Supervisor.start_link(__MODULE__, [])

end

def init([]) do

children = [

worker(Stack, ["hello"])

]

supervise(children, strategy: :one_for_one)

end

end

StackSupervisor.start_link
SUPERVISOR TREE
(supervisor - supervisees/workers)
OTP
(Open Telecom Platform)
Phoenix - Observer

Applications - Micro Services
Phoenix - Observer

Applications - Micro Services
MICRO
“YOCTO”
SERVICES
(Micro > Nano > Pico > Femto > Atto > Zepto > Yocto)
• Map, Structs, Records, Comprehensions
• Map, Structs, Records, Comprehensions
• Testable Docs
• Map, Structs, Records, Comprehensions
• Testable Docs
• TypeSpecs/Behaviors
• Map, Structs, Records, Comprehensions
• Testable Docs
• TypeSpecs/Behaviors
• Agents/Tasks/GenEvent
• Map, Structs, Records, Comprehensions
• Testable Docs
• TypeSpecs/Behaviors
• Agents/Tasks/GenEvent
• Sigils/Macros/DSLs
• Map, Structs, Records, Comprehensions
• Testable Docs
• TypeSpecs/Behaviors
• Agents/Tasks/GenEvent
• Sigils/Macros/DSLs
• ETS/DETS/Mnesia
Javascript /
shared mutable global state
Blocking Event Loop
Rust /
Low Level
Async in progress
No coroutines
Go
Suture
(OTP Clone)
goroutines sem ID
shared mutable state
static signatures
Scala
Akka
(OTP Clone)
shared mutable state
static signatures
Clojure Pulsar / Quasar
Almost Erlang-like Process
JVM limitations
Go http://www.jerf.org/iri/post/2930

Scala http://yarivsblog.blogspot.com.br/2008/05/erlang-vs-scala.html

Clojure http://blog.paralleluniverse.co/2013/05/02/quasar-pulsar/

Scala has two types of Actors: thread-based and event based. Thread based actors execute in heavyweight OS threads. They never block each other, but they don't
scale to more than a few thousand actors per VM. Event-based actors are simple objects. They are very lightweight, and, like Erlang processes, you can spawn millions
of them on a modern machine. The difference with Erlang processes is that within each OS thread, event based actors execute sequentially without preemptive
scheduling. This makes it possible for an event-based actor to block its OS thread for a long period of time (perhaps indefinitely).
“quase” …
Erlang:
DONE!
(30 anos)
APRENDENDO
become@codeminer42.com
OBRIGADO

Mais conteúdo relacionado

Mais procurados

Technical architect kpi
Technical architect kpiTechnical architect kpi
Technical architect kpitomjonhss
 
Troubleshooting Native Memory Leaks in Java Applications
Troubleshooting Native Memory Leaks in Java ApplicationsTroubleshooting Native Memory Leaks in Java Applications
Troubleshooting Native Memory Leaks in Java ApplicationsPoonam Bajaj Parhar
 
Django congress jp 2019 make query great again! (slide share)
Django congress jp 2019 make query great again! (slide share)Django congress jp 2019 make query great again! (slide share)
Django congress jp 2019 make query great again! (slide share)dattun
 
Introduction to Acceptance Test Driven Development
Introduction to Acceptance Test Driven DevelopmentIntroduction to Acceptance Test Driven Development
Introduction to Acceptance Test Driven DevelopmentElisabeth Hendrickson
 
Scalable Django Architecture
Scalable Django ArchitectureScalable Django Architecture
Scalable Django ArchitectureRami Sayar
 
Introduction to GitHub, Open Source and Tech Article
Introduction to GitHub, Open Source and Tech ArticleIntroduction to GitHub, Open Source and Tech Article
Introduction to GitHub, Open Source and Tech ArticlePRIYATHAMDARISI
 
[오픈소스컨설팅] jira service desk 201908
[오픈소스컨설팅] jira service desk 201908[오픈소스컨설팅] jira service desk 201908
[오픈소스컨설팅] jira service desk 201908Open Source Consulting
 
nGrinder 3.0 : Load Test even kids can do
nGrinder 3.0 : Load Test even kids can donGrinder 3.0 : Load Test even kids can do
nGrinder 3.0 : Load Test even kids can doJunHo Yoon
 
RE tutorial user stories
RE tutorial user storiesRE tutorial user stories
RE tutorial user storiesGarm Lucassen
 
Behavior Driven Development (BDD) and Agile Testing
Behavior Driven Development (BDD) and Agile TestingBehavior Driven Development (BDD) and Agile Testing
Behavior Driven Development (BDD) and Agile Testingdversaci
 

Mais procurados (20)

Version control
Version controlVersion control
Version control
 
Technical architect kpi
Technical architect kpiTechnical architect kpi
Technical architect kpi
 
Troubleshooting Native Memory Leaks in Java Applications
Troubleshooting Native Memory Leaks in Java ApplicationsTroubleshooting Native Memory Leaks in Java Applications
Troubleshooting Native Memory Leaks in Java Applications
 
Django congress jp 2019 make query great again! (slide share)
Django congress jp 2019 make query great again! (slide share)Django congress jp 2019 make query great again! (slide share)
Django congress jp 2019 make query great again! (slide share)
 
Introduction to Acceptance Test Driven Development
Introduction to Acceptance Test Driven DevelopmentIntroduction to Acceptance Test Driven Development
Introduction to Acceptance Test Driven Development
 
Cursus phpunit
Cursus phpunitCursus phpunit
Cursus phpunit
 
BitBucket presentation
BitBucket presentationBitBucket presentation
BitBucket presentation
 
Scalable Django Architecture
Scalable Django ArchitectureScalable Django Architecture
Scalable Django Architecture
 
Introduction to GitHub, Open Source and Tech Article
Introduction to GitHub, Open Source and Tech ArticleIntroduction to GitHub, Open Source and Tech Article
Introduction to GitHub, Open Source and Tech Article
 
Flask for cs students
Flask for cs studentsFlask for cs students
Flask for cs students
 
SonarQube Presentation.pptx
SonarQube Presentation.pptxSonarQube Presentation.pptx
SonarQube Presentation.pptx
 
My JIRA patterns for Dashboards
My JIRA patterns for DashboardsMy JIRA patterns for Dashboards
My JIRA patterns for Dashboards
 
[오픈소스컨설팅] jira service desk 201908
[오픈소스컨설팅] jira service desk 201908[오픈소스컨설팅] jira service desk 201908
[오픈소스컨설팅] jira service desk 201908
 
nGrinder 3.0 : Load Test even kids can do
nGrinder 3.0 : Load Test even kids can donGrinder 3.0 : Load Test even kids can do
nGrinder 3.0 : Load Test even kids can do
 
Concourse webhook
Concourse webhookConcourse webhook
Concourse webhook
 
RE tutorial user stories
RE tutorial user storiesRE tutorial user stories
RE tutorial user stories
 
Selenium syllabus
Selenium syllabusSelenium syllabus
Selenium syllabus
 
Behavior Driven Development (BDD) and Agile Testing
Behavior Driven Development (BDD) and Agile TestingBehavior Driven Development (BDD) and Agile Testing
Behavior Driven Development (BDD) and Agile Testing
 
Git
GitGit
Git
 
Github
GithubGithub
Github
 

Semelhante a "Elixir of Life" - Dev In Santos

The Ring programming language version 1.9 book - Part 56 of 210
The Ring programming language version 1.9 book - Part 56 of 210The Ring programming language version 1.9 book - Part 56 of 210
The Ring programming language version 1.9 book - Part 56 of 210Mahmoud Samir Fayed
 
The Ring programming language version 1.5.4 book - Part 47 of 185
The Ring programming language version 1.5.4 book - Part 47 of 185The Ring programming language version 1.5.4 book - Part 47 of 185
The Ring programming language version 1.5.4 book - Part 47 of 185Mahmoud Samir Fayed
 
[2012 CodeEngn Conference 06] pwn3r - Secuinside 2012 CTF 예선 문제풀이
[2012 CodeEngn Conference 06] pwn3r - Secuinside 2012 CTF 예선 문제풀이[2012 CodeEngn Conference 06] pwn3r - Secuinside 2012 CTF 예선 문제풀이
[2012 CodeEngn Conference 06] pwn3r - Secuinside 2012 CTF 예선 문제풀이GangSeok Lee
 
Getting Started with Raspberry Pi - DCC 2013.1
Getting Started with Raspberry Pi - DCC 2013.1Getting Started with Raspberry Pi - DCC 2013.1
Getting Started with Raspberry Pi - DCC 2013.1Tom Paulus
 
Hands-on VeriFast with STM32 microcontroller @ Osaka
Hands-on VeriFast with STM32 microcontroller @ OsakaHands-on VeriFast with STM32 microcontroller @ Osaka
Hands-on VeriFast with STM32 microcontroller @ OsakaKiwamu Okabe
 
Setting packet tracer
Setting packet tracerSetting packet tracer
Setting packet tracerBadori San
 
Node.js - Advanced Basics
Node.js - Advanced BasicsNode.js - Advanced Basics
Node.js - Advanced BasicsDoug Jones
 
Using Smalltalk for controlling robotics systems
Using Smalltalk for controlling robotics systemsUsing Smalltalk for controlling robotics systems
Using Smalltalk for controlling robotics systemsSerge Stinckwich
 
Hadoop in a Box
Hadoop in a BoxHadoop in a Box
Hadoop in a BoxTim Lossen
 
Home Automation with Asterisk - Astricon 2015 - Alberto Sagredo Castro
Home Automation with Asterisk - Astricon 2015 - Alberto Sagredo CastroHome Automation with Asterisk - Astricon 2015 - Alberto Sagredo Castro
Home Automation with Asterisk - Astricon 2015 - Alberto Sagredo CastroAlberto Sagredo Castro
 
Hands-on VeriFast with STM32 microcontroller @ Nagoya
Hands-on VeriFast with STM32 microcontroller @ NagoyaHands-on VeriFast with STM32 microcontroller @ Nagoya
Hands-on VeriFast with STM32 microcontroller @ NagoyaKiwamu Okabe
 
The n00bs guide to ovs dpdk
The n00bs guide to ovs dpdkThe n00bs guide to ovs dpdk
The n00bs guide to ovs dpdkmarkdgray
 
Reverse Engineering Dojo: Enhancing Assembly Reading Skills
Reverse Engineering Dojo: Enhancing Assembly Reading SkillsReverse Engineering Dojo: Enhancing Assembly Reading Skills
Reverse Engineering Dojo: Enhancing Assembly Reading SkillsAsuka Nakajima
 
Arduino for Beginners
Arduino for BeginnersArduino for Beginners
Arduino for BeginnersSarwan Singh
 
Sample inventory report
Sample inventory reportSample inventory report
Sample inventory reportKamran Arshad
 
The Ring programming language version 1.5.3 book - Part 57 of 184
The Ring programming language version 1.5.3 book - Part 57 of 184The Ring programming language version 1.5.3 book - Part 57 of 184
The Ring programming language version 1.5.3 book - Part 57 of 184Mahmoud Samir Fayed
 

Semelhante a "Elixir of Life" - Dev In Santos (20)

The Ring programming language version 1.9 book - Part 56 of 210
The Ring programming language version 1.9 book - Part 56 of 210The Ring programming language version 1.9 book - Part 56 of 210
The Ring programming language version 1.9 book - Part 56 of 210
 
The Ring programming language version 1.5.4 book - Part 47 of 185
The Ring programming language version 1.5.4 book - Part 47 of 185The Ring programming language version 1.5.4 book - Part 47 of 185
The Ring programming language version 1.5.4 book - Part 47 of 185
 
[2012 CodeEngn Conference 06] pwn3r - Secuinside 2012 CTF 예선 문제풀이
[2012 CodeEngn Conference 06] pwn3r - Secuinside 2012 CTF 예선 문제풀이[2012 CodeEngn Conference 06] pwn3r - Secuinside 2012 CTF 예선 문제풀이
[2012 CodeEngn Conference 06] pwn3r - Secuinside 2012 CTF 예선 문제풀이
 
Getting Started with Raspberry Pi - DCC 2013.1
Getting Started with Raspberry Pi - DCC 2013.1Getting Started with Raspberry Pi - DCC 2013.1
Getting Started with Raspberry Pi - DCC 2013.1
 
Linux networking
Linux networkingLinux networking
Linux networking
 
Hands-on VeriFast with STM32 microcontroller @ Osaka
Hands-on VeriFast with STM32 microcontroller @ OsakaHands-on VeriFast with STM32 microcontroller @ Osaka
Hands-on VeriFast with STM32 microcontroller @ Osaka
 
Setting packet tracer
Setting packet tracerSetting packet tracer
Setting packet tracer
 
Node.js - Advanced Basics
Node.js - Advanced BasicsNode.js - Advanced Basics
Node.js - Advanced Basics
 
Using Smalltalk for controlling robotics systems
Using Smalltalk for controlling robotics systemsUsing Smalltalk for controlling robotics systems
Using Smalltalk for controlling robotics systems
 
Hadoop in a Box
Hadoop in a BoxHadoop in a Box
Hadoop in a Box
 
Home Automation with Asterisk - Astricon 2015 - Alberto Sagredo Castro
Home Automation with Asterisk - Astricon 2015 - Alberto Sagredo CastroHome Automation with Asterisk - Astricon 2015 - Alberto Sagredo Castro
Home Automation with Asterisk - Astricon 2015 - Alberto Sagredo Castro
 
Hands-on VeriFast with STM32 microcontroller @ Nagoya
Hands-on VeriFast with STM32 microcontroller @ NagoyaHands-on VeriFast with STM32 microcontroller @ Nagoya
Hands-on VeriFast with STM32 microcontroller @ Nagoya
 
The n00bs guide to ovs dpdk
The n00bs guide to ovs dpdkThe n00bs guide to ovs dpdk
The n00bs guide to ovs dpdk
 
Unix executable buffer overflow
Unix executable buffer overflowUnix executable buffer overflow
Unix executable buffer overflow
 
PNETLab.pdf
PNETLab.pdfPNETLab.pdf
PNETLab.pdf
 
FPBrno 2018-05-22: Benchmarking in elixir
FPBrno 2018-05-22: Benchmarking in elixirFPBrno 2018-05-22: Benchmarking in elixir
FPBrno 2018-05-22: Benchmarking in elixir
 
Reverse Engineering Dojo: Enhancing Assembly Reading Skills
Reverse Engineering Dojo: Enhancing Assembly Reading SkillsReverse Engineering Dojo: Enhancing Assembly Reading Skills
Reverse Engineering Dojo: Enhancing Assembly Reading Skills
 
Arduino for Beginners
Arduino for BeginnersArduino for Beginners
Arduino for Beginners
 
Sample inventory report
Sample inventory reportSample inventory report
Sample inventory report
 
The Ring programming language version 1.5.3 book - Part 57 of 184
The Ring programming language version 1.5.3 book - Part 57 of 184The Ring programming language version 1.5.3 book - Part 57 of 184
The Ring programming language version 1.5.3 book - Part 57 of 184
 

Mais de Fabio Akita

Devconf 2019 - São Carlos
Devconf 2019 - São CarlosDevconf 2019 - São Carlos
Devconf 2019 - São CarlosFabio Akita
 
Meetup Nerdzão - English Talk about Languages
Meetup Nerdzão  - English Talk about LanguagesMeetup Nerdzão  - English Talk about Languages
Meetup Nerdzão - English Talk about LanguagesFabio Akita
 
Desmistificando Blockchains p/ Developers - Criciuma Dev Conf 2018
Desmistificando Blockchains p/ Developers - Criciuma Dev Conf 2018Desmistificando Blockchains p/ Developers - Criciuma Dev Conf 2018
Desmistificando Blockchains p/ Developers - Criciuma Dev Conf 2018Fabio Akita
 
Desmistificando Blockchains - 20o Encontro Locaweb SP
Desmistificando Blockchains - 20o Encontro Locaweb SPDesmistificando Blockchains - 20o Encontro Locaweb SP
Desmistificando Blockchains - 20o Encontro Locaweb SPFabio Akita
 
Desmistificando Blockchains - Insiter Goiania
Desmistificando Blockchains - Insiter GoianiaDesmistificando Blockchains - Insiter Goiania
Desmistificando Blockchains - Insiter GoianiaFabio Akita
 
Blockchain em 7 minutos - 7Masters
Blockchain em 7 minutos - 7MastersBlockchain em 7 minutos - 7Masters
Blockchain em 7 minutos - 7MastersFabio Akita
 
Elixir -Tolerância a Falhas para Adultos - GDG Campinas
Elixir  -Tolerância a Falhas para Adultos - GDG CampinasElixir  -Tolerância a Falhas para Adultos - GDG Campinas
Elixir -Tolerância a Falhas para Adultos - GDG CampinasFabio Akita
 
Desmistificando Mitos de Tech Startups - Intercon 2017
Desmistificando Mitos de Tech Startups - Intercon 2017Desmistificando Mitos de Tech Startups - Intercon 2017
Desmistificando Mitos de Tech Startups - Intercon 2017Fabio Akita
 
30 Days to Elixir and Crystal and Back to Ruby
30 Days to Elixir and Crystal and Back to Ruby30 Days to Elixir and Crystal and Back to Ruby
30 Days to Elixir and Crystal and Back to RubyFabio Akita
 
Uma Discussão sobre a Carreira de TI
Uma Discussão sobre a Carreira de TIUma Discussão sobre a Carreira de TI
Uma Discussão sobre a Carreira de TIFabio Akita
 
THE CONF - Opening Keynote
THE CONF - Opening KeynoteTHE CONF - Opening Keynote
THE CONF - Opening KeynoteFabio Akita
 
A Journey through New Languages - Rancho Dev 2017
A Journey through New Languages - Rancho Dev 2017A Journey through New Languages - Rancho Dev 2017
A Journey through New Languages - Rancho Dev 2017Fabio Akita
 
Desmistificando Mitos de Startups - Sebrae - AP
Desmistificando Mitos de Startups - Sebrae - APDesmistificando Mitos de Startups - Sebrae - AP
Desmistificando Mitos de Startups - Sebrae - APFabio Akita
 
A Journey through New Languages - Guru Sorocaba 2017
A Journey through New Languages - Guru Sorocaba 2017A Journey through New Languages - Guru Sorocaba 2017
A Journey through New Languages - Guru Sorocaba 2017Fabio Akita
 
A Journey through New Languages - Insiter 2017
A Journey through New Languages - Insiter 2017A Journey through New Languages - Insiter 2017
A Journey through New Languages - Insiter 2017Fabio Akita
 
A Journey through New Languages - Locaweb Tech Day
A Journey through New Languages - Locaweb Tech DayA Journey through New Languages - Locaweb Tech Day
A Journey through New Languages - Locaweb Tech DayFabio Akita
 
A Journey through new Languages - Intercon 2016
A Journey through new Languages - Intercon 2016A Journey through new Languages - Intercon 2016
A Journey through new Languages - Intercon 2016Fabio Akita
 
Premature Optimization 2.0 - Intercon 2016
Premature Optimization 2.0 - Intercon 2016Premature Optimization 2.0 - Intercon 2016
Premature Optimization 2.0 - Intercon 2016Fabio Akita
 
Conexão Kinghost - Otimização Prematura
Conexão Kinghost - Otimização PrematuraConexão Kinghost - Otimização Prematura
Conexão Kinghost - Otimização PrematuraFabio Akita
 
The Open Commerce Conference - Premature Optimisation: The Root of All Evil
The Open Commerce Conference - Premature Optimisation: The Root of All EvilThe Open Commerce Conference - Premature Optimisation: The Root of All Evil
The Open Commerce Conference - Premature Optimisation: The Root of All EvilFabio Akita
 

Mais de Fabio Akita (20)

Devconf 2019 - São Carlos
Devconf 2019 - São CarlosDevconf 2019 - São Carlos
Devconf 2019 - São Carlos
 
Meetup Nerdzão - English Talk about Languages
Meetup Nerdzão  - English Talk about LanguagesMeetup Nerdzão  - English Talk about Languages
Meetup Nerdzão - English Talk about Languages
 
Desmistificando Blockchains p/ Developers - Criciuma Dev Conf 2018
Desmistificando Blockchains p/ Developers - Criciuma Dev Conf 2018Desmistificando Blockchains p/ Developers - Criciuma Dev Conf 2018
Desmistificando Blockchains p/ Developers - Criciuma Dev Conf 2018
 
Desmistificando Blockchains - 20o Encontro Locaweb SP
Desmistificando Blockchains - 20o Encontro Locaweb SPDesmistificando Blockchains - 20o Encontro Locaweb SP
Desmistificando Blockchains - 20o Encontro Locaweb SP
 
Desmistificando Blockchains - Insiter Goiania
Desmistificando Blockchains - Insiter GoianiaDesmistificando Blockchains - Insiter Goiania
Desmistificando Blockchains - Insiter Goiania
 
Blockchain em 7 minutos - 7Masters
Blockchain em 7 minutos - 7MastersBlockchain em 7 minutos - 7Masters
Blockchain em 7 minutos - 7Masters
 
Elixir -Tolerância a Falhas para Adultos - GDG Campinas
Elixir  -Tolerância a Falhas para Adultos - GDG CampinasElixir  -Tolerância a Falhas para Adultos - GDG Campinas
Elixir -Tolerância a Falhas para Adultos - GDG Campinas
 
Desmistificando Mitos de Tech Startups - Intercon 2017
Desmistificando Mitos de Tech Startups - Intercon 2017Desmistificando Mitos de Tech Startups - Intercon 2017
Desmistificando Mitos de Tech Startups - Intercon 2017
 
30 Days to Elixir and Crystal and Back to Ruby
30 Days to Elixir and Crystal and Back to Ruby30 Days to Elixir and Crystal and Back to Ruby
30 Days to Elixir and Crystal and Back to Ruby
 
Uma Discussão sobre a Carreira de TI
Uma Discussão sobre a Carreira de TIUma Discussão sobre a Carreira de TI
Uma Discussão sobre a Carreira de TI
 
THE CONF - Opening Keynote
THE CONF - Opening KeynoteTHE CONF - Opening Keynote
THE CONF - Opening Keynote
 
A Journey through New Languages - Rancho Dev 2017
A Journey through New Languages - Rancho Dev 2017A Journey through New Languages - Rancho Dev 2017
A Journey through New Languages - Rancho Dev 2017
 
Desmistificando Mitos de Startups - Sebrae - AP
Desmistificando Mitos de Startups - Sebrae - APDesmistificando Mitos de Startups - Sebrae - AP
Desmistificando Mitos de Startups - Sebrae - AP
 
A Journey through New Languages - Guru Sorocaba 2017
A Journey through New Languages - Guru Sorocaba 2017A Journey through New Languages - Guru Sorocaba 2017
A Journey through New Languages - Guru Sorocaba 2017
 
A Journey through New Languages - Insiter 2017
A Journey through New Languages - Insiter 2017A Journey through New Languages - Insiter 2017
A Journey through New Languages - Insiter 2017
 
A Journey through New Languages - Locaweb Tech Day
A Journey through New Languages - Locaweb Tech DayA Journey through New Languages - Locaweb Tech Day
A Journey through New Languages - Locaweb Tech Day
 
A Journey through new Languages - Intercon 2016
A Journey through new Languages - Intercon 2016A Journey through new Languages - Intercon 2016
A Journey through new Languages - Intercon 2016
 
Premature Optimization 2.0 - Intercon 2016
Premature Optimization 2.0 - Intercon 2016Premature Optimization 2.0 - Intercon 2016
Premature Optimization 2.0 - Intercon 2016
 
Conexão Kinghost - Otimização Prematura
Conexão Kinghost - Otimização PrematuraConexão Kinghost - Otimização Prematura
Conexão Kinghost - Otimização Prematura
 
The Open Commerce Conference - Premature Optimisation: The Root of All Evil
The Open Commerce Conference - Premature Optimisation: The Root of All EvilThe Open Commerce Conference - Premature Optimisation: The Root of All Evil
The Open Commerce Conference - Premature Optimisation: The Root of All Evil
 

Último

Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKJago de Vreede
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 

Último (20)

Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 

"Elixir of Life" - Dev In Santos

  • 2. Fabio Akita ELIXIR OF LIFE http://www.efeitmusic.com/efeitimages/Elixeroflife.jpg
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9. 0 1,000,000,000 2,000,000,000 3,000,000,000 4,000,000,000 5,000,000,000 6,000,000,000 7,000,000,000 8,000,000,000 1965 1970 1975 1980 1985 1990 1995 2000 2005 2010 2015 2020 Intel1Processors1Transistor1Count Intel 4004 10 µm Intel 80386 Pentium 0.8 µm Itanium 2 Six-core Xeon 7400 8-core Itanium Poulson 32 nm 18-core Xeon Haswell-E5 22 nm 15-core Xeon Ivy Bridge-EX Duo-core + GPU Core i7 Broadwell-U 14 nm Apple A7 Apple A8 Apple A8X 20 nm
  • 10. Deveríamos estar em 9Ghz 16nm transistors quantum tunneling leakage, 1-3nm http://en.wikipedia.org/wiki/Quantum_tunnelling
  • 11.
  • 13.
  • 14.
  • 15. Node + Express (8 x 200)
  • 16. Node + Express (8 x 200)
  • 17. Elixir + Phoenix (8 x 200)
  • 18. Elixir + Phoenix (8 x 200)
  • 19. Node + Express (1 x 10 + sleep(1))
  • 20. Node + Express (1 x 10 + sleep(1))
  • 21. Elixir + Phoenix (2 x 400 + sleep(1000))
  • 22. Elixir + Phoenix (2 x 400 + sleep(1000))
  • 23. LOW LATENCY http://yarivsblog.blogspot.com.br/2008/05/erlang-vs-scala.html Scala has two types of Actors: thread-based and event based. Thread based actors execute in heavyweight OS threads. They never block each other, but they don't scale to more than a few thousand actors per VM. Event-based actors are simple objects. They are very lightweight, and, like Erlang processes, you can spawn millions of them on a modern machine. The difference with Erlang processes is that within each OS thread, event based actors execute sequentially without preemptive scheduling. This makes it possible for an event-based actor to block its OS thread for a long period of time (perhaps indefinitely).
  • 24. começo de novembro Rackspace 15 GB I/O v1 - these machines have 15GB RAM and 4 cores. Rackspace kindly let us use 3 of these servers for our benchmarks free of charge. OnMetal I/O which had 128GB RAM and showed 40 cores in htop.
  • 25. começo de novembro Rackspace 15 GB I/O v1 - these machines have 15GB RAM and 4 cores. Rackspace kindly let us use 3 of these servers for our benchmarks free of charge. OnMetal I/O which had 128GB RAM and showed 40 cores in htop.
  • 26.
  • 27. CASES
  • 28.
  • 29. “Since cut-over of the first nodes in British Telecom's network in January 2002 only one minor fault has occurred, resulting in 99.9999999% availability.” “The network performance has been so reliable that there is almost a risk that our field engineers do not learn maintenance skills.” Bernt Nilsson - director of Ericsson’s Next Generation Systems program
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 41. iex --sname fabio --cookie secret_token iex --sname akita --cookie secret_token Node.list Node.ping(:"akita@MacBook-Pro") defmodule Greeting do def say do IO.puts "CALLED" "Hello World from #{Node.self}" end end :rpc.call(:"fabio@MacBook-Pro", Greeting, :say, []) iex --name fabio@192.168.1.4 --cookie secret_token iex --name akita@192.168.1.4 --cookie secret_token
  • 42. iex --sname fabio --cookie secret_token iex --sname akita --cookie secret_token Node.list Node.ping(:"akita@MacBook-Pro") defmodule Greeting do def say do IO.puts "CALLED" "Hello World from #{Node.self}" end end :rpc.call(:"fabio@MacBook-Pro", Greeting, :say, []) iex --name fabio@192.168.1.4 --cookie secret_token iex --name akita@192.168.1.4 --cookie secret_token
  • 44. Matching a = 20 defmodule Teste do def teste do a = 40 IO.puts("Hello #{a}") end end IO.puts(a) a = 20 ^a = 40 [a, b, c] = [a, 2, 3] {:ok, message} = {:ok, "world"} {:ok, [hello: message]} = {:ok, [hello: "world"]}
  • 45. Matching a = 20 defmodule Teste do def teste do a = 40 IO.puts("Hello #{a}") end end IO.puts(a) a = 20 ^a = 40 [a, b, c] = [a, 2, 3] {:ok, message} = {:ok, "world"} {:ok, [hello: message]} = {:ok, [hello: "world"]}
  • 47. Call by pattern defmodule Greeting do def hello([name: name]) do "Hey, #{name}" end def hello([lastname: lastname]) do "Hello, Mr #{lastname}" end end Greeting.hello(name: "Fabio") Greeting.hello(lastname: "Akita")
  • 48. Call by pattern defmodule Greeting do def hello([name: name]) do "Hey, #{name}" end def hello([lastname: lastname]) do "Hello, Mr #{lastname}" end end Greeting.hello(name: "Fabio") Greeting.hello(lastname: "Akita")
  • 50. Spawn self send(self, :hello) flush send(self, :hello) receive do :hello -> IO.puts("hello") end defmodule Bar do def say do receive do {:ok, message} -> IO.puts("Hello #{message}") say end end end
  • 51. Spawn self send(self, :hello) flush send(self, :hello) receive do :hello -> IO.puts("hello") end defmodule Bar do def say do receive do {:ok, message} -> IO.puts("Hello #{message}") say end end end
  • 52. PROCESS (GREEN THREAD) Green Thread = Co-Rotina que pode ser suspensa 2000 reduções single thread por core/scheduler 1 run-queue
  • 53. Processes Process.list defmodule Foo do def counter(n) do receive do {:read, from} -> send(from, n) counter(n + 1) end end end pid = spawn(fn -> Foo.counter(2) end) list = Enum.map((1..500_000), fn n -> spawn(fn -> Foo.counter(n) end) end)
  • 54. Processes Process.list defmodule Foo do def counter(n) do receive do {:read, from} -> send(from, n) counter(n + 1) end end end pid = spawn(fn -> Foo.counter(2) end) list = Enum.map((1..500_000), fn n -> spawn(fn -> Foo.counter(n) end) end)
  • 57. Trap Exits (http://eddwardo.github.io/elixir/links/2015/11/04/links-in-elixir/) defmodule Foo do def counter(n) do receive do {:read, from} -> send(from, n) counter(n + 1) {:bla} -> raise "I'm a bug!" end end end pid = spawn(fn -> Foo.counter(2) end) Process.alive?(pid) Process.link(pid) Process.exit(pid, :kill) pid = spawn(fn -> Foo.counter(2) end)
  • 58. Trap Exits (http://eddwardo.github.io/elixir/links/2015/11/04/links-in-elixir/) defmodule Foo do def counter(n) do receive do {:read, from} -> send(from, n) counter(n + 1) {:bla} -> raise "I'm a bug!" end end end pid = spawn(fn -> Foo.counter(2) end) Process.alive?(pid) Process.link(pid) Process.exit(pid, :kill) pid = spawn(fn -> Foo.counter(2) end)
  • 59. Observer/Schedulers defmodule Foo do def counter(n) do receive do {:read, from} -> send(from, n) counter(n + 1) end end end list = Enum.map((1..100_000), fn n -> spawn(fn -> Foo.counter(n) end) end) Enum.each(list, fn pid -> Process.exit(pid, :kill) end) defmodule Repeat do
  • 60. Observer/Schedulers defmodule Foo do def counter(n) do receive do {:read, from} -> send(from, n) counter(n + 1) end end end list = Enum.map((1..100_000), fn n -> spawn(fn -> Foo.counter(n) end) end) Enum.each(list, fn pid -> Process.exit(pid, :kill) end) defmodule Repeat do
  • 62. GenServer Simple defmodule Stack do use GenServer # Callbacks def handle_call(:pop, _from, [head|tail]) do {:reply, head, tail} end def handle_cast({:push, item}, state) do {:noreply, [item|state]} end end {:ok, pid} = GenServer.start_link(Stack, [:hello]) GenServer.call(pid, :pop) GenServer.cast(pid, {:push, :world}) GenServer.cast(pid, {:push, :blabla}) GenServer.call(pid, :pop)
  • 63. GenServer Simple defmodule Stack do use GenServer # Callbacks def handle_call(:pop, _from, [head|tail]) do {:reply, head, tail} end def handle_cast({:push, item}, state) do {:noreply, [item|state]} end end {:ok, pid} = GenServer.start_link(Stack, [:hello]) GenServer.call(pid, :pop) GenServer.cast(pid, {:push, :world}) GenServer.cast(pid, {:push, :blabla}) GenServer.call(pid, :pop)
  • 64. defmodule Stack do use GenServer # Public API def pop(server), do: GenServer.call(server, :pop) def push(server, item), do: GenServer.cast(server, {:push, item}) # Callbacks def handle_call(:pop, _from, [head|tail]) do {:reply, head, tail} end def handle_cast({:push, item}, state) do {:noreply, [item|state]} end end {:ok, pid} = GenServer.start_link(Stack, ["John"]) Stack.push(pid, "Woo")
  • 65. defmodule Stack do use GenServer # Public API def pop(server), do: GenServer.call(server, :pop) def push(server, item), do: GenServer.cast(server, {:push, item}) # Callbacks def handle_call(:pop, _from, [head|tail]) do {:reply, head, tail} end def handle_cast({:push, item}, state) do {:noreply, [item|state]} end end {:ok, pid} = GenServer.start_link(Stack, ["John"]) Stack.push(pid, "Woo")
  • 66. GenServer Kill defmodule Stack do use GenServer def start_link(state, opts []) do GenServer.start_link(__MODULE__, [state], name: __MODULE__) end def pop, do: GenServer.call(__MODULE__, :pop) def push(item), do: GenServer.cast(__MODULE__, {:push, item}) # Callbacks def handle_call(:pop, _from, [head|tail]) do {:reply, head, tail} end def handle_cast({:push, item}, state) do {:noreply, [item|state]}
  • 67. GenServer Kill defmodule Stack do use GenServer def start_link(state, opts []) do GenServer.start_link(__MODULE__, [state], name: __MODULE__) end def pop, do: GenServer.call(__MODULE__, :pop) def push(item), do: GenServer.cast(__MODULE__, {:push, item}) # Callbacks def handle_call(:pop, _from, [head|tail]) do {:reply, head, tail} end def handle_cast({:push, item}, state) do {:noreply, [item|state]}
  • 68. Supervisor - Restart defmodule StackSupervisor do use Supervisor def start_link do Supervisor.start_link(__MODULE__, []) end def init([]) do children = [ worker(Stack, ["hello"]) ] supervise(children, strategy: :one_for_one) end end StackSupervisor.start_link
  • 69. Supervisor - Restart defmodule StackSupervisor do use Supervisor def start_link do Supervisor.start_link(__MODULE__, []) end def init([]) do children = [ worker(Stack, ["hello"]) ] supervise(children, strategy: :one_for_one) end end StackSupervisor.start_link
  • 70. SUPERVISOR TREE (supervisor - supervisees/workers)
  • 74. MICRO “YOCTO” SERVICES (Micro > Nano > Pico > Femto > Atto > Zepto > Yocto)
  • 75.
  • 76.
  • 77.
  • 78.
  • 79. • Map, Structs, Records, Comprehensions
  • 80. • Map, Structs, Records, Comprehensions • Testable Docs
  • 81. • Map, Structs, Records, Comprehensions • Testable Docs • TypeSpecs/Behaviors
  • 82. • Map, Structs, Records, Comprehensions • Testable Docs • TypeSpecs/Behaviors • Agents/Tasks/GenEvent
  • 83. • Map, Structs, Records, Comprehensions • Testable Docs • TypeSpecs/Behaviors • Agents/Tasks/GenEvent • Sigils/Macros/DSLs
  • 84. • Map, Structs, Records, Comprehensions • Testable Docs • TypeSpecs/Behaviors • Agents/Tasks/GenEvent • Sigils/Macros/DSLs • ETS/DETS/Mnesia
  • 85. Javascript / shared mutable global state Blocking Event Loop Rust / Low Level Async in progress No coroutines Go Suture (OTP Clone) goroutines sem ID shared mutable state static signatures Scala Akka (OTP Clone) shared mutable state static signatures Clojure Pulsar / Quasar Almost Erlang-like Process JVM limitations Go http://www.jerf.org/iri/post/2930 Scala http://yarivsblog.blogspot.com.br/2008/05/erlang-vs-scala.html Clojure http://blog.paralleluniverse.co/2013/05/02/quasar-pulsar/ Scala has two types of Actors: thread-based and event based. Thread based actors execute in heavyweight OS threads. They never block each other, but they don't scale to more than a few thousand actors per VM. Event-based actors are simple objects. They are very lightweight, and, like Erlang processes, you can spawn millions of them on a modern machine. The difference with Erlang processes is that within each OS thread, event based actors execute sequentially without preemptive scheduling. This makes it possible for an event-based actor to block its OS thread for a long period of time (perhaps indefinitely).
  • 88.
  • 89.
  • 90.
  • 91.
  • 92.
  • 94.
  • 95.
  • 96.
  • 97.
  • 98.
  • 99.
  • 100.
  • 101.
  • 102.
  • 103.
  • 104.
  • 105.