Jimmy Soho <[email protected]> wrote:
> Hi,
> 
> Some more questions still:
> 
> It seems a worker uses the exact same thread to handle each request.

Correct.

> Is that guaranteed to happen for the lifetime of a worker? Or are
> there cases where a unicorn worker might spin a new thread to handle
> the next requests?

Unicorn itself is always single-threaded and never spawns new threads.

> If the same thread is always used, isn't that a potential issue when
> programmers use thread local variables, which are not reset at the
> next request?  (I know, the usage of thread local variables is not
> recommended, but take a random rails project, go into their $GEM_HOME
> and do grep -r Thread.current . , see what I mean..)

Thats the problem of those libraries/apps, not Unicorn.

They can try Rainbows! using the :ThreadSpawn option which behaves much
like Mongrel 1, but uses Rainbows! in production that I know of.

The Rack +env+ hash is the safe/universal way to store request-local
variables across different web servers.

-- 
Eric Wong
_______________________________________________
Unicorn mailing list - [email protected]
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying

Reply via email to