1 %h1 Rainbows! at a glance
3 Confused by all the options we give you? So are we! Here's some tables
4 to help keep your head straight. Remember, engineering is all about
6 %h2 core features and compatibility
11 %th.tee rack.input streaming
59 %td.mod RevThreadSpawn
101 %td.mod RevFiberSpawn
108 %td.mod WriterThreadPool
115 %td.mod WriterThreadSpawn
123 RevThread* + 1.8 requires Rev >= 0.3.2 for reasonable performance
125 waiting on Rubinius for better signal handling
127 rack.input streaming is what makes
128 %a(href="http://upr.bogomips.org/") upload progress,
131 rack.input streaming is NOT compatible with current versions of nginx
132 or any proxy that fully buffers request bodies before proxying.
133 Keep in mind request body buffering in nginx is a good thing in all
134 other cases where rack.input streaming is not needed.
136 %h2 application requirements
141 %th.slowio slow I/O (backend, not client)
142 %th.thr thread safety
143 %th.reent single thread reentrant
152 %a(href="http://rev.rubyforge.org/")Rev,
153 %a(href="http://revactor.org/")Revactor,
156 %a(href="Rainbows/Fiber/IO.html")Fiber::IO
161 %td.slowio thread-safe Ruby
167 %a(href="http://rev.rubyforge.org/") Rev
172 %td.slowio thread-safe Ruby
178 %a(href="http://rubyeventmachine.com") EventMachine
182 %td.mod RevThreadSpawn
185 %a(href="http://rev.rubyforge.org/") Rev
191 %a(href="Rainbows/Fiber/IO.html") Rainbows::Fiber::IO
197 %a(href="Rainbows/Fiber/IO.html") Rainbows::Fiber::IO
202 %td.slowio thread-safe Ruby
208 %a(href="http://www.espace.com.eg/neverblock") NeverBlock,
209 %a(href="http://rubyeventmachine.com") EventMachine
213 %td.mod RevThreadPool
216 %a(href="http://rev.rubyforge.org/") Rev
220 %td.mod RevFiberSpawn
222 %a(href="Rainbows/Fiber/IO.html") Rainbows::Fiber::IO
226 %td.mod WriterThreadPool
231 %td.mod WriterThreadSpawn
237 Requirements for single thread reentrancy are loose in that there is
238 no risk of race conditions and potentially mutually exclusive to
239 thread-safety. In the case where a Fiber yields while holding a
240 resource and another Fiber attempting to acquire it may raise
241 an error or worse, deadlock the entire process.
243 Slow I/O means anything that can block/stall on sockets including
244 3rd-party APIs (OpenID providers included) or slow database queries.
245 Properly run Memcached (within the same LAN) is fast and not a blocker.
246 Slow I/O on POSIX filesystems only includes a few operations, namely
247 on UNIX domain sockets and named pipes. Nearly all other operations
248 on POSIX filesystems can be considered "fast", or at least
251 WriterThread{Pool,Spawn} will require thread safety if your response
252 body is dynamically generated during the body#each call.
254 %h2 middlewares and frameworks
261 %a(href="Rainbows/DevFdResponse.html") DevFdResponse
263 %a(href="Rainbows/AppPool.html") AppPool
265 %a(href="http://rack.rubyforge.org/doc/Rack/Lock.html") Rack::Lock
273 %td.async lots of RAM :P
280 %td.async Revactor itself
287 %td.async standard Ruby
294 %td.async DevFdResponse
301 %td.async standard Ruby
308 %td.async async_sinatra, Cramp, rack-fiber_pool
311 %td.mod RevThreadSpawn
315 %td.async standard Ruby
322 %td.async Rainbows::Fiber::IO, Rainbows.sleep
329 %td.async Rainbows::Fiber::IO, Rainbows.sleep
336 %td.async standard Ruby
343 %td.async NeverBlock, async_sinatra
346 %td.mod RevThreadPool
350 %td.async Rev, standard Ruby
353 %td.mod RevFiberSpawn
357 %td.async Rev, Rainbows::Fiber::IO, Rainbows.sleep
359 %td.mod WriterThreadPool
363 %td.async Standard Ruby in response body only
364 %td.ws response body only
366 %td.mod WriterThreadSpawn
370 %td.async Standard Ruby in response body only
371 %td.ws response body only
374 "No!" means it's fundamentally incompatible, use an
375 %a(href="Rainbows/AppPool.html") AppPool
379 NeverBlock also supports a :pool_size option which is one less
380 layer of complexity than using AppPool.
382 NeverBlock can neuter the Mutex class so Rack::Lock effectively
383 becomes a no-op with:
385 %code require "never_block/frameworks/rails"
386 (before Rails is loaded)
388 Everything that's DevFdResponse-compatible can use it for passing
389 async responses through