Date | Commit message (Collapse) |
|
|
|
We do this in both the worker and master processes, so avoid
repeating ourselves.
|
|
This allows dynamic tuning of the worker_processes count without
having to restart existing ones. This also allows
worker_processes to be set to a low initial amount in the config
file for low-traffic deployments/upgrades and then scaled up as
the old processes are killed off.
Remove the proposed reexec_worker_processes from TODO since this
is far more flexible and powerful.
This will allow not-yet-existent third-party monitoring tools to
dynamically change and scale worker processes according to site
load without increasing the complexity of Unicorn itself.
|
|
Seems like a good idea to be able to relocate log
files on a config reload.
|
|
Saying to the world that I may have OCD...
|
|
As long as our speculative accept()s are succeeding, then avoid
checking for master process death and keep processing requests.
This allows us to save some syscalls under extremely heavy
traffic spikes.
|
|
Oops, this was broken in another yak-shaving commit:
9206bb5e54a0837e394e8b1c1a96e27ebaf44e77
|
|
Avoid scaring the thread-safety-first crowd (as much :)
|
|
Since it has to work inside signal handlers, there's
no point in making it a per-object instance variable
given the price of an instance variable in MRI...
|
|
Avoid creating garbage every time we lookup the status code
along with the message. Also, we can use global const arrays
for a little extra performance because we only write one-at-a
time
Looking at MRI 1.8, Array#join with an empty string argument is
slightly better because it skips an append for every iteration.
|
|
|
|
Otherwise the GC will unlink sockets. A better
solution (purgatory?) may be needed...
|
|
Instance variables are expensive and we'd be encouraging
something like a thread-safe mentality for using ivars
when dealing with things that are global to the entire
process.
|
|
Since file descriptors are only private to a process,
do not treat them as Object-specific.
|
|
This leads to a ~10% improvement in test/benchmark/request.rb
Some of these changes will need to be reworked for
multi-threaded servers (Mongrel); but Unicorn will always be
single-threaded.
|
|
* commit 'v0.5.4':
unicorn 0.5.4
Fix data corruption with small uploads via browsers
Conflicts:
lib/unicorn/http_request.rb
|
|
|
|
I've experienced occasional problems with this so it's
probably best to stay on the safe side.
|
|
|
|
It was just a waste of space and would've caused line wrapping.
This reinstates the "unicorn" prefix when we create tempfiles,
too.
|
|
|
|
StringIO.new(partial_body) does not update the offset for new
writes. So instead create the StringIO object and then syswrite
to it and try to follow the same code path used by large uploads
which use Tempfiles.
|
|
StringIO.new(partial_body) does not update the offset for new
writes. So instead create the StringIO object and then syswrite
to it and try to follow the same code path used by large uploads
which use Tempfiles.
|
|
Installation dependencies weren't being resolved correctly
(since "install-test") wasn't .PHONY. Removed the
"install-test" target entirely since it should never
be invoked by hand.
On the other hand, "ragel" can be useful to invoke by hand
so add a target for that.
|
|
|
|
|
|
They aren't common, but apparently there exist
URLs with them, so we'll support them.
|
|
It's pointless to support multiple instances of it since
this is per-process. However, the constant itself is now
modifiable if anybody needs to tweak things for reexecution
using a before_exec hook.
|
|
We no longer have anything outside of SocketHelper module in
that file, so just give it a more obvious name.
|
|
This removes the #unicorn_peeraddr methods from TCPSocket and
UNIXSocket core classes. Instead, just move that logic into the
only place it needs to be used in HttpRequest.
|
|
This avoids creating yet another binding. socket.syswrite()
should really only be called once since we use blocking sockets,
but just in case, we emulate a do+while loop with begin+while
|
|
We now parse the scheme, host and port from Absolute URIs and
ignore them if the equivalents are specified in the other
headers.
|
|
Use the "do {} while (0)" idiom to wrap the macros we can
wrap to avoid having to worry about semi-colons when using
them.
Unfortunately DEF_MAX_LENGTH can't be wrapped with "do {} while
(0)". But we do now correctly constify the strings
DEF_MAX_LENGTH creates and also make them static to reduce
visibility.
|
|
This means "Host: foo-bar:" (trailing colon) will assume
server_port is 80, not a blank string.
|
|
While we're at it, replace a bunch of zero assignments
with a memset to avoid forgetting a struct element in
case we change the struct.
|
|
I don't see the point of using a macro here as it's never called
in a hot path. It's a very minor size reduction in the binary,
but also makes the rest of the code less noisy/screamy.
|
|
There's no point in having redefinable callbacks if they're
always going to be pointed to the same function. This reduces
the size of the http_parser structure to half its original size.
This change may actually make more sense in servers Mongrel/Thin
than Unicorn since Unicorn only has one parser per-process while
other servers can have hundreds or even thousands.
|
|
|
|
|
|
It's fast under 1.8, but 1.9 performance is really
terrible, so run the tests in parallel.
|
|
|
|
Otherwise applications can change them behind our back
and affect subsequent requests.
|
|
We don't do anything special with content length in the parser
other than forcing the headers without the "HTTP_" prefix for
Rack-compliance.
|
|
It's part of the HTTP/1.1 (rfc2616), so we might as well
handle it in there and set PATH_INFO while we're at it.
Also, make "OPTIONS *" test not fail Rack::Lint
|
|
I have a nice hook in git that complains when trailing
whitespace is present.
|
|
|
|
Remove ctype.h and stdio.h #includes. We avoid ctype.h
functions since it is locale-dependent and HTTP itself is
locale-independent.
Also, regenerate http11_parser.c against Ragel 6.4
|
|
Sockets always return binary encoded data, so when
StringIO.new(string) is called, that StringIO object inherits
the encoding of the initial string it was created with.
And yes, Ruby 1.9 still makes me seriously uncomfortable with
I/O manipulation since the encoding layer does things behind my
back. UNIX is (and should always be) just a bag of bytes!
Signed-off-by: Eric Wong <normalperson@yhbt.net>
|
|
|
|
Avoid creating new string objects and then discarding them right
away by stuffing non-constant but always-present headers into
the initial output.
|