Implementation of the Reactor pattern
- Most web apps are I/O bound, not CPU bound
- Instead of waiting on a response from the network, use that time to process other requests
- Handle 5-10k concurrent connections with a single Ruby process
EM.run do
EM.start_server '0.0.0.0', 2202, EchoServer
end
while reactor_running?
. . .
end
#your interface module
post_init
receive_data- no long loops
- no MySQL queries