IO Bloqueante
L1 cache reference 0.000001 ms
Main memory reference 0.0001 ms
Enviar 1 Kb por uma conexão 1 Gbps 0.010 ms
Disk seek 10 ms
Ler 1 MB do HD 20 ms
Round trip Brazil - EUA 150 ms
IO CPU IO CPU IO CPU
Slide 14
Slide 14 text
IO Não Bloqueante
IO CPU
IO CPU
IO CPU
Slide 15
Slide 15 text
IO Não Bloqueante How to?
EventLoop & Reactor Pattern
Slide 16
Slide 16 text
IO Não Bloqueante How to?
EventLoop & Reactor Pattern
"EventLoop is a programming construct
that waits for and dispatches events or
messages in a program & The reactor
design pattern is an event handling
pattern ..."
Slide 17
Slide 17 text
IO Não Bloqueante How to?
select | epoll
"A system call to examine the status of
file descriptors of open input/output
channels. | A scalable I/O event
notification mechanism"
Slide 18
Slide 18 text
IO Não Bloqueante How to?
File-based EventLoop
"The select and poll system calls allow a
set of file descriptors to be monitored for
a change of state, [...] by using files to
trigger and listen to events, the loop will
block if there are no events ready."
Slide 19
Slide 19 text
IO Não Bloqueante How to?
File-based EventLoop
"The select and poll system calls allow a
set of file descriptors to be monitored for
a change of state, [...] by using files to
trigger and listen to events, the loop will
block if there are no events ready."
Slide 20
Slide 20 text
Node.js HTTP Server
Slide 21
Slide 21 text
ReactPHP HTTP Server
Slide 22
Slide 22 text
No content
Slide 23
Slide 23 text
No content
Slide 24
Slide 24 text
Programando
Event Driven
[✓] The good
[✓] The bad
[✓] The ugly
Fontes
ReactPHP
http://reactphp.org/
Why Use Node.js? - Tomislav Capan
http://www.toptal.com/nodejs/why-the-hell-would-i-use-node-js
Async PHP With React (Laracon) - Jeremy Mikola
https://www.youtube.com/watch?v=s6xrnYae1FU
Laravel Request Lifecycle
http://laravel.com/docs/5.0/lifecycle
Event Correlation: What you Need to Know For IT Operations Management - Michael Johnson
http://goo.gl/0bZFaP
Callback Hell - Max Ogden
http://callbackhell.com/
Slide 43
Slide 43 text
Fontes
Understanding the node.js event loop - Mikito Takada
http://blog.mixu.net/2011/02/01/understanding-the-node-js-event-loop/
Promises - Forbes Lindesay
https://www.promisejs.org/
I/O não bloqueante com select “na unha” (Perl) - Tiago Peczenyj
http://imasters.com.br/desenvolvimento/io-nao-bloqueante-com-ioselect-na-unha/
Reactor Pattern - Douglas C. Schmidt
http://www.dre.vanderbilt.edu/~schmidt/PDF/reactor-siemens.pdf
Differences between event driven model and reactor pattern? - Jean-Paul Calderone
http://stackoverflow.com/a/9143390
Cargo Cult Programming
http://en.wikipedia.org/wiki/Cargo_cult_programming