Files | Admin

Notes:

Release Name: 3.3.0

Notes:
Rainbows! 3.3.0 - doc improvements and more

Rainbows! is an HTTP server for sleepy Rack applications.  It is based on
Unicorn, but designed to handle applications that expect long
request/response times and/or slow clients.

* http://rainbows.rubyforge.org/
* rainbows-talk@rubyforge.org
* git://bogomips.org/rainbows.git

Changes:

* improved documentation all around, suggestions/comments to further
  improve documentation is greatly welcome at: rainbows-talk@rubyforge.org

* added GPLv3 option to the license (now (Ruby|GPLv2|GPLv3), though
  Unicorn is still (Ruby|GPLv2) for now)

* added client_header_buffer_size config directive (default 1K)

* small default header buffer size (16K => 1K) to reduce memory usage,
  Rails apps with cookie sessions may want to increase this (~2K)

* all concurrency models default to 50 connections per process

* all concurrency models with a secondary :pool_size parameter also
  default to 50 (threads/fibers/whatever)

* RLIMIT_NOFILE and RLIMIT_NPROC are automatically increased if needed

* Rainbows::ThreadTimeout middleware rewritten, still not recommended,
  lazy people should be using Unicorn anyways :)

* Several experimental Linux-only edge-triggered epoll options:
  XEpollThreadSpawn, XEpollThreadPool, XEpoll, and Epoll.
  The latter two were in previous releases but never announced.
  These require the "sleepy_penguin", "raindrops", and "sendfile" RubyGems

=== Deprecations

* Rainbows::Fiber::IO* APIs all deprecated, Rainbows! will avoid
  having any concurrency model-specific APIs in the future and
  also avoid introducing new APIs for applications.

* Fiber-based concurrency models are no longer recommended, they're
  too fragile for most apps, use at your own risk (they'll continue to
  be supported, however).  Linux NPTL + Ruby 1.9 is pretty lightweight
  and will be even lighter in Ruby 1.9.3 if you're careful with stack
  usage in your C extensions.



