Release Name: 0.4.1
Notes:
A small fast HTTP library and server for Rack applications.
Rails (1.2+) support + tests, small bug fixes, documentation.
Changes:
commit 6171c709e8814afd8e41b101106b434f0fd4da9b
Author: Eric Wong <normalperson@yhbt.net>
Date: Wed Apr 1 03:52:08 2009 -0700
unicorn 0.4.1
commit 4ab4cd579645be68857b8bf1da02d426833ab51a
Author: Eric Wong <normalperson@yhbt.net>
Date: Wed Apr 1 03:43:15 2009 -0700
Add local.mk.sample file that I use
The real reason for Unicorn is to popularize GNU Make as a
parallel programming platform :)
commit c0d79dbb2e5f0f23236c60a0e7c5bb92be2512aa
Author: Eric Wong <normalperson@yhbt.net>
Date: Wed Apr 1 03:35:47 2009 -0700
Documentation updates, prep for 0.4.1 release
commit f30bfcff2564d6114db9a44cccbad87863dcb913
Author: Eric Wong <normalperson@yhbt.net>
Date: Wed Apr 1 02:09:59 2009 -0700
Manifest update
commit 234293e1af0c5fdd93065ccda3365e8c3d70ab17
Author: Eric Wong <normalperson@yhbt.net>
Date: Wed Apr 1 02:07:12 2009 -0700
test_rails: 4x speedup
Loading Rails takes a very long time, so consolidate most of the
tests into one big test that allows us to avoid loading Rails.
It makes the test less like unit tests, but they could still
be split up into private functions if one wants to run them
individually.
commit ef9a2f05f3e14455dc70a5e0f68b0cf317a8709c
Author: Eric Wong <normalperson@yhbt.net>
Date: Wed Apr 1 01:43:44 2009 -0700
Add more tests for Rails
Additional tests for Rails have been added
* cookies and sessions
* POST requests
* POST requests with multipart uploads
* 404 handling
* static file serving
* cached static file serving
(resources with ";" caching in some old 1.2.x version
not yet tested)
commit b2569b344d61a7d26033aeb6198d23f99d2e7f3e
Author: Eric Wong <normalperson@yhbt.net>
Date: Wed Apr 1 01:19:27 2009 -0700
cgi_wrapper: HTTP status code cleanups
The default status was 404 in Mongrel and this is needed to work
with older versions of Rails. Additionally parse the "Status:"
header if it ever got set and the actual "status" code passed
to CGI::headers was not set.
commit ad6a90ea1e0c1bd3959944f46672d754546dfb33
Author: Eric Wong <normalperson@yhbt.net>
Date: Wed Apr 1 01:12:12 2009 -0700
GNUmakefile: prefix errors with $(extra) variable
Otherwise it's hard to tell which version of Rails
test failed when we ran tests in parallel.
commit 3814e43aa2352d1b0d99470a9d52c68496819d69
Author: Eric Wong <normalperson@yhbt.net>
Date: Wed Apr 1 01:04:38 2009 -0700
cgi_wrapper: fix cookies and other headers
The @output_cookies instance variable was being
ignored, and some versions of Rails uses that.
Additionally, cleanup multi-value headers in
general to avoid dropping headers.
commit 71c8ce651166b49178676f1c37723aa34c4ef9e5
Author: Eric Wong <normalperson@yhbt.net>
Date: Tue Mar 31 19:15:50 2009 -0700
test: factor out exec helpers into common code for Rails tests
commit aba465e9d196737b07786a759ba320c89ae31c2e
Author: Eric Wong <normalperson@yhbt.net>
Date: Tue Mar 31 17:34:10 2009 -0700
Rails stack tests for unicorn_rails
Very preliminary for now. Basically just sets up a basic
controller and response. Requires git to clone the official
Rails repository.
commit 3adce6a1a803a00cb5cc9da758a10a658aab98ec
Author: Eric Wong <normalperson@yhbt.net>
Date: Tue Mar 31 17:10:49 2009 -0700
unicorn_rails: cleanup path mapping usage
Just use the RAILS_RELATIVE_URL_ROOT variable to support it
since probably works on more versions of Rails. Since no
application I've ever deployed has ever used it, I'm not going
to bother supporting it for Rails <2.3, either.
commit 7dd3d804e9199a201aa62b7f7e7c28ddeace99c5
Author: Eric Wong <normalperson@yhbt.net>
Date: Tue Mar 31 00:37:49 2009 -0700
Use {read,write}_nonblock on the pipe
Instead of trusting sysread/syswrite to throw EAGAIN if the pipe
is full (highly unlikely); just use non-blocking methods which
are indeed non-blocking and don't care for the #blocking= method
added to it.
commit 6ab8a56ed27320746cf6d95a1b3e9fe4ddb99d75
Author: Eric Wong <normalperson@yhbt.net>
Date: Tue Mar 31 00:28:33 2009 -0700
unicorn_rails: minor cleanup for dead variable
This removes half-implemented support to disable static file
serving. People interested enough can provide their own
config.ru file to save some stat(2) syscalls, but extra
command-config options just complicate things.
commit 1c18400490d2567cfa44ae96f319d80415b36587
Author: Eric Wong <normalperson@yhbt.net>
Date: Tue Mar 31 00:27:32 2009 -0700
configurator: remove unnecessary SocketHelper include
commit 1d127ce0b2edcc8b03e4cb1031ff341ff91770fe
Author: Eric Wong <normalperson@yhbt.net>
Date: Tue Mar 31 00:19:47 2009 -0700
Better canonicalization of listener paths + tests
* Expand addresses like "1:8080" to "127.0.0.1:8080"
beforehand so sock_name() in SocketHelper will
always return consistent results.
* Add support for "unix:/path/to/foo" paths for easier
synchronization with nginx config files.
commit 1bb4366c049a2d1c460cb08601865a24d7678dbe
Author: Eric Wong <normalperson@yhbt.net>
Date: Mon Mar 30 03:07:03 2009 -0700
cgi_wrapper: ensure "Status:" header is not set
Rack does not like it; instead try to set it as
the @status code if possible.
commit 8f174df6394d562bcc8542ebcd2a9e45c9a927ff
Author: Eric Wong <normalperson@yhbt.net>
Date: Mon Mar 30 01:48:28 2009 -0700
GNUmakefile: add test-exec and test-unit targets
This makes it easy to run unit or exec tests
independently of the other.
Removed the unused slow-tests targets.
commit a35ae281058411f184af53dcdbe9e58421d84f27
Author: Eric Wong <normalperson@yhbt.net>
Date: Mon Mar 30 01:44:44 2009 -0700
unicorn_rails: give more info when aborting
Makes problems easier to solve if we dump the
exception...
commit 12134471a3ba93d9882f225a368bf738844a9d18
Author: Eric Wong <normalperson@yhbt.net>
Date: Mon Mar 30 01:38:59 2009 -0700
app/old_rails/static: define missing constant
REQUEST_METHOD got removed from Unicorn::Const
and this module is the only place that currently
uses it.
commit aa2208a0574c395cf91ce7ff82e978895aa8b1b7
Author: Eric Wong <normalperson@yhbt.net>
Date: Mon Mar 30 01:29:20 2009 -0700
bin/*: parse CLI switches in config.ru sooner
This allows config.ru to specify listener and
stuff before we setup the application.
commit fa5d9473deaa345e5ca76375fbe21aaae3516b89
Author: Eric Wong <normalperson@yhbt.net>
Date: Sun Mar 29 22:56:21 2009 -0700
test_exec: fix another race condition
commit ae47e5afc5674c13bdbff3afc887a1505f15bd4f
Author: Eric Wong <normalperson@yhbt.net>
Date: Sun Mar 29 22:22:11 2009 -0700
Fix default listener setup
Combining command-line and config file options in a reasonable
manner has and always will be a painful experience.
commit 45dc7c2acae82c4699c2678017ae714f032aa8b1
Author: Eric Wong <normalperson@yhbt.net>
Date: Sun Mar 29 22:20:50 2009 -0700
test_exec: fix response bodies
They were non-conformant for the longest time
commit 5bf4908057d611a127020fca7acf35c606cade16
Author: Eric Wong <normalperson@yhbt.net>
Date: Sun Mar 29 18:59:48 2009 -0700
test_exec: fix race conditions
We need to ensure the QUIT signal to the old processes
are processed when fixing the config.
Additionally, the log rotation checker was not reliable
because the master log emitted a similar message to
the workers and we were not distinguishing between
them. Check for all 5 logs (1 master + 4 workers)
to be rotated.
commit ab45d6d64d01631a0d8e4bdd5771e4dce650f545
Author: Eric Wong <normalperson@yhbt.net>
Date: Sun Mar 29 20:15:25 2009 -0700
Avoid having two pid files pointing to the same pid
It makes test_exec more reliable and probably helps
other scripts people may run around this.
commit 066226e97c1a08f927f62ae50d7e95a9ada4f303
Author: Eric Wong <normalperson@yhbt.net>
Date: Sun Mar 29 19:01:24 2009 -0700
http11: use :http_body instead of "HTTP_BODY"
"HTTP_BODY" could conflict with a "Body:" HTTP header if there
ever is one. Also, try to hide this body from the Rack
environment before @app is called since it is only used by
Unicorn internally.
commit df58b5249c3e17ee4fab448224e3f043a2444fa0
Author: Eric Wong <normalperson@yhbt.net>
Date: Sun Mar 29 18:10:14 2009 -0700
configurator: favor "listen" directive over "listeners"
We still need to support "listeners" for easy use of
command-line options, but folks using the config file should use
"listen" as it is more flexible.
commit f65783b5a107fb515b46b17998b276d0fafd4be1
Author: Eric Wong <normalperson@yhbt.net>
Date: Sun Mar 29 17:38:01 2009 -0700
configurator: per-listener backlog, {rcv,snd}buf config
Instead of having global options for all listeners,
make all socket options per-listener. This allows
reverse-proxies to pick different listeners to get
different options on different sockets.
Given a cluster of machines (10.0.0.1, 10.0.0.2, 10.0.0.3)
running Unicorn with the following config:
------------------ 8< ----------------
listen "/tmp/local.sock", :backlog => 1
listen "*:8080" # use the backlog=1024 default
------------------ 8< ----------------
It is possible to configure a reverse proxy to try to use
"/tmp/local.sock" first and then fall back to using the
TCP listener on port 8080 in a failover configuration.
Thus the nginx upstream configuration on 10.0.0.1 to
compliment this would be:
------------------ 8< ----------------
upstream unicorn_cluster {
# reject connections ASAP if we are overloaded
server unix:/tmp/local.sock;
# fall back to other machines in the cluster via "backup"
# listeners which have a large backlog queue.
server 10.0.0.2:8080 backup;
server 10.0.0.3:8080 backup;
}
------------------ 8< ----------------
This removes the global "backlog" config option which
was inflexible with multiple machines in a cluster
and exposes the ability to change SO_SNDBUF/SO_RCVBUF
via setsockopt(2) for the first time.
commit 2886debbe557b93b9964038225e4cae58ebcedc9
Author: Eric Wong <normalperson@yhbt.net>
Date: Sun Mar 29 14:15:47 2009 -0700
TODO: update roadmap to 1.0.0
commit 9ecded1c91cc88e9c6c3df376bea1713a5ec3d05
Author: Eric Wong <normalperson@yhbt.net>
Date: Sun Mar 29 13:17:31 2009 -0700
test_response: ensure response body is closed
This is in the Rack specification and a good idea. Remind
ourselves to prevent file descriptor or other resource leaks in
case the body is not an Array.
commit 5097d2cf7359193b16fa31395efe69532a59b1d6
Author: Eric Wong <normalperson@yhbt.net>
Date: Sun Mar 29 13:06:54 2009 -0700
test_response: ensure closed socket after write
We always close the socket immediately after a
successful write for two reasons:
1) To prevent error responses from being rewritten.
If we throw an exception in our request/app/response
chain, we'll attempt to write an HTTP 400/500 response
out if the socket is open. No way to write to
an open socket.
2) To uncork the socket if TCP_CORK is enabled (Linux)
ASAP. This should be a tick faster than waiting
to go back up the stack and close it there.
commit c83b5a903a076fda67c7d062da1ad6ff9337fdd1
Author: Eric Wong <normalperson@yhbt.net>
Date: Fri Mar 27 17:26:03 2009 -0700
Always try to send a valid HTTP response back
This reworks error handling throughout the entire stack to be
more Ruby-ish. Exceptions are raised instead of forcing the
us to check return values.
If a client is sending us a bad request, we send a 400.
If unicorn or app breaks in an unexpected way, we'll
send a 500.
Both of these last-resort error responses are sent using
IO#write_nonblock to avoid tying Unicorn up longer than
necessary and all exceptions raised are ignored.
Sending a valid HTTP response back should reduce the chance of
us from being marked as down or broken by a load balancer.
Previously, some load balancers would mark us as down if we close
a socket without sending back a valid response; so make a best
effort to send one. If for some reason we cannot write a valid
response, we're still susceptible to being marked as down.
A successful HttpResponse.write() call will now close the socket
immediately (instead of doing it higher up the stack). This
ensures the errors will never get written to the socket on a
successful response.
commit 9509f414a88281c93f0a1cb28123b8ae7538ee7f
Author: Eric Wong <normalperson@yhbt.net>
Date: Fri Mar 27 17:25:24 2009 -0700
Remove needless line break
commit acd836c9a7318ee6f72675a327ab7d6c27df2d60
Author: Eric Wong <normalperson@yhbt.net>
Date: Fri Mar 27 17:24:04 2009 -0700
test_server: quieter tests
commit f2bf8e9051a71f03669d62fc3c54f288eb0249de
Author: Eric Wong <normalperson@yhbt.net>
Date: Fri Mar 27 00:40:19 2009 -0700
No need to disable luserspace buffering on client socket
Unicorn always uses lower-level sys{read,write} methods
when doing I/O so setting "client.sync=true" is just
a wasted operation.
commit fdc17e1736c1d6128c29f4baba2dd86c6ef224c6
Author: Eric Wong <normalperson@yhbt.net>
Date: Fri Mar 27 00:34:59 2009 -0700
style: symbols instead of strings for signal names
They're easier for me to type and read and just barely faster
when doing comparisons on.
commit 72ed1ceba5dbfe3656480af22740118b9e06d418
Author: Eric Wong <normalperson@yhbt.net>
Date: Fri Mar 27 00:20:24 2009 -0700
Deferred log rotation in workers
Instead of rotating logs immediately when SIGUSR1 is caught,
defer it until the current client is processing is complete.
This allows multi-line log messages generated by apps to not be
broken up if SIGUSR1 is received while the app is running.
If we're sleeping inside IO.select, we close a pipe in the
exceptfds set to cause EBADF to be raised.
This also adds a small reliability improvement to test_exec
so we wait until signals are ready before sending USR1
to rotate logs.
commit 0057c878003b41efb3a53529409f16f9073f0934
Author: Eric Wong <normalperson@yhbt.net>
Date: Thu Mar 26 22:28:42 2009 -0700
Don't allow failed log rotation to to break app
In case there are permissions problems that cause
log rotation to fail, we trap the error and defer
death until the current request finishes running.
commit 63209531722311896ac448d9170adb0766fa3eff
Merge: 1bf10b3 9c33850
Author: Eric Wong <normalperson@yhbt.net>
Date: Wed Mar 25 16:32:58 2009 -0700
Merge commit 'v0.2.3'
* commit 'v0.2.3':
unicorn 0.2.3
Ensure Tempfiles are unlinked after every request
Don't bother unlinking UNIX sockets
Conflicts:
lib/unicorn/socket.rb
commit 1bf10b3a73509f3fc72fb7f267e767c0e2fa9376
Author: Eric Wong <normalperson@yhbt.net>
Date: Wed Mar 25 01:52:09 2009 -0700
Socket: add {snd,rcv}buf opts to bind_listen
bind_listen takes a hash as its second parameter now, allowing
the addition of :sndbuf and :rcvbuf options to specify the size
of the buffers in bytes. These correspond to the SO_SNDBUF and
SO_RCVBUF options via setsockopt(2) respectively.
This also adds support for per-listener backlogs to be used.
However, this is only an internal API change and the changes
have not yet been exposed to the user via Unicorn::Configurator,
yet.
Also add a bunch of SocketHelper tests
commit 32b6e838c28b7948811a6470d8c0a49d5767ec69
Author: Eric Wong <normalperson@yhbt.net>
Date: Tue Mar 24 02:35:26 2009 -0700
simplify the HttpParser interface
This cuts the HttpParser interface down to #execute and #reset
method. HttpParser#execute will return true if it completes and
false if it is not. http->nread state is kept internally so we
don't have to keep track of it in Ruby; removing one parameter
from #execute.
HttpParser#reset is unchanged.
All errors are handled through exceptions anyways, so the
HttpParser#error? method stopped being useful.
Also added some more unit tests to the HttpParser since I know
some folks are (rightfully) uncomfortable with changing stable C
code. We now have tests for incremental parsing.
In summary, we have:
* more test cases
* less C code
* simpler interfaces
* small performance improvement
=> win \o/
commit 7110a0dc380c53433e0b76496356abe7ccfa9021
Author: Eric Wong <normalperson@yhbt.net>
Date: Tue Mar 24 01:44:36 2009 -0700
HttpRequest: small improvement for GET requests
Most HTTP requests are GET requests and the majority of those
GET requests are complete after one sysread. This is especially
true since we're optimized for fast clients. So short the extra
checks and trust our HTTP parser implementation to do the right
thing (we have decent unit tests for it).
commit 0b095ea72fb849682a1185a626eef247b5afc1cd
Author: Eric Wong <normalperson@yhbt.net>
Date: Mon Mar 23 02:03:31 2009 -0700
unicorn_rails: support non-Rack versions of Rails
This resurrects old code from Mongrel to wrap the Rails
Dispatcher for older versions of Rails. It seems that
Rails >= 2.2.0 support Rack, but only >=2.3 requires it.
I'd like to support Rails 1.2.x for a while, too.
commit 451a1022e16ec6307328125a41244a837c6edcdf
Author: Eric Wong <normalperson@yhbt.net>
Date: Sat Mar 21 22:46:34 2009 -0700
Don't bother unlinking UNIX sockets
Since we always unlink existing sockets when binding, there's no
point in having code to unlink the sockets when we exit.
Additionally, the old code path was racy.
commit 5d57a6f2525c3c1feea98d64e1caf2f32147cf7f
Author: Eric Wong <normalperson@yhbt.net>
Date: Sun Mar 22 20:39:33 2009 -0700
Streamline rack environment generation
Ensure constants are used as hash keys and cleanup unused
constants. This gives a 10-15% improvement with
test/benchmark/request.rb
commit 1835c9e2e12e6674b52dd80e4598cad9c4ea1e84
Author: Eric Wong <normalperson@yhbt.net>
Date: Sun Mar 22 21:09:08 2009 -0700
HttpResponse: speed up non-multivalue headers
The extra split slows things down a little as as it generates an
array with a new string value and adds an extra loop to iterate
through.
commit f4503b0eb9dd73296988021f355f3d28959975e5
Merge: 7866817 018f827
Author: Eric Wong <normalperson@yhbt.net>
Date: Sun Mar 22 20:58:11 2009 -0700
Merge commit 'origin/benchmark' into release
* commit 'origin/benchmark':
benchmark: header values must be strings
All new benchmarks, old ones removed
commit 018f827ebdc1668d2262ef1337386f896379e0f6
Author: Eric Wong <normalperson@yhbt.net>
Date: Sun Mar 22 20:52:00 2009 -0700
benchmark: header values must be strings
Newer versions of Unicorn "enforce" this by splitting on "\n" to
handle Rack-style multi-value headers.
commit 98ea5cca50b907e20d6357f425d7789bac1d1a47
Author: Eric Wong <normalperson@yhbt.net>
Date: Tue Mar 10 18:44:34 2009 -0700
All new benchmarks, old ones removed
dd.ru is a rackup file is intended as a dd(1)-like test for I/O
performance.
There are also individual request, response, and big_request
benchmarks for micro benchmarking some parts of Unicorn.
The rest of the benchmarks are gone: I am not interested in
performance comparisons (and pissing matches) with other web
servers (or their fanboys/girls).
I will _NEVER_ publically publish benchmarks comparing Unicorn
against other web servers. I will only compare Unicorn against
other versions of Unicorn, possibly on different platforms.
Neutral third-parties are invited to publish their own
benchmarks (along with detailed procedures, version numbers and
other details) comparing Unicorn to other servers.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
|