about summary refs log tree commit homepage
path: root/lib
DateCommit message (Collapse)
2009-04-25unicorn 0.7.0 v0.7.0
2009-04-25Rack 1.0.0 compatibility
Keep in mind that it's plenty possible to use Unicorn as a library without using Rack itself. Most of the unit tests do not depend on Rack, for example.
2009-04-25Fix log rotation being delayed in workers when idle
We were closing a no-longer-existent I/O object to break out of IO.select. This was broken in 0.6.0 but did not affect the worker when it was busy.
2009-04-24configurator: "listen" directive more nginx-like
The following specifications to bind port 8080 on all interfaces are now accepted in the configuration file: listen "8080" # (with quotes) listen 8080 # (without quotes)
2009-04-24unicorn 0.6.0 v0.6.0
2009-04-24cleanup: avoid duped self-pipe init/replacement logic
We do this in both the worker and master processes, so avoid repeating ourselves.
2009-04-24SIGTT{IN,OU} {in,de}crements worker_processes
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.
2009-04-24Allow std{err,out}_path to be changed via HUP
Seems like a good idea to be able to relocate log files on a config reload.
2009-04-24minor cleanups and save a few variables
Saying to the world that I may have OCD...
2009-04-24Avoid getppid() if serving heavy traffic
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.
2009-04-24Fixup reference to a dead variable
Oops, this was broken in another yak-shaving commit: 9206bb5e54a0837e394e8b1c1a96e27ebaf44e77
2009-04-23Describe the global constants we use.
Avoid scaring the thread-safety-first crowd (as much :)
2009-04-23make SELF_PIPE is a global constant
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...
2009-04-23http_response: minor performance gains
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.
2009-04-23http_response: just barely faster
2009-04-23Make LISTENERS and WORKERS global constants, too
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.
2009-04-23IO_PURGATORY should be a global constant
Since file descriptors are only private to a process, do not treat them as Object-specific.
2009-04-23http_request: micro optimizations
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.
2009-04-23Get rid of UNICORN_TMP_BASE constant
It was just a waste of space and would've caused line wrapping. This reinstates the "unicorn" prefix when we create tempfiles, too.
2009-04-23Fix data corruption with small uploads via browsers
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.
2009-04-21Cleanup some unnecessary requires
2009-04-21Remove @start_ctx instance variable
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.
2009-04-21rename socket.rb => socket_helper.rb
We no longer have anything outside of SocketHelper module in that file, so just give it a more obvious name.
2009-04-21Stop extending core classes
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.
2009-04-21http_response: small speedup by eliminating loop
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
2009-04-21const: remove unused QUERY_STRING constant
2009-04-21HttpParser: set QUERY_STRING for Rack-compliance
2009-04-21http_request: freeze modifiable elements
Otherwise applications can change them behind our back and affect subsequent requests.
2009-04-21Move absolute URI parsing into HTTP parser
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
2009-04-16unicorn 0.5.3 v0.5.3
2009-04-16Small garbage reduction in HttpResponse
Avoid creating new string objects and then discarding them right away by stuffing non-constant but always-present headers into the initial output.
2009-04-16remove DATE constant
We never use it anywhere explicitly for hash lookups
2009-04-16fix 100% CPU usage when idle
Oops, that was not just speculative accept(), but spammy accept()...
2009-04-16unicorn 0.5.2 v0.5.2
2009-04-16unicorn/const: kill trailing whitespace
Trailing whitespace glows *RED* every time I open this file to edit a constant and that annoys me.
2009-04-16ensure responses always have the "Status:" header
There are weird (and possibly broken) clients out there that require it despite being present in the first line of the response. So be nice and accomodate them. Keep in mind that the Rack SPEC explicitly forbids this header from being in the headers returned by the Rack-based application; so we have to always inject it ourselves and ignore it if the application sets it.
2009-04-15worker_loop cleanups, var golf, and yak-shaving
Ensure we always fchmod our tempfile in case of client error to avoid getting nuked in the next request cycle. Also, kill off some unnecessary variables since this method has too many variables anyways and we can overload the "nr" counter to do what "accepted" and "reopen_logs" did..
2009-04-15before_commit and before_exec can never be nil/false
So don't bother checking them again. Configurator already ensures that they're Proc objects for us, and we've been forgetting to check @before_fork since the beginning of time anyways... Consistency + less code = good
2009-04-14s/rotating/reopening/g in log messages
We don't (and won't ever) do log rotation within the process. That's the job of logrotate and tools like that. We just reopen logs like other reasonable daemons out there.
2009-04-14Explicitly trap SIGINT/SIGTERM again
Otherwise we get generally worthless backtraces and we don't want to clobber those for other signals, either.
2009-04-13unicorn 0.5.1 v0.5.1
2009-04-13Fix SIGINT/SIGTERM handling (broken in 0.5.0)
By reraising SignalException in workers. Since we just rely on default signal handlers for the majority of signals now, ensure those signals actually exit the process.
2009-04-13unicorn 0.5.0 v0.5.0
2009-04-13Configurator: add example for user/group switching
I don't advocate running Unicorn on unprivileged ports anyways since Unicorn should never be exposed directly to public clients.
2009-04-13Expose worker to {before,after}_fork hooks
Instead of just worker.nr. This is a configuration file/API change and will break existing configurations. This allows worker.tempfile to be exposed to the hooks so ownership changes can still happen on it. On the other hand, I don't know of many people actually using this feature (or Unicorn).
2009-04-13Remove unnecessary local variables in process_client
I'm golfing, really, but maybe we can be 0.00001% faster if we avoid naming some variables...
2009-04-13small cleanups in signal handling and worker init
Since signals and signal handlers are process-wide, just make SIG_QUEUE a global constant since there's absolutely no reason it should be otherwise... Restore default signal handlers when building app in case our app does anything strange or gets hung, it's nice to know SIG{INT,TERM} can be used to kill it while it's loading. Additionally, there's little point in clearing arrays before nilling them: just trust the GC to do its job properly.
2009-04-12old_rails: try harder to ensure valid responses
Hopefully the world will just move to Rack faster so we have less things to worry about.
2009-04-12Don't bother restoring ENV or umask across reexec
If someone changes ENV or umask in the master process (via before_fork or when loading the config), assume it was intentional and just preserve it across reexec.
2009-04-12Remove unnecessary sync assignment
We never write to the file anyways, and fchmod is never buffered