(simple) Passenger Architecture Questions

11 views
Skip to first unread message

mr_anderson

unread,
Aug 20, 2009, 7:30:30 PM8/20/09
to Phusion Passenger Discussions
I've read the Passenger architectural overview
http://www.modrails.com/documentation/Architectural%20overview.html
and I have a couple of questions I was hoping someone could help me
with.

a. Referring to this diagram http://www.modrails.com/documentation/Architectural%20overview.html#spawn_server.
In looking at passenger processes running on several servers I
manage ... I can see the Application instances, Application spawner
server, Passenger Spawn Server but I don't see the Framework Spawner
server. Why is that?

b. In the process list, there is the Passenger Spawn Server, but there
is also a longer path that looks like this in the list
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.4/ext/apache2/
ApplicationPoolServerExecutable 0 /usr/lib/ruby/gems/1.8/gems/
passenger-2.2.4/bin/passenger-spawn-server
It seems like thats the Passenger Spawn Server as well ... why is it
repeated in the like that?

c. Does the "Application Pool" referred to here
http://www.modrails.com/documentation/Architectural%20overview.html#_overview
refer to the application instances generated by the Application Spawn
Server.
I think so, but the diagram is confusing because it says that "It
should be noted that the Ruby on Rails application does not run in the
same address space as Apache" but the Application pool appears to be
in the "Apache" process in the diagram.

d. Theoretically, what kind of effect should increasing the number of
worker processes available to Apache have on your application. Does it
help performance? (assuming that running out of memory is not an
issue).


Thanks guys.

Mark Reginald James

unread,
Aug 20, 2009, 9:16:11 PM8/20/09
to Phusion Passenger Discussions
mr_anderson wrote:

> a. Referring to this diagram http://www.modrails.com/documentation/Architectural%20overview.html#spawn_server.
> In looking at passenger processes running on several servers I
> manage ... I can see the Application instances, Application spawner
> server, Passenger Spawn Server but I don't see the Framework Spawner
> server. Why is that?

The framework and application spawners will be Ruby processes.

> b. In the process list, there is the Passenger Spawn Server, but there
> is also a longer path that looks like this in the list
> /usr/lib/ruby/gems/1.8/gems/passenger-2.2.4/ext/apache2/
> ApplicationPoolServerExecutable 0 /usr/lib/ruby/gems/1.8/gems/
> passenger-2.2.4/bin/passenger-spawn-server
> It seems like thats the Passenger Spawn Server as well ... why is it
> repeated in the like that?
>
> c. Does the "Application Pool" referred to here
> http://www.modrails.com/documentation/Architectural%20overview.html#_overview
> refer to the application instances generated by the Application Spawn
> Server.
> I think so, but the diagram is confusing because it says that "It
> should be noted that the Ruby on Rails application does not run in the
> same address space as Apache" but the Application pool appears to be
> in the "Apache" process in the diagram.

Yes, the application pool code directs each HTTP request to an
application instance that has been created by the spawn server. It
either chooses the most suitable existing one, or requests the spawn
server to create a new one.

When all Apache workers are threads of a single process, the
application pool can live in the Apache address space. However a
separate application pool server process is required when there are
multiple worker processes. This is the process you see in (b), which
is responsible for starting the spawn server.

> d. Theoretically, what kind of effect should increasing the number of
> worker processes available to Apache have on your application. Does it
> help performance? (assuming that running out of memory is not an
> issue).

To allow for some queuing of requests to each instance, the limit on
the number of Apache worker threads should be somewhat higher than the
maximum size you've set for the application pool, multiplied by the
number of threads you want each Rails process to handle, plus extra
workers to handle static assets.

The number of worker processes should be just sufficient to provide
the desired protection against crashes and memory leaks.

Mark Reginald James

unread,
Aug 20, 2009, 9:37:32 PM8/20/09
to Phusion Passenger Discussions
mr_anderson wrote:

> c. Does the "Application Pool" referred to here
> http://www.modrails.com/documentation/Architectural%20overview.html#_overview
> refer to the application instances generated by the Application Spawn
> Server.

Just to be a bit clearer here:

The application pool is not the set of instances. It's just code that
chooses which instance should handle a request. Server workers ask the
application pool to choose an instance, and the server worker
communicates directly with that instance.

trustfundbaby

unread,
Aug 20, 2009, 9:42:52 PM8/20/09
to Phusion Passenger Discussions
Thanks for the detailed response Mark!
Just a few follow ups.

> The framework and application spawners will be Ruby processes.

Right. But I can see all the other processes all except the Framework
Server Spawner ....
To elaborate. If you go to this url
http://www.cordinc.com/blog/2009/02/rails-performance-options-on-p.html
and take a look at the second block that has "-------- Passenger
processes ----------" at the top.
You will see this in the list of processes
"Passenger FrameworkSpawner: 2.1.0"
I don't get that on any of my servers (2 running ubuntu, one running
cent os 4) ... and I'm wondering why.

> multiplied by the number of threads you want each Rails process to handle

Is there a good number to have in mind for this?
I'd have no clue how to determine that.

trustfundbaby

unread,
Aug 20, 2009, 10:24:27 PM8/20/09
to Phusion Passenger Discussions
Thanks Mark ... knowing that the Application Pool and the group of
Application Instances are not one and the same actually did clear up a
lot of my confusion!


On Aug 20, 8:37 pm, Mark Reginald James <m...@bigpond.net.au> wrote:
> mr_anderson wrote:
> > c. Does the "Application Pool" referred to here
> >http://www.modrails.com/documentation/Architectural%20overview.html#_...

trustfundbaby

unread,
Aug 21, 2009, 12:59:15 AM8/21/09
to Phusion Passenger Discussions
Finally figured this one out guys!
The framework is spawned separately if you use the smart spawn method.
The default (which is what all my servers are using) is the smart-lv2
method which caches the Rails Framework and the Application code
together instead of separately.

I feel like my brain just grew a little bit :D

> Right. But I can see all the other processes all except the Framework
> Server Spawner ....
> To elaborate. If you go to this urlhttp://www.cordinc.com/blog/2009/02/rails-performance-options-on-p.html
Reply all
Reply to author
Forward
0 new messages