--
You received this message because you are subscribed to the Google Groups "Phusion Passenger Discussions" group.
To post to this group, send email to phusion-...@googlegroups.com.
To unsubscribe from this group, send email to phusion-passen...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/phusion-passenger?hl=en.
http://code.google.com/p/phusion-passenger/issues/detail?id=407
Right now I've hard-coded the patch to pre-spawn 2*MaxProcesses for
each domain.
This patch also kills the mod_passenger application restart feature.
Regards,
Jay
On Dec 14, 10:55 am, Hongli Lai <hon...@phusion.nl> wrote:
> E-mail: i...@phusion.nl
Nice work, Jay. +1 for hiding proc startup latency with some kind of
min-spare-procs feature.
Yes it is.
--
Phusion | The Computer Science Company
Web: http://www.phusion.nl/
E-mail: in...@phusion.nl
However it does not support concurrency at this time. Even if you call
it from multiple threads it will only spawn one at a time. This is
something we want to address in the future.
DomainSpawnConcurrancy 3
And that will launch 3 SpawnManagers per domain.
Does that sound like it would work?
On Dec 31 2009, 2:27 pm, Hongli Lai <hon...@phusion.nl> wrote:
> 2009/12/31 hongli <hon...@phusion.nl>:
>
> > On Thu, Dec 31, 2009 at 7:46 PM, Jay Painter <jay.pain...@gmail.com> wrote:
> >> I would also like to launch multiple threads so that the processes can
> >> be started concurrently.
> >> Do you know if the SpawnManager is thread-safe?
>
> > Yes it is.
>
> However it does not support concurrency at this time. Even if you call
> it from multiple threads it will only spawn one at a time. This is
> something we want to address in the future.
>
> --
> Phusion | The Computer Science Company
>
> Web:http://www.phusion.nl/
> E-mail: i...@phusion.nl
Yes, it would work. However this will start 3 different spawn servers.
A Ruby process spawned by one spawn server cannot share memory with a
Ruby process spawned by another spawn server.
--
Phusion | The Computer Science Company
Web: http://www.phusion.nl/
E-mail: in...@phusion.nl
So it won't really work for Rails.
So, I need to modify the spawn server to support concurrency.
How about this: I modify the spawn server so that only the initial
"fork" from the spawn server is
under the SpawnManager lock. Then the spawn server process sends a
signal back to the SpawnManager indicating
it has completed fork()ing. The SpawnManager then can release the
main lock, but keeps blocking while the newly spawned
process starts up. That way calls to the SpawnManager will only be
serialized during the initial fork(). If the spawn process needs
to talk to the SpawnManager, it can do it from the fork()ed process
instead of the spawn process (where it would be serialized).
Does this sound like a better approach?
Yes. I had something similar in mind for future refactoring. The way
it works now (oversimplified description) is that spawn_manager.rb
calls Railz::ApplicationSpawner#spawn, which returns an AppProcess
object, and sends the information in the AppProcess back to the C++
SpawnManager. This can take a while: #spawn waits for the app process
to create an owner pipe, which happens after Rails is loaded.
Actually, now that I think about it, it should be possible to solve
this problem in a simpler manner. At this time all communication with
the spawn server happens over a single IO channel, which is also used
to check whether the parent process has exited. If you can modify the
spawn server to listen on a Unix socket instead, with a separate owner
pipe for checking parent process liveliness, then you can make the
spawn server concurrent by handling each client in a separate thread.
Each client thread would use a different communication channel so the
messages won't interleave with each other.
I had an idea this morning that might actually make launching multiple
spawn server processes work. The SpawnManager could be modified to to
create a static (class-wide) spawn manager process that is not used
for any actual spawning. After the "master" spawn process is created,
new instances of SpawnManager get spawning processes that are forked
from the master spawn process instead of being forked by the
SpawnManager. That would allow the use of multiple concurrent
SpawnManager instances using spawn-manager processes that were all
forked from the same process. Then shared memory for Rails/Ruby
Enterprise Edition would still work.
Does that sound easier?
-Jay