Changes: .document | 1 + COPYING | 899 +++++++++++++++++++--------- Documentation/comparison.haml | 105 +++- FAQ | 3 + GIT-VERSION-GEN | 2 +- LICENSE | 19 +- README | 19 +- Sandbox | 25 + TODO | 24 +- lib/rainbows.rb | 99 ++-- lib/rainbows/client.rb | 11 +- lib/rainbows/configurator.rb | 228 ++++++-- lib/rainbows/const.rb | 2 +- lib/rainbows/coolio.rb | 5 +- lib/rainbows/coolio/client.rb | 4 +- lib/rainbows/coolio/heartbeat.rb | 3 +- lib/rainbows/coolio_fiber_spawn.rb | 19 +- lib/rainbows/coolio_thread_pool.rb | 29 +- lib/rainbows/coolio_thread_spawn.rb | 3 + lib/rainbows/epoll.rb | 32 +- lib/rainbows/epoll/client.rb | 6 +- lib/rainbows/ev_core.rb | 3 +- lib/rainbows/event_machine.rb | 4 + lib/rainbows/event_machine/client.rb | 3 +- lib/rainbows/fiber.rb | 5 + lib/rainbows/fiber/base.rb | 1 + lib/rainbows/fiber/coolio/methods.rb | 1 - lib/rainbows/fiber/io.rb | 16 +- lib/rainbows/fiber/io/pipe.rb | 7 +- lib/rainbows/fiber/io/socket.rb | 7 +- lib/rainbows/fiber_pool.rb | 19 +- lib/rainbows/fiber_spawn.rb | 17 +- lib/rainbows/http_server.rb | 114 ++-- lib/rainbows/join_threads.rb | 4 + lib/rainbows/max_body.rb | 39 +- lib/rainbows/never_block.rb | 17 +- lib/rainbows/pool_size.rb | 14 + lib/rainbows/process_client.rb | 24 +- lib/rainbows/queue_pool.rb | 14 +- lib/rainbows/response.rb | 23 +- lib/rainbows/revactor.rb | 21 +- lib/rainbows/revactor/client.rb | 4 +- lib/rainbows/stream_file.rb | 15 +- lib/rainbows/thread_pool.rb | 40 +- lib/rainbows/thread_spawn.rb | 27 +- lib/rainbows/thread_timeout.rb | 148 ++++- lib/rainbows/writer_thread_pool/client.rb | 2 +- lib/rainbows/writer_thread_spawn/client.rb | 4 +- lib/rainbows/xepoll.rb | 18 +- lib/rainbows/xepoll/client.rb | 36 +- lib/rainbows/xepoll_thread_pool.rb | 82 +++ lib/rainbows/xepoll_thread_pool/client.rb | 129 ++++ lib/rainbows/xepoll_thread_spawn.rb | 58 ++ lib/rainbows/xepoll_thread_spawn/client.rb | 121 ++++ pkg.mk | 4 + rainbows.gemspec | 5 +- t/GNUmakefile | 6 +- t/client_header_buffer_size.ru | 5 + t/simple-http_XEpollThreadPool.ru | 10 + t/simple-http_XEpollThreadSpawn.ru | 10 + t/t0022-copy_stream-byte-range.sh | 16 +- t/t0026-splice-copy_stream-byte-range.sh | 25 + t/t0027-nil-copy_stream.sh | 60 ++ t/t0041-optional-pool-size.sh | 4 +- t/t0042-client_header_buffer_size.sh | 65 ++ t/t9100-thread-timeout.sh | 7 +- t/t9101-thread-timeout-threshold.sh | 7 +- t/test-lib.sh | 58 ++ t/test_isolate.rb | 12 +- 69 files changed, 2141 insertions(+), 728 deletions(-) commit bc4f5510cd0e5ccf85f077cca019bca70309bf01 Author: Eric Wong Date: Mon May 16 14:12:27 2011 -0700 Rainbows! 3.3.0 - doc improvements and more * improved documentation all around, suggestions/comments to further improve documentation is greatly welcome at: rainbows-talk@rubyforge.org * added GPLv3 option to the license (now (Ruby|GPLv2|GPLv3), though Unicorn is still (Ruby|GPLv2) for now) * added client_header_buffer_size config directive (default 1K) * small default header buffer size (16K => 1K) to reduce memory usage, Rails apps with cookie sessions may want to increase this (~2K) * all concurrency models default to 50 connections per process * all concurrency models with a secondary :pool_size parameter also default to 50 (threads/fibers/whatever) * RLIMIT_NOFILE and RLIMIT_NPROC are automatically increased if needed * Rainbows::ThreadTimeout middleware rewritten, still not recommended, lazy people should be using Unicorn anyways :) * Several experimental Linux-only edge-triggered epoll options: XEpollThreadSpawn, XEpollThreadPool, XEpoll, and Epoll. The latter two were in previous releases but never announced. These require the "sleepy_penguin", "raindrops", and "sendfile" RubyGems === Deprecations * Rainbows::Fiber::IO* APIs all deprecated, Rainbows! will avoid having any concurrency model-specific APIs in the future and also avoid introducing new APIs for applications. * Fiber-based concurrency models are no longer recommended, they're too fragile for most apps, use at your own risk (they'll continue to be supported, however). Linux NPTL + Ruby 1.9 is pretty lightweight and will be even lighter in Ruby 1.9.3 if you're careful with stack usage in your C extensions. commit bcd0825fc77a2986aebb3f1f5a653a64faf6a8c5 Author: Eric Wong Date: Mon May 16 21:01:47 2011 +0000 writer_thread_*: fix sendfile detection under Ruby 1.8 I can't wait until I stop supporting Ruby 1.8 commit 912c328ecfccf189239c4ad2bb7863d64342868f Author: Eric Wong Date: Mon May 16 20:42:10 2011 +0000 document RubyGem requirements Hopefully makes things easier to try out. commit 46ac7ca9f3e5c7736aa1c9430d2de218e27bf730 Author: Eric Wong Date: Mon May 16 20:32:29 2011 +0000 doc: cleanup rdoc for Rainbows module The only supported method is Rainbows.sleep in here commit 362ac7801d4f6ddd85cbafdc7e9118f88089564a Author: Eric Wong Date: Mon May 16 20:13:00 2011 +0000 use :pool_size for RLIMIT_NPROC with thread pool models Only needed for Ruby 1.9 commit f9de85b9a35c9f95b390249ea855858c5e4a3ae2 Author: Eric Wong Date: Mon May 16 20:05:12 2011 +0000 more reliable shutdown for epoll concurrency models Just close the epoll descriptor, since the sleepy_penguin epoll_wait wrapper may not return EINTR in the future. commit 49b60d6f67a94560a802c6ff80c16c92093de877 Author: Eric Wong Date: Mon May 16 19:43:38 2011 +0000 tests: unify checks for copy_stream and threaded app dispatch This makes things easier to maintain as we add more concurrency options. commit 39f625fff05d457b01f088017f463a86d3b6c626 Author: Eric Wong Date: Mon May 16 19:04:06 2011 +0000 add "copy_stream" config directive This allows using IO::Splice.copy_stream from the "io_splice" RubyGem on recent Linux systems. This also allows users to disable copy_stream usage entirely and use traditional response_body.each calls which are compatible with all Rack servers (to workaround bugs in IO.copy_stream under 1.9.2-p180). commit d520222050ce88388ae5e446c63642d79cc9796e Author: Eric Wong Date: Tue May 10 16:34:51 2011 -0700 configurator: update user-facing documentation Finally, we have all methods in configurator and it's much easier to document! commit 95cec890409ac07d51c87ab157fe7e101d6f8432 Author: Eric Wong Date: Tue May 10 16:33:07 2011 -0700 max_body: documentation updates It can't be used as middleware for fully-buffering concurrency models. commit 382d3cabfda9fdd391228d24e8a8d4cb014648b9 Author: Eric Wong Date: Tue May 10 15:35:21 2011 -0700 LICENSE: add GPLv3 to license terms GPLv2 and Ruby-specific terms remain intact, but this means we can be combined and redistributed with GPLv3-only software (once Unicorn has GPLv3 added to its license). commit 704f843054f3ca32941d42972a1c7d1b144d06ad Author: Eric Wong Date: Mon May 9 04:39:54 2011 +0000 configurator: move validation logic over There's actually no reason we can't have these methods in Rainbows::Configurator where it's easier to document nowadays. commit 598525843ee1d120fd9878011ca2b6328c2cf95f Author: Eric Wong Date: Mon May 9 02:24:26 2011 +0000 doc: better document :pool_size options CoolioThreadPool has had it supported forever, but only NeverBlock had it documented. commit 1e3b7e9bfef992b337a9a113da6c99071dce60e1 Author: Eric Wong Date: Mon May 9 02:15:55 2011 +0000 TODO: misc updates Some things were never going to get done due to lack of interest from users. commit 87632aac323bd41701900a03dc78bc307fa8229a Author: Eric Wong Date: Mon May 9 02:13:51 2011 +0000 doc: update comparison and README Clearly users need to know about more options commit d0336075a772d040b9fe3100098e1815ce609cb4 Author: Eric Wong Date: Mon May 9 01:57:16 2011 +0000 xepoll_thread_*: add rdoc for users It's good to describe what they're useful for. commit a62e9240fffe544d171c87f94946ecf50888a6df Author: Eric Wong Date: Mon May 9 01:56:46 2011 +0000 xepoll_thread_spawn/client: remove rdoc It's an internal implementation detail. commit 6b430295177c4689a6a5d421d575867c5da8ba2b Author: Eric Wong Date: Mon May 9 01:55:32 2011 +0000 max_body: rdoc updates speling ficks and less confusing #initialize documentation commit 9afcdde9a92f817330e4dfd5e1ef77a7bf461253 Author: Eric Wong Date: Mon May 9 00:21:23 2011 +0000 xepoll_thread_pool: add optional :pool_size argument We're now able to configure the number of threads independently of worker_connections. commit 725adcc6986bc2658d92ea3ebebe61d2b83060ad Author: Eric Wong Date: Mon May 9 00:17:06 2011 +0000 split out pool_size module coolio_thread_pool, neverblock both use it, and xepoll_thread_pool will support it next, too. commit 3c1649226d2371ce09d14f3fcce18fec0af1ba02 Author: Eric Wong Date: Mon May 9 00:16:23 2011 +0000 t0041: less confusing skip message Just the test name is irrelevant commit 380ef63bc2c8f7b6f1cab7387aa9343bc5720c9c Author: Eric Wong Date: Mon May 9 00:02:51 2011 +0000 add XEpollThreadPool concurrency option This is probably friendlier on server resources in the worst case than XEpollThreadSpawn but may perform worse in the client client-visible way, too. commit df00f2b1028ba95450246c82e468878b6ec903a3 Author: Eric Wong Date: Sun May 8 07:54:30 2011 +0000 Revert "epoll: fixes for Ruby 1.9.3dev" Fixed in kgio 2.4.0 now This reverts commit a1168e7d2bfe182896f139d051ef099616fd1646. commit ed869514211a908748f04a881e6fb18a395914ae Author: Eric Wong Date: Sun May 8 07:47:03 2011 +0000 join_threads: simplify thread stoppage check No need for a string comparison commit 8af417bbacb285c90a376c55a42fe39a981a328d Author: Eric Wong Date: Sun May 8 07:39:38 2011 +0000 require kgio 2.4.0 kgio 2.4.0 has some 1.9.3dev fixes which affect us commit ec3f871c9a34734b865365a43979a0b459654b05 Author: Eric Wong Date: Sun May 8 07:26:55 2011 +0000 epoll_wait: flags argument is unused We only poll for one event (EPOLLIN/EPOLLOUT) at a time, so there's no need to actually check since they're too rare. commit e64e2e0045d63c4edd291839febba978534be652 Author: Eric Wong Date: Sun May 8 07:22:36 2011 +0000 xepoll: cleanup acceptor logic worker_yield is safer than setting a threshold with multiple acceptors when thread limits are hit. Also, avoid sleep + Thread#run since it's potentially racy if threads are extremely unfairly scheduled. Same things applied to xepoll_thread_spawn. commit 07a0bee9dd6f2c366d11284b7e9ab09d66b411e4 Author: Eric Wong Date: Sun May 8 04:06:12 2011 +0000 xepoll_thread_spawn: rework acceptor logic Infinite sleep is too dangerous due to possible race conditions, so use worker_yield which is safer and cheaper in the general case. We can also avoid sleeping on new threads by only spawning when the client module is included. commit c543b295ff2108623f3748a141e04e5530d06377 Author: Eric Wong Date: Sun May 8 03:58:21 2011 +0000 xepoll_thread_spawn/client: close returns nil Otherwise pipeline_ready can false positive on us commit 497ce74310baaa7ac4835b8d6aa76acb40d44b7c Author: Eric Wong Date: Sun May 8 01:28:43 2011 +0000 xepoll_thread_spawn: inline needless method shorter line and 3 lines of code killed! commit ef9376775b1a6eeae8807160b2b8ea23fbfd3607 Author: Eric Wong Date: Sun May 8 01:27:25 2011 +0000 process_client: fix pipeline_ready arity Not that it's actually used, right now. commit 3decb4375847b97c117440e5167dbba33d5f33b5 Author: Eric Wong Date: Fri May 6 01:04:39 2011 +0000 remove unnecessary variable assignments commit bcca2d3bc609e9ecaa77ec93bef861b1ddcc01dd Author: Eric Wong Date: Fri May 6 00:52:18 2011 +0000 test_isolate: update to latest raindrops and unicorn Newer versions should be better commit 21a1a20223986af8c8962cafe2e0f1eae0dcfd19 Author: Eric Wong Date: Fri May 6 00:38:53 2011 +0000 ensure some requires get loaded in master More sharing, faster startups, and most importantly, better error reporting if some things are missing. commit 0efe7b677b076a32ef54e5f2f0a9861eb1f7f3d9 Author: Eric Wong Date: Thu May 5 07:16:48 2011 +0000 http_server: XEpollThreadSpawn sets RLIMIT_NPROC It *can* have as many threads as it does idle connections. commit 8fb350e00c1421907cbc36cbf29c499b8ad051e4 Author: Eric Wong Date: Tue May 3 01:18:45 2011 +0000 Rainbows! defaults more DRY We won't forget to reset defaults on SIGHUP anymore. commit e9a229c639dd6bda08a3fa8ce14af3688dc2ba63 Author: Eric Wong Date: Tue May 3 01:15:37 2011 +0000 s/max_bytes/client_max_body_size/ for consistency Too confusing otherwise... commit a7f5f17ba2047ef7143465f612007ea81871a79e Author: Eric Wong Date: Tue May 3 01:05:11 2011 +0000 add client_header_buffer_size tuning parameter We're changing our default to 1K buffers to save memory. This should reduce memory usage of idle clients and lower pressure on the MRI GC. Rails applications using session cookies (the default) may want to up this to 2K or more. commit 01381ab4dfeb032c85e72724df889c7aa381aa32 Author: Eric Wong Date: Mon May 2 22:05:52 2011 +0000 rainbows: get rid of MODEL_WORKER_CONNECTIONS constant Just use regular autoload, now. Less guesswork. commit 25c5930988d6deab8f885981fdaf6c1eb12fdf98 Author: Eric Wong Date: Mon May 2 08:05:45 2011 -0700 http_server: default all options to 50 connections pavinging the way for changing MODEL_WORKER_CONNECTIONS commit ce4f5cd7197fb99ed99399b22cbece1684532f85 Author: Eric Wong Date: Sun May 1 01:44:28 2011 +0000 doc: add Sandbox document Rainbows! is a bit bigger than Unicorn and usually requires being sandboxed, too. commit 8c086f095a2f3be0f71829af9037d99c79604a37 Author: Eric Wong Date: Sat Apr 30 06:56:47 2011 +0000 lower header buffer sizes for synchronous models HTTP headers are usually smaller than 4K, so 16K was way too much for most users and often caused unnecessary GC runs. EventMachine and Coolio models can all share the same initial read buffer, so it's less urgent that they get this lowered for now... commit bfb58da95e13f3061feb2c1f284efc80a13ba23c Author: Eric Wong Date: Sat Apr 30 06:50:17 2011 +0000 xepoll_thread_spawn: lower memory usage This one actually has a realistic chance of running hundreds/thousands of clients, and 32K per-client is a huge amount. commit ca8021d4177e5f7131f88daf6b56402ff39c3a35 Author: Eric Wong Date: Fri Apr 29 18:14:10 2011 +0000 epoll: fix timeout Epoll#wait and epoll_wait(2) timeouts are in milliseconds, not seconds. This affects xepoll, too. commit 73ed28f1863d5ae3048a284e25a918255bdafe8a Author: Eric Wong Date: Fri Apr 29 18:11:04 2011 +0000 xepoll_thread_spawn: fix race condition with acceptors Noticed under 1.8.7 commit aff36865d5e738babdbf36f34fd0693b67bb3d90 Author: Eric Wong Date: Fri Apr 29 05:45:44 2011 +0000 xepoll_thread_spawn: initial implementation Whee! This is going to be awesome. commit 40cf3eb79054caa4b7d81120a736491aca8259eb Author: Eric Wong Date: Thu Apr 28 18:42:46 2011 +0000 document epoll and xepoll They're probably ready for general use in a very limited capacity... commit 6ea50dd6866a7b4eda5134cb2c8980710285e127 Author: Eric Wong Date: Tue Apr 26 14:04:26 2011 -0700 doc: stop recommending Fiber* stuff Too much NIH and too fragile. commit 5bd08f7bb06367823412bd3410bcb41babd6d57b Author: Eric Wong Date: Tue Apr 26 14:00:25 2011 -0700 revactor: remove documentation for internal methods commit 00b9b46b2a49ab96f74fd21807ee9c93b218bc2d Author: Eric Wong Date: Tue Apr 26 13:30:28 2011 -0700 revactor: do not recommend, upstream is dormant commit e3c8152e016fe29f76a996b8802df7158c081db0 Author: Eric Wong Date: Tue Apr 26 12:56:20 2011 -0700 stream_file: hide internals No need to expose things that don't need exposing. commit 012d3e3d1ae9186434efcaa746f25118683fe8b3 Author: Eric Wong Date: Mon Apr 25 19:44:13 2011 -0700 make all concurrency options use 50 by default This may change again in the future, but it paves the way for simplifying this code... commit f6471ed9cafe6e65e72fa9486ecdcc4b2f8d1373 Author: Eric Wong Date: Thu Apr 21 15:38:20 2011 -0700 thread_timeout: annotate as much as possible This should make code review easier. commit 63b3b40abf054bce2846bc9e36770a6ed2791a8b Author: Eric Wong Date: Sat Apr 9 18:58:23 2011 -0700 increase RLIMIT_NPROC for thread-crazy folks Might as well, threads are free and cheap on 64-bit commit 066bbf930d023ecf61ed4af363aebadbce2c51db Author: Eric Wong Date: Fri Apr 8 13:38:11 2011 -0700 http_server: attempt to increase RLIMIT_NOFILE In case people try to do C10K, make life easier for them. commit e5c4125c348104444714b5111c90016d520461d6 Author: Eric Wong Date: Thu Apr 21 21:22:06 2011 +0000 thread_timeout: document Thread.pass usage Thread-switching sometimes takes too long under YARV, so we force a switch since the watchdog thread is lower-priority. commit 71d48a01a7c257dffa22c10781c55deff64037d2 Author: Eric Wong Date: Thu Apr 21 21:21:13 2011 +0000 join_threads: workaround blocking accept() issues Should be fixed in 1.9.3 and/or future Kgio... commit 7f368d2cf9e456e37f1489dc275ed0de007175dd Author: Eric Wong Date: Thu Apr 21 06:48:46 2011 +0000 bump dependency to Unicorn 3.6.0 Might as well use the latest and greatest. commit 15505863ce2080bdf342930530acc35c0d112df1 Author: Eric Wong Date: Tue Apr 19 04:35:43 2011 +0000 http_server: less hacky loading of concurrency model Ugh the old way was gross. commit 367ba00d2f3a4e9a0fa848d076f97f754a9d7cc5 Author: Eric Wong Date: Mon Apr 11 07:54:50 2011 +0000 t: only enable Revactor tests under 1.9.2 for now Revactor doesn't seem to work under 1.9.3dev, and Revactor is dead upstream. commit a1168e7d2bfe182896f139d051ef099616fd1646 Author: Eric Wong Date: Mon Apr 11 07:53:57 2011 +0000 epoll: fixes for Ruby 1.9.3dev commit 321e3dfbd5c4a585c00a8d5221ebdf9b934aaea1 Author: Eric Wong Date: Mon Apr 11 04:16:31 2011 +0000 thread_timeout: rewrite for safety This attempts to fix all the danger associated with using Thread#raise. Hopefully I succeeded. Note: this logic _cannot_ be used to fix the timeout.rb module in the Ruby standard library, that one needs to allow nested timeouts (which seems impossible). commit 5170b767ef1bbc94554920959d1792fce43899a9 Author: Eric Wong Date: Sun Apr 10 07:42:31 2011 +0000 thread_pool: get used of dead thread_join method It's in the JoinThreads module now commit 777beb3e27785d2da2865cb5fc0d43f1c158cb5e Author: Eric Wong Date: Tue Mar 22 11:08:31 2011 -0700 queue_pool: switch to ivars to protect internals commit dd6d5168e4f3dcb4555264265a05e5b61273893d Author: Eric Wong Date: Tue Mar 22 17:22:00 2011 +0000 thread_pool+thread_spawn: update documentation They're not bad with slow clients a previously thought. commit 53fdbda1ba1d88e93d662a040fe4c7fb52810155 Author: Eric Wong Date: Mon Mar 21 02:45:02 2011 +0000 simplify LISTENERS closing No need to obfuscate what it's doing commit c7e75cfe241a621f50c750720c47149a156e8e7f Author: Eric Wong Date: Sun Mar 20 03:07:31 2011 +0000 fix various warnings with "check-warnings" target Run under 1.9.3dev commit d327a0d468e5b5cfb05bb56621fb22d156ce3a40 Author: Eric Wong Date: Thu Mar 17 09:59:55 2011 +0000 pkg.mk: new task for checking Ruby warnings commit ee9e7886d9101a6376d268a931c645026e9f6b0f Author: Eric Wong Date: Tue Mar 15 21:44:14 2011 +0000 fiber/io: fix broken call to Kgio.trywrite Fortunately it's a deprecated class that nobody uses...