unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
* fork on client connection?
@ 2010-02-25 19:37 Joseph McDonald
  2010-02-25 20:50 ` Suraj Kurapati
  2010-02-25 22:43 ` Eric Wong
  0 siblings, 2 replies; 3+ messages in thread
From: Joseph McDonald @ 2010-02-25 19:37 UTC (permalink / raw)
  To: mongrel-unicorn

Would it be possible to configure unicorn to fork off your rack
process when it gets a connection from a client as opposed to
preforking  the workers?  While in development mode I have my app kill
itself after serving a request, however at that point unicorn fires up
a new one right away.  If it could wait until it got a connection from
a client, that would be *super awesome* for development mode.

thanks,
-joe
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: fork on client connection?
  2010-02-25 19:37 fork on client connection? Joseph McDonald
@ 2010-02-25 20:50 ` Suraj Kurapati
  2010-02-25 22:43 ` Eric Wong
  1 sibling, 0 replies; 3+ messages in thread
From: Suraj Kurapati @ 2010-02-25 20:50 UTC (permalink / raw)
  To: unicorn list

On Thu, Feb 25, 2010 at 11:37 AM, Joseph McDonald <superjoe@gmail.com> wrote:
> Would it be possible to configure unicorn to fork off your rack
> process when it gets a connection from a client as opposed to
> preforking  the workers?

+1
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: fork on client connection?
  2010-02-25 19:37 fork on client connection? Joseph McDonald
  2010-02-25 20:50 ` Suraj Kurapati
@ 2010-02-25 22:43 ` Eric Wong
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Wong @ 2010-02-25 22:43 UTC (permalink / raw)
  To: Joseph McDonald; +Cc: unicorn list

Joseph McDonald <superjoe@gmail.com> wrote:
> Would it be possible to configure unicorn to fork off your rack
> process when it gets a connection from a client as opposed to
> preforking  the workers?  While in development mode I have my app kill
> itself after serving a request, however at that point unicorn fires up
> a new one right away.  If it could wait until it got a connection from
> a client, that would be *super awesome* for development mode.

Hi Joseph,

Instead of forking late, you could avoid building your app until
a client has been accepted.  Try this in your Unicorn config file:

  preload_app false # default
  after_fork do |server, worker|
    server.app = server.orig_app
    server.preload_app = true
    def server.process_client(client)
      build_app!
      Process.kill(:QUIT, $$) # exit after serving
      super
    end
  end

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-02-25 22:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-25 19:37 fork on client connection? Joseph McDonald
2010-02-25 20:50 ` Suraj Kurapati
2010-02-25 22:43 ` Eric Wong

Code repositories for project(s) associated with this public inbox

	https://yhbt.net/unicorn.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).