about summary refs log tree commit homepage
path: root/lib/rainbows/thread_pool.rb
DateCommit message (Collapse)
2011-04-10thread_pool: get used of dead thread_join method
It's in the JoinThreads module now
2011-03-22thread_pool+thread_spawn: update documentation
They're not bad with slow clients a previously thought.
2011-02-05*epoll: refactor common loop code
acceptor thread pools could use some work, still
2011-01-06eliminate G constant and just use the Rainbows! module
Code organization is hard :<
2011-01-04globally refactor Range handling for responses
Rack::Utils::HeaderHash is still very expensive in Rack 1.2, especially for simple things that we want to run as fast as possible with minimal interference. HeaderHash is unnecessary for most requests that do not send Content-Range in responses.
2010-12-27thread_pool: avoid needless wakeups from select
No point in waking up when our ticker runs in a separate thread.
2010-12-27thread_*: unindent
Hopefully this will make our code easier to follow.
2010-09-28start using kgio library
It removes the burden of byte slicing and setting file descriptor flags. In some cases, we can remove unnecessary peeraddr calls, too.
2010-08-26split out accept() callers to acceptor module
Trying to avoid adding singleton methods since it's too easily accessible by the public and not needed by the general public. This also allows us (or just Zbatery) to more easily add support systems without FD_CLOEXEC or fcntl, and also to optimize away a fcntl call for systems that inherit FD_CLOEXEC.
2010-07-10doc: avoid documenting internals on RDoc website
Since we suck at building websites, we just rely on RDoc as a website builder. And since Rainbows! is an application server (and not a programming library), our internal API should be of little interest to end users. Anybody interested in Rainbows! (or any other project) internals should be reading the source.
2010-07-04thread_pool: force threads to wakeup on shutdown
We may use a blocking accept() loop if there is only a single listener. In that case threads may not be able to exit if a SIGQUIT is received, so force them to run when joining.
2010-06-18prefer Array#[] lookup to Array#first/Array#last
Array#[] lookups are slightly faster under both rbx and 1.9, and easier to read.
2009-12-29quiet spurious wakeups for accept() in Thread* models
Under all MRI 1.8, a blocking Socket#accept Ruby method (needs to[1]) translate to a non-blocking accept(2) system call that may wake up threads/processes unnecessarily. Unfortunately, we failed to trap and ignore EAGAIN in those cases. This issue did not affect Ruby 1.9 running under modern Linux kernels where a _blocking_ accept(2) system call is not (easily, at least) susceptible to spurious wakeups. Non-Linux systems running Ruby 1.9 may be affected. [1] - using a blocking accept(2) on a shared socket with green threads is dangerous, as noted in commit ee7fe220ccbc991e1e7cbe982caf48e3303274c7 (and commit 451ca6997b4f298b436605b7f0af75f369320425)
2009-12-16join_threads method is exclusive to ThreadPool
2009-11-29refactor threaded models to use blocking accept() if possible
It's a tad faster for non-keepalive connections and should do better on large SMP machines with many workers AND threads. That means the ActorSpawn model in Rubinius is nothing more than ThreadSpawn underneath (for now).
2009-11-28common Rainbows.accept method
2009-11-26cleanup and refactor error handling
Make sure app errors get logged correctly, and we no longer return a 500 response when a client EOFs the write end (but not the read end) of a connection.
2009-11-06cleanup worker heartbeat and master deathwatch
It turns out neither the EventMachine and Rev classes checked for master death in its heartbeat mechanism. Since we managed to forget the same thing twice, we now have a test case for it and also centralized the code to remove duplication.
2009-11-04thread_pool: update fchmod heartbeat every second
Like the rest of the concurrency models. This gives us more flexibility in case a process-wide blocking operation started during an "unlucky" period when the join timeout was about to expire.
2009-11-01thread_pool: comment for potential SMP issue under 1.9
The problem is unconfirmed at the moment, but I've long anticipated it. I just need to remember the next time I log into a monster machine.
2009-10-17refactor graceful shutdowns again, harder
We use the "G" global constant from the Rev model everywhere to simplify things a little. Test cases are more consistent now, too.
2009-10-17DRY setting of rack.multithread
It's more fool-proof this way and prevents us from using idiotic/non-obvious concurrency model names.
2009-10-17Fix graceful shutdown handling of Thread* models harder
I need better tests for graceful shutdown...
2009-10-14documentation updates (mostly on network models)
2009-10-14rack.multithread is only true for Thread* models
Enabling thread-safe or thread-aware code paths in applications may even be dangerous in some cases and cause deadlocks in code that otherwise does not expect threads. This is especially true of the Revactor case where being a "drop-in" replacement for IO routines is dangerous if a mutex is held while an Actor performs a "blocking" I/O operation. Basically start to assume that anybody writing an app using Rev or Revactor already takes Rev/Revactor concurrency into account and won't need the rack.multithread flag set to do special things.
2009-10-11Fix graceful shutdowns for threaded models
They were completely broken in the refactoring :x
2009-10-11cleanup thread models, threads no longer time out
The process-based heartbeat continues, but we no longer time threads out just because a client is idle for any reason (for now).
2009-10-11No need to be halving timeout, already done for us
In Unicorn by HttpServer#init_worker_process
2009-10-11expand and share init_worker_process
This can be common across everything
2009-10-11graceful exit on trap TypeError from IO.select
Avoid potential race conditions with signal handlers, this makes exits cleaner since the LISTENERS array will get map!-ed to nils in the :QUIT signal handler.
2009-10-11factor out common listen loop error handling
It'll be easier to maintain a common language for logging and debugging.
2009-10-08fchmod heartbeat flips between 0/1
This is for compatibility with OpenBSD as reported by Jeremy Evans for Unicorn.
2009-10-05less error-prone timeouts for Thread models
Avoid calling chmod on "false" leading to NoMethodError and rely entirely on LISTENERS.first being valid.
2009-10-05Thread* models: cleanup timeout management
Ensure we reset the per-thread time Thread.current[:t] with each connection so we don't timeout long-lived connections.
2009-10-05huge documentation revamp
2009-10-03thread_pool: Thread#kill! is gone in 1.9.2
So are Thread#terminate! and Thread#exit!, so we use Thread#kill instead.
2009-10-03common Base class for all concurrency models
They're similar enough (especially as far as the constants go) and allows a :Base to be used which basically acts like plain Unicorn but with HTTP keepalive + pipelining support
2009-10-02set "encoding: binary" for all files
2009-10-02initial revision
No tests yet, but the old "gossamer" and "rainbows" branches seem to be basically working.