I'm establishing an Apache2 webserver running multiple Ruby on Rails web programs with Phusion Passenger. I understand that Passenger spawns Ruby approaches for handling demands. I've the next questions:

  • If several request needs to be handled simultaneously, will Passenger spawn multiple processes or multiple (Ruby) threads? How do you configure it therefore it always spawns single-threaded processes?
  • Basically have two Rails programs, suppose a request application A would go to process 1, then later request application B arrives. Is it feasible that process 1 will handle this request too? When and just how is possible? Quite simply, is a process permitted to deal with demands for multiple Rails programs?
  • I have a similar Rails application released in multiple Web addresses and multiple virtual hosts (for example http:// and https://). Will exactly the same process have the ability to serve different virtual hosts? (The response to this appears to become yes, I have set a worldwide variable in responding to a request to virtual host A, and that i could retrieve the worthiness in virtual host B.)

In most cases, Passenger spawns new processes by forking an ApplicationSpawner, that has the framework and application code pre-loaded into memory, or perhaps a FrameworkSpawner, which merely has the framework code.

Passenger, so far as I understand, does not offer threads. Rather, because the load increases with an application, it'll fork that Application's ApplicationSpawner and initialize another instance. When load decreases, a number of application instances are wiped out off.

If Passenger is set up inside a certain way (In my opinion by selecting the "wise" spawn method), it'll produce a FrameworkSpawner, which loads the rails code, but no application code, which could then be forked to load and application by using their version of Rails.

To answer the questions you have:

  • It'll serve them sequentially, then spawn additional processes whether it decides the burden is sufficient.

  • No. One process are only able to fit in with just one Rails Application.

  • I am type of sketchy on that one, however your experiment is sensible. Passenger ought to be wise enough to determine that despite the fact that it's running from different places within the server config, you are speaking comparable application. It's most likely in line with the application's filesystem path.

EDIT: I went and educate yourself about this a little. Works out I had been mostly right, however the technical particulars were a little off. Begin to see the Passenger documentation

Yup, Burke is appropriate. Just in case from the third question, Phusion Passenger recognizes programs by their application root path. So even when you've two virtual hosts, when they both indicate exactly the same DocumentRoot then Phusion Passenger will believe that they are exactly the same application.