Notes:
Unicorn is an HTTP server for Rack applications designed to only serve
fast clients on low-latency, high-bandwidth connections and take
advantage of features in Unix/Unix-like kernels. Slow clients should
only be served by placing a reverse proxy capable of fully buffering
both the the request and response in between Unicorn and slow clients.
* http://unicorn.bogomips.org/
* mongrel-unicorn@rubyforge.org
* git://git.bogomips.org/unicorn.git
Changes:
Rewindable "rack.input" may be disabled via the
"rewindable_input false" directive in the configuration file.
This will violate Rack::Lint for Rack 1.x applications, but
can reduce I/O for applications that do not need it.
There are also internal cleanups and enhancements for future
versions of Rainbows!
Eric Wong (11):
t0012: fix race condition in reload
enable HTTP keepalive support for all methods
http_parser: add HttpParser#next? method
tee_input: switch to simpler API for parsing trailers
switch versions to 3.0.0pre
add stream_input class and build tee_input on it
configurator: enable "rewindable_input" directive
http_parser: ensure keepalive is disabled when reset
*_input: make life easier for subclasses/modules
tee_input: restore read position after #size
preread_input: no-op for non-rewindable "rack.input"
Changes:
GIT-VERSION-GEN | 2 +-
GNUmakefile | 4 +-
TODO | 3 -
examples/unicorn.conf.rb | 5 +-
ext/unicorn_http/global_variables.h | 4 -
ext/unicorn_http/unicorn_http.rl | 86 +++++++++++---------
lib/unicorn.rb | 1 +
lib/unicorn/configurator.rb | 54 +++++++++---
lib/unicorn/const.rb | 4 +-
lib/unicorn/http_request.rb | 13 +++-
lib/unicorn/http_server.rb | 53 ++++++------
lib/unicorn/preread_input.rb | 2 +-
lib/unicorn/stream_input.rb | 156 +++++++++++++++++++++++++++++++++++
lib/unicorn/tee_input.rb | 147 ++++----------------------------
t/t0012-reload-empty-config.sh | 85 +++++++++++++++++++
t/t0013-rewindable-input-false.sh | 24 ++++++
t/t0014-rewindable-input-true.sh | 24 ++++++
test/unit/test_http_parser.rb | 16 +++-
test/unit/test_http_parser_ng.rb | 55 ++++++++++---
test/unit/test_stream_input.rb | 143 ++++++++++++++++++++++++++++++++
test/unit/test_tee_input.rb | 52 +++++++++---
unicorn.gemspec | 4 +-
22 files changed, 687 insertions(+), 250 deletions(-)
commit 958c1f81a2c570f4027d8fe2dd4f5c40ac7ed430
Author: Eric Wong
Date: Tue Nov 16 16:00:07 2010 -0800
unicorn 3.0.0pre1
Rewindable "rack.input" may be disabled via the
"rewindable_input false" directive in the configuration file.
This will violate Rack::Lint for Rack 1.x applications, but
can reduce I/O for applications that do not need it.
There are also internal cleanups and enhancements for future
versions of Rainbows!
Eric Wong (11):
t0012: fix race condition in reload
enable HTTP keepalive support for all methods
http_parser: add HttpParser#next? method
tee_input: switch to simpler API for parsing trailers
switch versions to 3.0.0pre
add stream_input class and build tee_input on it
configurator: enable "rewindable_input" directive
http_parser: ensure keepalive is disabled when reset
*_input: make life easier for subclasses/modules
tee_input: restore read position after #size
preread_input: no-op for non-rewindable "rack.input"
commit 431de671a29b312bd19e615bd4bd99228b0c8b13
Author: Eric Wong
Date: Tue Nov 16 13:51:24 2010 -0800
preread_input: no-op for non-rewindable "rack.input"
We may get "rack.input" objects that are not rewindable
in the future, so be prepared for those and do no harm.
commit 17a734a9f6ccea8c969a574f09b5d8dd3d568a9c
Author: Eric Wong
Date: Sat Nov 13 16:41:10 2010 +0800
tee_input: restore read position after #size
It's possible for an application to call size after it has read
a few bytes/lines, so do not screw up a user's read offset when
consuming input.
commit 855c02a9720a17854a2f1c715efbe502cdba54e2
Author: Eric Wong
Date: Fri Nov 12 10:59:14 2010 +0800
*_input: make life easier for subclasses/modules
Avoid having specific knowledge of internals in TeeInput
and instead move that to StreamInput when dealing with
byte counts. This makes things easier for Rainbows! which
will need to extends these classes.
commit 3b544fb2c0e4a1e14a7bcb752a8af9819b5aaeb2
Author: Eric Wong
Date: Thu Nov 11 07:31:01 2010 +0800
http_parser: ensure keepalive is disabled when reset
We'll need this in Rainbows!
commit a89ccf321224f3248ddd00bb0edb320311604e4e
Author: Eric Wong
Date: Thu Nov 11 02:16:50 2010 +0800
configurator: enable "rewindable_input" directive
This allows users to override the current Rack spec and disable
the rewindable input requirement. This can allow applications
to use less I/O to minimize the performance impact when
processing uploads.
commit 7d44b5384758aeddcb49d7606a9908308df7c698
Author: Eric Wong
Date: Thu Nov 11 01:13:12 2010 +0800
add stream_input class and build tee_input on it
We will eventually expose a Unicorn::StreamInput object as
"rack.input" for Rack 2.x applications. StreamInput allows
applications to avoid buffering input to disk, removing the
(potentially expensive) rewindability requirement of Rack 1.x.
TeeInput is also rewritten to build off StreamInput for
simplicity. The only regression is that TeeInput#rewind forces
us to consume an unconsumed stream before returning, a
negligible price to pay for decreased complexity.
commit 1493af7cc23afecc8592ce44f5226476afccd212
Author: Eric Wong
Date: Thu Nov 11 07:17:19 2010 +0800
switch versions to 3.0.0pre
Here are major, incompatible internal API changes.
commit 8edcc3f9e1be9113685e61b9a83994a02d37c768
Author: Eric Wong
Date: Sun Nov 7 10:21:43 2010 +0800
tee_input: switch to simpler API for parsing trailers
Not that anybody uses trailers extensively, but it's
good to know it's there.
commit 60a9ec94f1f738f881e67f0a881c44c104f07c04
Author: Eric Wong
Date: Sat Nov 6 10:30:44 2010 +0800
http_parser: add HttpParser#next? method
An easy combination of the existing HttpParser#keepalive? and
HttpParser#reset methods, this makes it easier to implement
persistence.
commit 7987e1a4001491f8a494f3926037f8cbee713263
Author: Eric Wong
Date: Fri Sep 3 01:48:24 2010 +0000
enable HTTP keepalive support for all methods
Yes, this means even POST/PUT bodies may be kept alive,
but only if the body (and trailers) are fully-consumed.
commit b45bf946545496cf8d69037113533d7a58ce7e20
Author: Eric Wong
Date: Thu Oct 28 09:03:21 2010 +0000
t0012: fix race condition in reload
We need to ensure the old worker is reaped before sending
new requests intended for the new worker.
commit 5ffc1f81c3f56d17ff3369f7514e978754840c29
Author: Eric Wong
Date: Wed Oct 27 23:32:24 2010 +0000
unicorn 2.0.0 - mostly internal cleanups
Despite the version number, this release mostly features
internal cleanups for future versions of Rainbows!. User
visible changes include reductions in CPU wakeups on idle sites
using high timeouts.
Barring possible portability issues due to the introduction of
the kgio library, this release should be ready for all to use.
However, 1.1.x (and possibly 1.0.x) will continue to be
maintained. Unicorn 1.1.5 and 1.0.2 have also been released
with bugfixes found during development of 2.0.0.
commit a3b08e9411f1d958e2264329c67972541424ac35
Merge: 0692e8c 7f3ebe9
Author: Eric Wong
Date: Wed Oct 27 23:31:41 2010 +0000
Merge branch '1.1.x-stable'
* 1.1.x-stable:
unicorn 1.1.5
doc: stop using deprecated rdoc CLI options
gemspec: depend on Isolate 3.0.0 for dev
configurator: reloading with unset values restores default
configurator: use "__send__" instead of "send"
Rakefile: capture prerelease tags
Rakefile: don't post freshmeat on empty changelogs
fix delays in signal handling
commit 0692e8cb10dd27275f2de794ed6eba62e9918431
Merge: 4d493d8 ea975cc
Author: Eric Wong
Date: Wed Oct 27 23:31:38 2010 +0000
Merge branch 'maint'
* maint:
unicorn 1.0.2
doc: stop using deprecated rdoc CLI options
gemspec: depend on Isolate 3.0.0 for dev
configurator: reloading with unset values restores default
configurator: use "__send__" instead of "send"
Rakefile: capture prerelease tags
Rakefile: don't post freshmeat on empty changelogs
fix delays in signal handling
SIGTTIN works after SIGWINCH
commit 7f3ebe9213e09932cd0e8a2a82bfe2dd5430a824
Author: Eric Wong
Date: Wed Oct 27 23:29:55 2010 +0000
unicorn 1.1.5
This maintenance release fixes several long-standing but
recently-noticed bugs. SIGHUP reloading now correctly restores
default values if they're erased or commented-out in the Unicorn
configuration file. Delays/slowdowns in signal handling since
0.990 are fixed, too.
commit 4d493d8ad203d7f13ac56b7d6ba2b3aaa481cbd2
Author: Eric Wong
Date: Wed Oct 27 16:26:28 2010 -0700
examples/unicorn.conf: add a note about throttling signals
Sending the same signal faster than the receiver can process
means signals can get lost.
commit ea975cc3e6d2e6ac9c971c8cbda712486ec63c2a
Author: Eric Wong
Date: Wed Oct 27 23:11:09 2010 +0000
unicorn 1.0.2
This is the latest maintenance release of the 1.0.x series.
All users are encouraged to upgrade to 1.1.x stable series
and report bugs there.
Shortlog of changes since 1.0.1:
Eric Wong (8):
SIGTTIN works after SIGWINCH
fix delays in signal handling
Rakefile: don't post freshmeat on empty changelogs
Rakefile: capture prerelease tags
configurator: use "__send__" instead of "send"
configurator: reloading with unset values restores default
gemspec: depend on Isolate 3.0.0 for dev
doc: stop using deprecated rdoc CLI options
commit 7207a8cbd1f0fbfd8c8543fd21e4f04ecff6e2f5
Author: Eric Wong
Date: Wed Oct 27 23:07:42 2010 +0000
doc: stop using deprecated rdoc CLI options
-N and -a switches no longer exist in rdoc 2.5
(cherry picked from commit 054c7df93db61839648925cfd881ae880709a210)
commit 427862fa9884aae96c9d39f35e09be292d2928ab
Author: Eric Wong
Date: Wed Oct 27 23:09:19 2010 +0000
gemspec: depend on Isolate 3.0.0 for dev
No reason to not use the latest and greatest!
(cherry picked from commit 570a57c07fd8c3d24b7337637e0dd30136b3a11a)
Conflicts:
unicorn.gemspec
commit 856959cc0b2dbc96f115d26672d0f5b73ae79914
Author: Eric Wong
Date: Wed Oct 27 23:07:42 2010 +0000
doc: stop using deprecated rdoc CLI options
-N and -a switches no longer exist in rdoc 2.5
(cherry picked from commit 054c7df93db61839648925cfd881ae880709a210)
commit 04f0f44f9bd0907fcff1e2cdc59f7e84d4110539
Author: Eric Wong
Date: Wed Oct 27 23:08:51 2010 +0000
gemspec: depend on Isolate 3.0.0 for dev
No reason to not use the latest and greatest!
(cherry picked from commit 570a57c07fd8c3d24b7337637e0dd30136b3a11a)
Conflicts:
unicorn.gemspec
commit 054c7df93db61839648925cfd881ae880709a210
Author: Eric Wong
Date: Wed Oct 27 23:07:42 2010 +0000
doc: stop using deprecated rdoc CLI options
-N and -a switches no longer exist in rdoc 2.5
commit 570a57c07fd8c3d24b7337637e0dd30136b3a11a
Author: Eric Wong
Date: Wed Oct 27 23:06:45 2010 +0000
gemspec: depend on Isolate 3.0.0 for dev
No reason to not use the latest and greatest!
commit 2dd4a89d5726e13b962c1e287d84a6c30f5dd46c
Author: Eric Wong
Date: Wed Oct 27 13:51:12 2010 -0700
configurator: reloading with unset values restores default
If a configuration directive is set at startup and later
unset, it correctly restores the original default value
as if it had never been set in the first place.
This applies to the majority of the configuration values with
a few exceptions:
* This only applies to stderr_path and stdout_path when
daemonized (the usual case, they'll be redirected to
"/dev/null"). When NOT daemonized, we cannot easily redirect
back to the original stdout/stderr destinations.
* Unsetting working_directory does not restore the
original working directory where Unicorn was started.
As far as we can tell unsetting this after setting it is
rarely desirable and greatly increases the probability of
user error.
(cherry picked from commit 51b2b90284000aee8d79b37a5406173c45ae212d)
commit 5e672c48d8a3555e4a01f653fb2e0b3556087737
Author: Eric Wong
Date: Wed Oct 27 12:46:46 2010 -0700
configurator: use "__send__" instead of "send"
It's less ambiguous since this is a network server after all.
(cherry picked from commit f62c5850d7d17d7b5e301a494f8bdf5be3674411)
commit cb2c86aaa692c02f0e1810facfe244f28ddb36ae
Author: Eric Wong
Date: Wed Oct 27 13:51:12 2010 -0700
configurator: reloading with unset values restores default
If a configuration directive is set at startup and later
unset, it correctly restores the original default value
as if it had never been set in the first place.
This applies to the majority of the configuration values with
a few exceptions:
* This only applies to stderr_path and stdout_path when
daemonized (the usual case, they'll be redirected to
"/dev/null"). When NOT daemonized, we cannot easily redirect
back to the original stdout/stderr destinations.
* Unsetting working_directory does not restore the
original working directory where Unicorn was started.
As far as we can tell unsetting this after setting it is
rarely desirable and greatly increases the probability of
user error.
(cherry picked from commit 51b2b90284000aee8d79b37a5406173c45ae212d)
commit 19b0ac826b9afd283f4cf5c57d554d20f24d2b46
Author: Eric Wong
Date: Wed Oct 27 12:46:46 2010 -0700
configurator: use "__send__" instead of "send"
It's less ambiguous since this is a network server after all.
(cherry picked from commit f62c5850d7d17d7b5e301a494f8bdf5be3674411)
commit 51b2b90284000aee8d79b37a5406173c45ae212d
Author: Eric Wong
Date: Wed Oct 27 13:51:12 2010 -0700
configurator: reloading with unset values restores default
If a configuration directive is set at startup and later
unset, it correctly restores the original default value
as if it had never been set in the first place.
This applies to the majority of the configuration values with
a few exceptions:
* This only applies to stderr_path and stdout_path when
daemonized (the usual case, they'll be redirected to
"/dev/null"). When NOT daemonized, we cannot easily redirect
back to the original stdout/stderr destinations.
* Unsetting working_directory does not restore the
original working directory where Unicorn was started.
As far as we can tell unsetting this after setting it is
rarely desirable and greatly increases the probability of
user error.
commit f62c5850d7d17d7b5e301a494f8bdf5be3674411
Author: Eric Wong
Date: Wed Oct 27 12:46:46 2010 -0700
configurator: use "__send__" instead of "send"
It's less ambiguous since this is a network server after all.
commit 928a88d5419210380078a2e141cb64d308719295
Author: Eric Wong
Date: Wed Oct 6 01:27:45 2010 +0000
Rakefile: capture prerelease tags
Since we do those, now.
(cherry picked from commit 1d1a2b1bd5bdd89f774f19bf8ad24c2f5f8a2d4c)
commit 74dec350d93b88c0a5bd792239671097901e2393
Author: Eric Wong
Date: Wed Oct 27 19:32:55 2010 +0000
Rakefile: don't post freshmeat on empty changelogs
We don't want to flood or monopolize freshmeat.
(cherry picked from commit 1ad510d645e0c84c8d352ac0deaeefa75240ea94)
commit c7feb7e10a937df2dc72f53aa6cc1ebda4c1cd3b
Author: Eric Wong
Date: Wed Oct 27 12:43:14 2010 -0700
configurator: switch to normal class
No point in using a Struct for (1.8) space-efficiency
if there's only one of them.
commit 5a220b889ba9e56ea9fea24bbae4e38e7d7e31d5
Author: Eric Wong
Date: Wed Oct 6 01:27:45 2010 +0000
Rakefile: capture prerelease tags
Since we do those, now.
(cherry picked from commit 1d1a2b1bd5bdd89f774f19bf8ad24c2f5f8a2d4c)
commit 1ad510d645e0c84c8d352ac0deaeefa75240ea94
Author: Eric Wong
Date: Wed Oct 27 19:32:55 2010 +0000
Rakefile: don't post freshmeat on empty changelogs
We don't want to flood or monopolize freshmeat.
commit 8d626390cecb0134ad2d43a055eacd7856ab44f1
Author: Eric Wong
Date: Wed Oct 27 02:02:11 2010 +0000
fix delays in signal handling
There is no need to loop in the master_sleep method at all, as
the rest of the code is designed to function even on interrupted
sleeps.
This change is included as part of a larger cleanup in master.
(commit bdc79712e5ac53d39c51e80dfe50aff950e5053f). From maint:
(cherry picked from commit 10037f2aabb3fab4296fc90c615e7caa9f4a9b53)
Conflicts:
lib/unicorn.rb
commit 10037f2aabb3fab4296fc90c615e7caa9f4a9b53
Author: Eric Wong
Date: Wed Oct 27 01:44:33 2010 +0000
fix delays in signal handling
There is no need to loop in the master_sleep method at all, as
the rest of the code is designed to function even on interrupted
sleeps.
This change is included as part of a larger cleanup in master.
(commit bdc79712e5ac53d39c51e80dfe50aff950e5053f)
commit 514af94321ef0fab74894e517792c4a9709d76f5
Author: Eric Wong
Date: Wed Oct 27 00:36:25 2010 +0000
reduce master process wakeups
To reduce CPU wakeups and save power during off hours,
we can precalculate a safe amount to sleep before killing
off idle workers.
commit 7ef05ec23b06f06e9d4bb1cf45d1907b4eeacb80
Author: Eric Wong
Date: Tue Oct 26 23:19:09 2010 +0000
master: remove limit on queued signals
If a moronic sysadmin is sending too many signals, just let them
do it. It's likely something is terribly wrong when the server
is overloaded with signals, so don't try to protect users from
it. This will also help in case where TTOU signals are sent too
quickly during shutdown, although sleeping between kill(2)
syscalls is always a good idea because of how non-real-time
signals are delivered.
commit 5a0506c2affd2f5abe6e7315121e67aa3e32b253
Author: Eric Wong
Date: Fri Jul 16 08:25:32 2010 +0000
SIGTTIN works after SIGWINCH
In addition to SIGHUP, it should be possible to gradually bring
workers back up (to avoid overloading the machine) when rolling
back upgrades after SIGWINCH.
Noticed-by: Lawrence Pit
ref: http://mid.gmane.org/4C3F8C9F.2090903@gmail.com
(cherry picked from commit e75ee7615f9875db314a6403964e7b69a68b0521)
|