macournoyer/thin — pull request #167 by macournoyer (2013-03-14 21:46:24+00:00)
Title: Thin 2

Thin 2 is a full rewrite with two main goals: preforking and flexibility. All while keeping performance and memory use as a high priority.

How performance and memory use will be further improved is by moving most of Thin features into middlewares.

Eg.: to enable the use of threads in the config file thin.conf.rb:
```ruby
# ... other config
use Thin::Threaded, pool_size: 20
```
This will also allow to enable that feature only under some paths
```ruby
# ... other config
map '/slow_action' do
use Thin::Threaded, pool_size: 20
end
```

I started work on this a while ago but inspired by Bootstrap 3, I'm using a PR to make it more transparent.

#### Concurrency
- [ ] Make streaming work w/ threading.
- [ ] Investigate making middleware stack work w/ async.
- [ ] Document and write tests for X-Thin-Defer header.
- [ ] Investigate enabling threaded mode by default

#### Internals
- [ ] Drop support for Ruby 1.8
- [ ] Use a Logger instead of puts
- [ ] Automatically close idling pipeline connections on server stop
- [ ] Refactor constants into a single file for easy reuse
- [ ] SSL support
- [ ] Deffered GC

#### Deployment
- [ ] Rotate logs on USR1 signal
- [ ] No downtime restart
- [ ] Allow changing user group after bind
- [ ] Graceful stop

#### EventMachine
Some things need to be fixed in EM for v2 to work. In the meantime [this fork](https://github.com/ibc/EventMachine-LE) is used.
- [ ] attach_server patch: https://github.com/eventmachine/eventmachine/pull/271
- [ ] Get rid of simultaneous `accept(2)`: https://github.com/eventmachine/eventmachine/pull/420
- [ ] Make backlog configurable

#### Backward compatibility
v2 should try very hard to be a drop-in replacement for v1. Later on (2.1 and onwards), new defaults and breaking changes will be introduced with proper warning upfront.
- [ ] Update CLI to be mostly the same as v1
- [ ] Default to single process mode
- [ ] Support v1 YAML config?
- [ ] Test under JRuby & Rubinius

#### Documentation
- [ ] Redo site
- [ ] Document each middleware on site
- [ ] Code samples for async w/ Rails & others
- [ ] Document CLI options
- [ ] Test w/ Rails 4
- [ ] Test w/ Faye (which uses async feature)

If you intend on contributing to this in a big or medium way, contact me first as the code hasn't stabilized yet and is constantly changing.